bruteSourceBruteMiddlewareCompletionLangChain

class LangChain

Completion backed by the langchainrb gem (https://github.com/patterns-ai-core/langchainrb).

The gem is an optional dependency — install it with bundle config set --local with completions && bundle install. langchainrb's LLM classes wrap many providers; build one and hand it over:

run Brute::Middleware::Completion::LangChain.new( llm: Langchain::LLM::OpenAI.new(api_key: ENV["OPENAI_API_KEY"]), )

Options:

llm: a Langchain::LLM instance (required; client: is an alias) model: model id override (falls back to env[:model], then the llm instance's default) tools: tools list, any shape Tools::Adapter accepts temperature: sampling temperature (default 0.7)