Class: RSpec::LLM::Adapters::Langchain
- Defined in:
- lib/rspec/llm/adapters/langchain.rb
Overview
Adapter for the langchainrb gem (github.com/patterns-ai-core/langchainrb). Wraps a Langchain::LLM::* instance.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from RSpec::LLM::Adapters::Base
Instance Method Details
#chat(messages) ⇒ Object
9 10 11 12 13 |
# File 'lib/rspec/llm/adapters/langchain.rb', line 9 def chat() normalized = () response = client.chat(messages: normalized) extract_content(response) end |
#embed(text) ⇒ Object
15 16 17 18 |
# File 'lib/rspec/llm/adapters/langchain.rb', line 15 def (text) response = client.(text: text) extract_vector(response) end |