unchained
Types
pub type Chain {
  Chain(steps: List(ChainStep), memory: Memory)
}Constructors
- 
          Chain(steps: List(ChainStep), memory: Memory)
pub type ChainStep {
  LLMStep(llm_config: LLMConfig)
  ToolStep(tool: Tool)
  PromptTemplate(
    template: handles.Template,
    tools: List(TooSelector),
  )
  ChainBreaker(should_stop: fn(String) -> Option(String))
}Constructors
- 
          LLMStep(llm_config: LLMConfig)
- 
          ToolStep(tool: Tool)
- 
          PromptTemplate( template: handles.Template, tools: List(TooSelector), )
- 
          ChainBreaker(should_stop: fn(String) -> Option(String))
pub type Error {
  ChainError(String)
  LLMError(String)
  HTTPError(String)
}Constructors
- 
          ChainError(String)
- 
          LLMError(String)
- 
          HTTPError(String)
pub type HistoryEntry {
  HistoryEntry(input: String, output: String, timestamp: Time)
}Constructors
- 
          HistoryEntry(input: String, output: String, timestamp: Time)
pub type LLMConfig {
  LLMConfig(host: String, model: String, temperature: Float)
}Constructors
- 
          LLMConfig(host: String, model: String, temperature: Float)
pub type LLMResponse {
  Response(response: String)
}Constructors
- 
          Response(response: String)
pub type Memory {
  Memory(
    variables: Dict(String, String),
    history: List(HistoryEntry),
  )
}Constructors
- 
          Memory( variables: Dict(String, String), history: List(HistoryEntry), )
pub type TooSelector {
  ToolSelector(select: fn(String) -> Option(String), tool: Tool)
}Constructors
- 
          ToolSelector(select: fn(String) -> Option(String), tool: Tool)
Functions
pub fn add_prompt_template(
  chain: Chain,
  template_str: String,
  tools: List(TooSelector),
) -> Result(Chain, TokenizerError)pub fn run_with(
  chain: Chain,
  input: String,
  llm_engine: fn(String, LLMConfig) -> Result(LLMResponse, Error),
) -> Result(String, Error)pub fn set_variable(
  chain: Chain,
  key: String,
  value: String,
) -> Chain