Skip to main content

@fluidframework/tree-agent-langchain Package

LangChain integration helpers for the SharedTreeSemanticAgent.

Functions

FunctionAlertsReturn TypeDescription
createLangchainChatModel(langchainModel)AlphaSharedTreeChatModelCreates a stateless SharedTreeChatModel backed by LangChain.
createLegacyLangchainChatModel(langchainModel)Deprecated, AlphaSharedTreeChatModelCreates a legacy stateful SharedTreeChatModel backed by LangChain.

Function Details

createLangchainChatModel

Creates a stateless SharedTreeChatModel backed by LangChain.

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

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

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

Signature

export declare function createLangchainChatModel(langchainModel: BaseChatModel): SharedTreeChatModel;

Remarks

Use with createTreeAgent.

Parameters

ParameterTypeDescription
langchainModelBaseChatModelThe LangChain chat model to use.

Returns

Return type: SharedTreeChatModel

createLegacyLangchainChatModel

Creates a legacy stateful SharedTreeChatModel backed by LangChain.

This API is deprecated and will be removed in a future release.
This API is provided as an alpha preview and may change without notice.

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

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

Signature

export declare function createLegacyLangchainChatModel(langchainModel: BaseChatModel): SharedTreeChatModel;

Remarks

This implementation maintains internal message history and manages the edit loop via the edit callback pattern. Use with SharedTreeSemanticAgent.

Parameters

ParameterTypeDescription
langchainModelBaseChatModelThe LangChain chat model to use.

Returns

Return type: SharedTreeChatModel