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

Added Tool Call and Tool Result to GetPrompt for in-context learning … #188

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
58 changes: 58 additions & 0 deletions schema/draft/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,18 @@
},
"role": {
"$ref": "#/definitions/Role"
},
"toolCalls": {
"items": {
"$ref": "#/definitions/ToolCall"
},
"type": "array"
},
"toolResult": {
"items": {
"$ref": "#/definitions/ToolResult"
},
"type": "array"
}
},
"required": [
Expand Down Expand Up @@ -2065,6 +2077,30 @@
],
"type": "object"
},
"ToolCall": {
"description": "A tool call initiated by the assistant.",
"properties": {
"arguments": {
"additionalProperties": {},
"description": "The arguments passed to the tool, as a JSON object.",
"type": "object"
},
"id": {
"description": "A unique identifier for this tool call.\nThis ID is used to match tool calls with their results.",
"type": "string"
},
"name": {
"description": "The name of the tool being called.",
"type": "string"
}
},
"required": [
"arguments",
"id",
"name"
],
"type": "object"
},
"ToolListChangedNotification": {
"description": "An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.",
"properties": {
Expand All @@ -2089,6 +2125,28 @@
],
"type": "object"
},
"ToolResult": {
"description": "A result returned from a tool call.",
"properties": {
"content": {
"description": "The content returned from the tool, typically text.",
"type": "string"
},
"isError": {
"description": "Whether the tool call resulted in an error.\nIf not specified, assumed to be false.",
"type": "boolean"
},
"toolCallId": {
"description": "The ID of the tool call this result is for.\nThis must match the ID of a previous tool call.",
"type": "string"
}
},
"required": [
"content",
"toolCallId"
],
"type": "object"
},
"UnsubscribeRequest": {
"description": "Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.",
"properties": {
Expand Down
47 changes: 47 additions & 0 deletions schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,55 @@ export type Role = "user" | "assistant";
export interface PromptMessage {
role: Role;
content: TextContent | ImageContent | AudioContent | EmbeddedResource;
toolCalls?: ToolCall[]; // Tool calls requested by the the Assistant
toolResult?: ToolResult[]; // Tool responses returned by the User (Host)
}


/**
* A tool call initiated by the assistant.
*/
export interface ToolCall {
/**
* A unique identifier for this tool call.
* This ID is used to match tool calls with their results.
*/
id: string;

/**
* The name of the tool being called.
*/
name: string;

/**
* The arguments passed to the tool, as a JSON object.
*/
arguments: { [key: string]: unknown };
}

/**
* A result returned from a tool call.
*/
export interface ToolResult {
/**
* The ID of the tool call this result is for.
* This must match the ID of a previous tool call.
*/
toolCallId: string;

/**
* The content returned from the tool, typically text.
*/
content: string;

/**
* Whether the tool call resulted in an error.
* If not specified, assumed to be false.
*/
isError?: boolean;
}


/**
* The contents of a resource, embedded into a prompt or tool call result.
*
Expand Down