Class: AnthropicRequestDetails
- Inherits:
-
Object
- Object
- AnthropicRequestDetails
- Defined in:
- lib/anthropic_request_details.rb
Overview
GlimRequest delegates to this
Instance Attribute Summary collapse
-
#req ⇒ Object
Returns the value of attribute req.
Instance Method Summary collapse
-
#initialize(req) ⇒ AnthropicRequestDetails
constructor
only for requests that involve a message array, like OpenAI.
- #llm_class_changed ⇒ Object
- #response_class ⇒ Object
- #update_request_hash ⇒ Object
Constructor Details
#initialize(req) ⇒ AnthropicRequestDetails
only for requests that involve a message array, like OpenAI
14 15 16 |
# File 'lib/anthropic_request_details.rb', line 14 def initialize(req) @req = req end |
Instance Attribute Details
#req ⇒ Object
Returns the value of attribute req.
18 19 20 |
# File 'lib/anthropic_request_details.rb', line 18 def req @req end |
Instance Method Details
#llm_class_changed ⇒ Object
24 25 26 |
# File 'lib/anthropic_request_details.rb', line 24 def llm_class_changed update_request_hash end |
#response_class ⇒ Object
20 21 22 |
# File 'lib/anthropic_request_details.rb', line 20 def response_class AnthropicResponse end |
#update_request_hash ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/anthropic_request_details.rb', line 28 def update_request_hash req.request_hash[:max_tokens_to_sample] = req.max_tokens || 2000 req.request_hash[:prompt] = req.prompt req.request_hash[:temperature] = req.temperature req.request_hash[:model] = req.llm_name # deeply remove keys for any values that are nil req.request_hash.delete_if { |k, v| v.nil? } end |