Skip to content

Chat tools API #213274

@roblourens

Description

@roblourens

This is a proposal to enable tool use/function calling from chat participants and other extensions that use language models.

Proposal dts: https://github.com/microsoft/vscode/blob/b1252f75d52bcc576ca58415512343a8413fa260/src/vscode-dts/vscode.proposed.chatTools.d.ts

Tool use sample: https://github.com/microsoft/vscode-extension-samples/tree/roblou/tool-user/chat-tools-sample
Basic chat sample: https://github.com/microsoft/vscode-extension-samples/tree/main/chat-sample
Docs: https://code.visualstudio.com/api/extension-guides/chat

Extension authors can subscribe to this issue to get updates about the proposed Tools API.

We are very interested in feedback about how you might use this API.

September TODO list

  • Tools show a progress message when invoked in a chat session using invokeTool
  • Enable tools to show a confirmation message before being executed
  • Tools can advertise their supported content types, and invokeTool takes a list of requested contentTypes

October TODO list

  • Tools can have tags
  • Generic typed tool parameters
  • Confirmation dialog should show up when calling invokeTool outside of a chat session
  • Remove unenforceable text/plain "requirement", but be more clear about usage in docs. Clarify that a JSON.stringify result be simply text/plain.
  • Remove ChatMessage prefix part on tool call/result types.
  • Remove LanguageModelChatMessageToolResultPart#isError- not sure why we have this, it isn't used
  • Decide how to handle tool name/ID, whether it's required to pick a unique name.
    • A unique name, explain the situation in docs
  • Normalize description/modelDescription
    • Could be description: string | { description: string; userDescription?; string }
  • Confirmation message format, recommended wording, whether participantName is included. How it's presented in chat session confirmation vs non-chat confirmation dialog
    • Can do a custom markdown dialog
  • Is it incorrect to have a generic parameter on invokeTool? Should parameters always be Object on this end, since in theory you are calling the tool without knowing the types?
    • Remove this parameter, split the invocation options interfaces
  • Decide on shape for toolChoice parameter
  • LanguageModelTool uses a remote schema for parametersSchema, but default is wrong #225727
  • Remaining TODOs in dts
  • parameters should be JSON.parsed?
  • Find a name for canBeInvokedManually, or cut this from finalization
  • Validate JSON schema when calling a tool 💪
  • An auto-continue button to skip confirmations for a request 💪
  • Can we do something to make tool calling more automatic? Helper tools or just a better sample that can be copied for now with functions that can be used as a "library" 💪

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions