Skip to content

Conversation

Cirilla-zmh
Copy link
Member

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

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

Comment on lines +123 to +124
" FUNCTION = \"function\"\n",
" CUSTOM = \"custom\"\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does these mean?

Copy link
Member Author

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",
Copy link
Contributor

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",
Copy link
Contributor

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

Copy link
Member Author

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.

Comment on lines +320 to +321
> [!Warning]
> This attribute is likely to contain sensitive information including user/PII data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> [!Warning]
> This attribute is likely to contain sensitive information including user/PII data.

there should be nothing sensitive in the tool definition, right?

Copy link
Member Author

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" 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.

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

Successfully merging this pull request may close these issues.

Define schema for Tool Definitions for Single and Multi-Agent Spans
3 participants