-
Notifications
You must be signed in to change notification settings - Fork 331
Add JSON Schema Definition for gen_ai.tool.definitions #3378
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Use this changelog template to create an entry for release notes. | ||
| # | ||
| # If your change doesn't affect end users you should instead start | ||
| # your pull request title with [chore] or use the "Skip Changelog" label. | ||
|
|
||
| # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
| change_type: enhancement | ||
|
|
||
| # The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) | ||
| component: gen-ai | ||
|
|
||
| # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
| note: Enhance the definition of `gen_ai.tool.definitions` attribute. | ||
|
|
||
| # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
| # The values here must be integers. | ||
| issues: [2721, 1835] | ||
|
|
||
| # (Optional) One or more lines of additional information to render under the primary note. | ||
| # These lines will be padded with 2 spaces and then inserted directly into the document. | ||
| # Use pipe (|) for multiline entries. | ||
| subtext: | | ||
| The schema of `gen_ai.tool.definitions` attribute is now enhanced to: | ||
| - Add JSON schema of `gen_ai.tool.definitions` attribute. | ||
| - Document the behavior of capturing tool definitions. | ||
| - Capture the tool definitions in a simplified format if the content capturing is disabled. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| { | ||
| "$defs": { | ||
| "FunctionToolDefinition": { | ||
| "additionalProperties": true, | ||
| "description": "Represents a tool definition in the form of a function.", | ||
| "properties": { | ||
| "type": { | ||
| "const": "function", | ||
| "description": "The type of the tool.", | ||
| "title": "Type", | ||
| "type": "string" | ||
| }, | ||
| "name": { | ||
| "description": "The name of the tool.", | ||
| "title": "Name", | ||
| "type": "string" | ||
| }, | ||
| "description": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "string" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ], | ||
| "default": null, | ||
| "description": "The description of the tool.Since this attribute could be large, it's NOT RECOMMENDED to be populated by default.Instrumentations MAY provide a way to enable populating this property.", | ||
| "title": "Description" | ||
| }, | ||
| "parameters": { | ||
| "anyOf": [ | ||
| {}, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for the If it is
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following on from that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And I think there should be a way to make pydantic reference the external schema http://json-schema.org/draft-07/schema# so that the generated schema is fully defined |
||
| { | ||
| "type": "null" | ||
| } | ||
| ], | ||
Cirilla-zmh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "default": null, | ||
| "description": "Schema that defines the parameters accepted by the tool. The RECOMMENDED format is JSON Schema.Since this attribute could be large, it's NOT RECOMMENDED to be populated by default.Instrumentations MAY provide a way to enable populating this property.", | ||
| "title": "Parameters" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "type", | ||
| "name" | ||
| ], | ||
| "title": "FunctionToolDefinition", | ||
| "type": "object" | ||
| }, | ||
| "GenericToolDefinition": { | ||
| "additionalProperties": true, | ||
| "description": "Represents a tool definition in any forms.", | ||
| "properties": { | ||
| "type": { | ||
| "description": "The type of the tool.", | ||
| "title": "Type", | ||
| "type": "string" | ||
| }, | ||
| "name": { | ||
| "description": "The name of the tool.", | ||
| "title": "Name", | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "type", | ||
| "name" | ||
| ], | ||
| "title": "GenericToolDefinition", | ||
| "type": "object" | ||
| } | ||
| }, | ||
| "description": "Represents the list of tool definitions available to the GenAI agent or model.", | ||
| "items": { | ||
| "anyOf": [ | ||
| { | ||
| "$ref": "#/$defs/FunctionToolDefinition" | ||
| }, | ||
| { | ||
| "$ref": "#/$defs/GenericToolDefinition" | ||
| } | ||
| ] | ||
| }, | ||
| "title": "ToolDefinitions", | ||
| "type": "array" | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.