Abraxas-365 / langchain-rust

🦜️🔗LangChain for Rust, the easiest way to write LLM-based programs in Rust
MIT License
625 stars 83 forks source link

fix: allow ConversationalAgentBuilder to be built using a dynamic LLM… #227

Closed samuelint closed 1 month ago

samuelint commented 2 months ago

It's currently not possible to create a ConversationalAgent using the ConversationalAgentBuilder if the LLM instance is not static. This Pull-Request fix that.

Usage example:

let llm: Box<dyn LLM> = self.llm_factory.create(CreateLLMParameters {
    model: parameters.model, // openai:gpt-4o-mini or anthropic:claude-xyz
})?;

let agent = ConversationalAgentBuilder::new().build(llm).unwrap();
samuelint commented 2 months ago

@Abraxas-365 can this be merged?

samuelint commented 1 month ago

Any update @prabirshrestha, @Abraxas-365 ? This is a very small change / easy to review. And the pipeline passed ;)

prabirshrestha commented 1 month ago

Was back from vacation and have been catching up at work. I did see the PR but wanted to see if we can avoid Box if possible.

samuelint commented 1 month ago

Was back from vacation and have been catching up at work. I did see the PR but wanted to see if we can avoid Box if possible.

I'm curious, why Box should be avoided?

prabirshrestha commented 1 month ago

LGTM. Was thinking if there are alternatives.

samuelint commented 1 month ago

@prabirshrestha when should I expect a new release? (So my change is on the crate registry)

Abraxas-365 commented 1 month ago

I will push a new release later today 💪🏾