-
Notifications
You must be signed in to change notification settings - Fork 268
Add JSON Schema Definition for gen_ai.tool.definitions #2793
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
base: main
Are you sure you want to change the base?
Add JSON Schema Definition for gen_ai.tool.definitions #2793
Conversation
" FUNCTION = \"function\"\n", | ||
" CUSTOM = \"custom\"\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does these mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://platform.openai.com/docs/api-reference/chat/get. OpenAI provide a 'custom' type for those tools who are not a function in a general sence - they usually have more customized input formats.
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"class ToolDefinitions(RootModel[List[ToolDefinition]]):\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ToolDefinition should be defined in this cell since it's not used elsewhere
" name: str = Field(description=\"Name of the tool.\")\n", | ||
" description: str = Field(description=\"Description of the tool.\")\n", | ||
" parameters: Any = Field(description=\"Format of the tool parameters. Maybe it is a JSON schema.\")\n", | ||
" response: Any = Field(description=\"Format of the tool response. Maybe it is a JSON schema.\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This response
isn't optional here, but it's not in the example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add more example soon.
> [!Warning] | ||
> This attribute is likely to contain sensitive information including user/PII data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> [!Warning] | |
> This attribute is likely to contain sensitive information including user/PII data. |
there should be nothing sensitive in the tool definition, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't think so. The descriptions might have sensitive information - prompt might be classified. But it seems like no user/PII data indeed.
" type: Union[ToolType, str] = Field(description=\"Type of the tool.\")\n", | ||
" name: str = Field(description=\"Name of the tool.\")\n", | ||
" description: str = Field(description=\"Description of the tool.\")\n", | ||
" parameters: Any = Field(description=\"Format of the tool parameters. Maybe it is a JSON schema.\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" parameters: Any = Field(description=\"Format of the tool parameters. Maybe it is a JSON schema.\")\n", | |
" parameters: Any = Field(description=\"Describes the parameters to this function in the provider-specific format.\")\n", |
"Maybe it is a JSON schema" does not seem to be definitive enough.
Fixes #2721
Changes
Add JSON schema definition for gen_ai.tool.definitions.
Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.
Merge requirement checklist
[chore]