Class: Deja::Adapters::Anthropic
- Inherits:
-
Base
- Object
- Base
- Deja::Adapters::Anthropic
show all
- Defined in:
- lib/deja/adapters/anthropic.rb
Overview
Wires the Anthropic provider from llm_mock_anthropic into Deja’s cache. All Anthropic-SDK shape knowledge — the stub client, the response structs, and serialize/deserialize — lives in LlmMock::Anthropic; this adapter just routes its calls through Deja::Cache (via Base#cached_call).
Instance Attribute Summary
Attributes inherited from Base
#install_block, #key
Instance Method Summary
collapse
Methods inherited from Base
#cached_call, #initialize, #real_client
Instance Method Details
#build_mock_client ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/deja/adapters/anthropic.rb', line 17
def build_mock_client
adapter = self
provider.build_client do |method, kwargs|
adapter.cached_call(method, kwargs) do
adapter.provider.call_real(adapter.real_client, method, kwargs)
end
end
end
|
#default_real_client ⇒ Object
26
27
28
|
# File 'lib/deja/adapters/anthropic.rb', line 26
def default_real_client
provider.default_real_client
end
|
#deserialize(method, data) ⇒ Object
38
39
40
|
# File 'lib/deja/adapters/anthropic.rb', line 38
def deserialize(method, data)
provider.deserialize(method, data)
end
|
#prompt_for(kwargs) ⇒ Object
30
31
32
|
# File 'lib/deja/adapters/anthropic.rb', line 30
def prompt_for(kwargs)
provider.prompt_for(kwargs)
end
|
#provider ⇒ Object
13
14
15
|
# File 'lib/deja/adapters/anthropic.rb', line 13
def provider
@provider ||= LlmMock::Anthropic::Provider.new
end
|
#serialize(method, response) ⇒ Object
34
35
36
|
# File 'lib/deja/adapters/anthropic.rb', line 34
def serialize(method, response)
provider.serialize(method, response)
end
|