lm

object lm(source)

Namespace for language model related functionality.

Online Documentation

Properties

Link copied to clipboard

An event that is fired when the set of available chat models changes.

Link copied to clipboard

A list of all available tools that were registered by all extensions using lm.registerTool. They can be called with lm.invokeTool with input that match their declared inputSchema.

Functions

Link copied to clipboard
fun invokeTool(    name: String,     options: LanguageModelToolInvocationOptions<*>,     token: CancellationToken = definedExternally): PromiseLike<LanguageModelToolResult>

Invoke a tool listed in lm.tools by name with the given input. The input will be validated against the schema declared by the tool

Link copied to clipboard

Registers a provider that publishes Model Context Protocol servers for the editor to consume. This allows MCP servers to be dynamically provided to the editor in addition to those the user creates in their configuration files.

Link copied to clipboard

Register a LanguageModelTool. The tool must also be registered in the package.json languageModelTools contribution point. A registered tool is available in the lm.tools list for any extension to see. But in order for it to be seen by a language model, it must be passed in the list of available tools in LanguageModelChatRequestOptions.tools.

Link copied to clipboard

Select chat models by a selector. This can yield multiple or no chat models and extensions must handle these cases, esp. when no chat model exists, gracefully.