SharedTreeChatModel Interface
A plugin interface that handles queries from a SharedTreeSemanticAgent.
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 an underlying communication with an LLM and receives all necessary context from the agent for the LLM to properly analyze and edit the tree. See @fluidframework/tree-agent-langchain for a drop-in implementation based on the LangChain library.
Properties
| Property | Alerts | Modifiers | Type | Description |
|---|---|---|---|---|
| editToolName | Alpha | optional | string | The name of the tool that the model should use to edit the tree. |
| name | Alpha | optional | string | A optional name of this chat model. |
Methods
| Method | Alerts | Modifiers | Return Type | Description |
|---|---|---|---|---|
| appendContext(text) | Alpha | optional | void | Add contextual information to the model that may be relevant to future queries. |
| query(message) | Alpha | Promise<string> | Queries the chat model with a request from the user. |
Property Details
editToolName
The name of the tool that the model should use to edit the tree.
For more information about our API support guarantees, see here.
Signature
editToolName?: string;
Type: string
Remarks
If supplied, this will be mentioned in the context provided to the model so that the underlying LLM will be encouraged to use it when a user query requires an edit. The model should "implement" the tool by registering it with the underlying LLM API. The tool should take an LLM-generated JavaScript function as input and supply it to the edit function. Instructions for generating the proper function signature and implementation will be provided by the agent via context. If not supplied, the model will not be able to edit the tree (running the edit function will fail).
name
A optional name of this chat model.
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
appendContext
Add contextual information to the model that may be relevant to future queries.
For more information about our API support guarantees, see here.
Signature
appendContext?(text: string): void;
Remarks
In practice, this may be implemented by e.g. appending a "system" message to an LLM's chat/message history. This context must be present in the context window of every query for e.g. editing to work.
Parameters
| Parameter | Type | Description |
|---|---|---|
| text | string | The message or context to append. |
query
Queries the chat model with a request from the user.
For more information about our API support guarantees, see here.
Signature
query(message: SharedTreeChatQuery): Promise<string>;
Remarks
This model may simply return a text response to the query, or it may first call the edit(js) function (potentially multiple times) to modify the tree in response to the query.
Parameters
| Parameter | Type | Description |
|---|---|---|
| message | SharedTreeChatQuery |
Returns
Return type: Promise<string>