View Source Train.Chains.ConversationChain (train v0.0.1-dev)

Link to this section Summary

Functions

Ask a question to the given chain.

Link to this section Functions

@spec run(Train.LlmChain.t(), String.t()) ::
  {:ok, [String.t()], String.t()} | {:error, [String.t()], String.t()}

Ask a question to the given chain.

Usage: {:ok, memory_pid} = Train.Memory.BufferAgent.start_link() tools = [Train.Tools.Calculator, Train.Tools.SerpApi] chain = Train.LlmChain.new(%{memory_pid: memory_pid, tools: tools}) {:ok, messages, response} = chain |> Train.Chains.ConversationChain.run("Who is Angela Merkel?") {:ok, messages, response} = chain |> Train.Chains.ConversationChain.run("Where was she born?")