agora.common.toolformers.langchain
LangChainConversation Objects
class LangChainConversation(Conversation)
__init__
def __init__(agent: CompiledGraph,
messages: List[str],
category: Optional[str] = None) -> None
Initializes a LangChainConversation instance.
Arguments:
agentCompiledGraph - The compiled LangChain agent to process messages.messagesList[str] - The conversation history.categoryOptional[str], optional - An optional category or tag for the conversation.
__call__
def __call__(message: str, print_output: bool = True) -> str
Sends a message to the conversation and returns the AI response.
Arguments:
messagestr - The user message or query.print_outputbool, optional - Whether to print the AI response as it streams.
Returns:
str- The concatenated AI response.
LangChainToolformer Objects
class LangChainToolformer(Toolformer)
__init__
def __init__(model: BaseChatModel)
Initializes a LangChainToolformer.
Arguments:
modelBaseChatModel - The underlying language model for processing.
new_conversation
def new_conversation(prompt: str,
tools: List[ToolLike],
category: Optional[str] = None) -> Conversation
Creates a new conversation using the provided prompt and tools.
Arguments:
promptstr - The initial conversation prompt.toolsList[ToolLike] - Tools available to the conversation.categoryOptional[str], optional - A category or tag for this conversation.
Returns:
Conversation- The conversation instance using the specified tools.