Class: Foobara::Ai::AnthropicApi::CreateMessage
- Inherits:
-
BaseCommand
- Object
- Command
- BaseCommand
- Foobara::Ai::AnthropicApi::CreateMessage
- Defined in:
- foobara-anthropic-api-1.0.5/src/foobara/ai/anthropic_api/create_message.rb
Constant Summary
Constants included from TruncatedInspect
Instance Method Summary collapse
Methods inherited from BaseCommand
#anthropic_version, #api_token, #api_token_from_env, #build_request_headers, #issue_http_request
Methods inherited from Command
Methods included from TruncatedInspect
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Method Details
#build_request_body ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'src/foobara/ai/anthropic_api/create_message.rb', line 20 def build_request_body body = { model:, max_tokens:, messages: } temp = inputs[:temperature] if temp body[:temperature] = temp end sys = inputs[:system] if sys body[:system] = sys end self.request_body = body end |
#build_result ⇒ Object
36 37 38 |
# File 'src/foobara/ai/anthropic_api/create_message.rb', line 36 def build_result Types::MessageResult.new(response_body, ignore_unexpected_attributes: true) end |