Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Version of the library
Describe the bug
Extra } or any other text/symbols at the end corrupts valid json, causing tool_args to have extra keys
How to reproduce
input (has extra } at the end, it can be replaced with any raw text)
{"thoughts": ["t"], "tool_name": "x", "tool_args": {"runtime": "terminal", "code": "# comment line\n# comment line\n# comment line\nis_permissive = schema == {'type': 'object', 'properties': {}, 'additionalProperties': True}"}}}
schema
{
"type": "object",
"required": [],
"properties": {
"thoughts": {
"type": "array",
"items": {
"type": "string"
}
},
"headline": {
"type": "string"
},
"tool_name": {
"type": "string"
},
"tool_args": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": false
}
result (both modes) - extra keys "additionalProperties" and "properties" are added, "code" key value is truncated
{
"thoughts": [
"t"
],
"tool_args": {
"additionalProperties": true,
"code": "# comment line\n# comment line\n# comment line\nis_permissive = schema == {'type': 'object'",
"properties": {},
"runtime": "terminal"
},
"tool_name": "x"
}
Expected behavior
Extra garbage at the end is cleared for already valid json
{
"thoughts": [
"t"
],
"tool_args": {
"code": "# comment line\n# comment line\n# comment line\nis_permissive = schema == {'type': 'object', 'properties': {}, 'additionalProperties': True}",
"runtime": "terminal"
},
"tool_name": "x"
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity