Skip to main content

SharedTreeChatModel Interface

A plugin interface that handles tree-agent model invocations.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree-agent/alpha.

For more information about our API support guarantees, see here.

Signature​

export interface SharedTreeChatModel

Remarks​

This wraps the underlying communication with an LLM. See @fluidframework/tree-agent-langchain for a drop-in implementation based on the LangChain library.

Properties​

PropertyAlertsModifiersTypeDescription
editToolNameAlphaoptionalstringThe name of the tool that the model should use to edit the tree.
nameAlphaoptionalstringA optional name of this chat model.

Methods​

MethodAlertsReturn TypeDescription
invoke(history)AlphaPromise<TreeAgentChatResponse>Invoke the model with the given message history and return a single response.

Property Details​

editToolName​

The name of the tool that the model should use to edit the tree.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature​

editToolName?: string;

Type: string

Remarks​

If supplied, this is included in the generated system prompt so that the underlying LLM can request edits. The model should "implement" the tool by registering it with the underlying LLM API. The tool should accept an LLM-generated JavaScript function as input. If not supplied, the model cannot be used for semantic editing.

name​

A optional name of this chat model.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature​

name?: string;

Type: string

Remarks​

If supplied, this may be used in logging or debugging information.

Example​

"gpt-5"

Method Details​

invoke​

Invoke the model with the given message history and return a single response.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature​

invoke(history: readonly TreeAgentChatMessage[]): Promise<TreeAgentChatResponse>;

Remarks​

This is the stateless API. The model should not maintain any internal message history; all context is provided via the history parameter. Implementations should convert the TreeAgentChatMessage array to the underlying LLM's message format, invoke the LLM, and return either a TreeAgentToolCallMessage (if the model wants to call a tool) or a TreeAgentAssistantMessage (if the model is done).

Parameters​

ParameterTypeDescription
historyreadonly TreeAgentChatMessage[]

Returns​

Return type: Promise<TreeAgentChatResponse>