Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .chloggen/users_singankit_server-side-tool-calls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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 how tool calls are captured to extend support for server side tools.

# 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: [2585]

# (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:
184 changes: 178 additions & 6 deletions docs/gen-ai/gen-ai-input-messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,118 @@
"title": "ChatMessage",
"type": "object"
},
"CodeInterpreterToolCall": {
"additionalProperties": false,
"description": "Code interpreter tool call.",
"properties": {
"type": {
"const": "code_interpreter",
"description": "Type identifier for code interpreter calls.",
"title": "Type",
"type": "string"
},
"code": {
"description": "The Python code to execute.",
"title": "Code",
"type": "string"
},
"container_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Container identifier for code execution environment.",
"title": "Container Id"
}
},
"required": ["type", "code"],
"title": "CodeInterpreterToolCall",
"type": "object"
},
"CodeInterpreterToolCallResponse": {
Copy link
Member

Choose a reason for hiding this comment

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

let's also update the python code

"additionalProperties": false,
"description": "Code interpreter tool call response.",
"properties": {
"type": {
"const": "code_interpreter",
"description": "Type identifier for code interpreter responses.",
"title": "Type",
"type": "string"
},
"outputs": {
"description": "Array of outputs from code execution.",
"items": {
"oneOf": [
{
"description": "Logs output from code execution.",
"properties": {
"type": {
"const": "logs",
"description": "Output type identifier.",
"title": "Type",
"type": "string"
},
"logs": {
"description": "Text output from code execution.",
"title": "Logs",
"type": "string"
}
},
"required": ["type", "logs"],
"title": "LogsOutput",
"type": "object",
"additionalProperties": false
},
{
"description": "Image output from code execution.",
"properties": {
"type": {
"const": "image",
"description": "Output type identifier.",
"title": "Type",
"type": "string"
},
"image": {
"description": "Image data from code execution.",
"properties": {
"file_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "File identifier for the generated image.",
"title": "File Id"
}
},
"title": "Image",
"type": "object"
}
},
"required": ["type", "image"],
"title": "ImageOutput",
"type": "object",
"additionalProperties": false
}
]
},
"title": "Outputs",
"type": "array"
}
},
"required": ["type", "outputs"],
"title": "CodeInterpreterToolCallResponse",
"type": "object"
},
"FilePart": {
"additionalProperties": true,
"description": "Represents an external referenced file sent to the model by file id",
Expand Down Expand Up @@ -167,6 +279,50 @@
"title": "FilePart",
"type": "object"
},
"FunctionToolCall": {
"additionalProperties": false,
"description": "Function tool call.",
"properties": {
"type": {
"const": "function",
"description": "Type identifier for function calls.",
"title": "Type",
"type": "string"
},
"name": {
"description": "Name of the function.",
"title": "Name",
"type": "string"
},
"arguments": {
"default": null,
"description": "Arguments for the function call.",
"title": "Arguments"
}
},
"required": ["type", "name"],
"title": "FunctionToolCall",
"type": "object"
},
"FunctionToolCallResponse": {
"additionalProperties": false,
"description": "Function tool call response.",
"properties": {
"type": {
"const": "function",
"description": "Type identifier for function responses.",
"title": "Type",
"type": "string"
},
"content": {
"description": "The response content from the function call.",
"title": "Content"
}
},
"required": ["type", "content"],
"title": "FunctionToolCallResponse",
"type": "object"
},
"GenericPart": {
"additionalProperties": true,
"description": "Represents an arbitrary message part with any type and properties.\nThis allows for extensibility with custom message part types.",
Expand Down Expand Up @@ -276,15 +432,23 @@
"title": "Name",
"type": "string"
},
"arguments": {
"default": null,
"description": "Arguments for the tool call.",
"title": "Arguments"
"tool_call": {
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of flattening the changes into a new part type instead of extending the type: "tool_call" Part here?

"description": "Polymorphic tool call details with type discriminator.",
"oneOf": [
{
"$ref": "#/$defs/FunctionToolCall"
},
{
"$ref": "#/$defs/CodeInterpreterToolCall"
}
],
"title": "Tool Call"
}
},
"required": [
"type",
"name"
"name",
"tool_call"
],
"title": "ToolCallRequestPart",
"type": "object"
Expand Down Expand Up @@ -313,7 +477,15 @@
"title": "Id"
},
"response": {
"description": "Tool call response.",
"description": "Polymorphic tool call response with type discriminator.",
"oneOf": [
{
"$ref": "#/$defs/FunctionToolCallResponse"
},
{
"$ref": "#/$defs/CodeInterpreterToolCallResponse"
}
],
"title": "Response"
}
},
Expand Down
76 changes: 71 additions & 5 deletions docs/gen-ai/gen-ai-output-messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,39 @@
"title": "BlobPart",
"type": "object"
},
"CodeInterpreterToolCall": {
"additionalProperties": false,
"description": "Code interpreter tool call.",
"properties": {
"type": {
"const": "code_interpreter",
"description": "Type identifier for code interpreter calls.",
"title": "Type",
"type": "string"
},
"code": {
"description": "The Python code to execute.",
"title": "Code",
"type": "string"
},
"container_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Container identifier for code execution environment.",
"title": "Container Id"
}
},
"required": ["type", "code"],
"title": "CodeInterpreterToolCall",
"type": "object"
},
"FilePart": {
"additionalProperties": true,
"description": "Represents an external referenced file sent to the model by file id",
Expand Down Expand Up @@ -110,6 +143,31 @@
"title": "FinishReason",
"type": "string"
},
"FunctionToolCall": {
"additionalProperties": false,
"description": "Function tool call.",
"properties": {
"type": {
"const": "function",
"description": "Type identifier for function calls.",
"title": "Type",
"type": "string"
},
"name": {
"description": "Name of the function.",
"title": "Name",
"type": "string"
},
"arguments": {
"default": null,
"description": "Arguments for the function call.",
"title": "Arguments"
}
},
"required": ["type", "name"],
"title": "FunctionToolCall",
"type": "object"
},
"GenericPart": {
"additionalProperties": true,
"description": "Represents an arbitrary message part with any type and properties.\nThis allows for extensibility with custom message part types.",
Expand Down Expand Up @@ -302,15 +360,23 @@
"title": "Name",
"type": "string"
},
"arguments": {
"default": null,
"description": "Arguments for the tool call.",
"title": "Arguments"
"tool_call": {
"description": "Polymorphic tool call details with type discriminator.",
"oneOf": [
{
"$ref": "#/$defs/FunctionToolCall"
},
{
"$ref": "#/$defs/CodeInterpreterToolCall"
}
],
"title": "Tool Call"
}
},
"required": [
"type",
"name"
"name",
"tool_call"
],
"title": "ToolCallRequestPart",
"type": "object"
Expand Down
Loading
Loading