Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using tools/function (ChatToolFunction) with Parameters as a string #7

Open
stiz0r opened this issue Mar 1, 2024 · 2 comments

Comments

@stiz0r
Copy link

stiz0r commented Mar 1, 2024

In your framework you have added "parameters" in the ChatToolFunction as a string. I cannot get it to work with just adding JSON in this string.

It is defined as as "object" in the documentation:
https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools

This probably needs to be an object with the settings possible, like type, properties and required. Properties as its own object - with something dynamic because names like emotion and language are specific for this case.

When I create my own full JSON payload like below, where parameters is a normal object with no " around the parameters content, it works.
{
"tools": [
{
"type": "function",
"function": {
"description": "Classify the relevant information from the phrase.",
"name": "getinformation",
"parameters": {
"type": "object",
"properties": {
"emotion": {
"type": "string",
"description": "The emotion of the phrase."
},
"language": {
"type": "string",
"description": "The language of the phrase."
}
},
"required": [
"emotion",
"language"
]
}
}
}
]
}

Errormessage example:
{
"error": {
"message": ""{'type': 'object', 'properties': {'language': {'type': 'string','description': 'The language of the phrase.' }}}" is not of type 'object' - 'tools.0.function.parameters'",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

@JZO001
Copy link
Owner

JZO001 commented Mar 3, 2024

Hello,
You are right, nice catch. Thank you, it has a fix in version 1.3.1.

@stiz0r
Copy link
Author

stiz0r commented Mar 4, 2024

I just tested i now, thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants