Closed zakkor closed 2 days ago
Hi thanks for pointing out the issue.
Yes the model was trained with function signatures and function calls with both single quotes & double quotes.
With regards to parsing with both json.loads() and AST, we just want to make it more general so that if model returns python dictionary or json object with some invalid tokens, we can still parse them.
Please explicitly prompt the model to use json object with double quotes and it should return function calls with valid json objects.
Hi there, thanks for the model and repo!
I noticed that the given system prompt examples for function schema definitions:
As well as the actual output from tool calls:
Are not valid JSON, because JSON uses double quotes, not single quotes. I saw in your example code that you parse the output first as JSON, and if that doesn't work, by parsing the Python AST value. I'm guessing these representations are Python dicts. Additionally, some of the example function calling outputs have mixed JSON and Python AST formats inside the same response.
This is kind of problematic because most languages don't provide utilities for parsing Python AST (whereas JSON is universal), which makes this unusable outside of Python. In the case of mixed JSON/Python responses, it's even harder to parse.