Langchain

Work in progress interface for building langchain framework tools. Will attempt 1-1 correspondence with the python langchain framework (including serialisation)

Objectives:

Non-objectives:

Architecture:

The vast majority of code written when using this framework will be writing tools, working with memory, and llm models. The abstraction provided is described in the Model trait

```

[asynctrait::asynctrait]

pub trait Model where M: Memory, { async fn run(&self, memory: &mut M) -> Result<(), LanguageModelError>; } ```

This is describing that an LLM model is abstract over its own internal implementation and the memory it operates on. Memory is a serialisation of state or a "session" of a model and is expected to be passed around if required.

A very simple agent implementation would be something like

```

pub fn answer_question(question: &str) { let model = langchain::model::openai::ChatModel; let memory = langchain::model::openai::ChatMemory;

let mut agent = langchain::agent::Agent::default()
    .with_tool(SearchWeb) // implement this yourself 

let result = agent.execute( AgentRequest { memory, question: "How do birds fly?" } ).await;

}

```