Class: Foobara::Ai::AnswerBot::DomainMappers::AnthropicApi::ChatToCreateMessage
- Inherits:
-
DomainMapper
- Object
- DomainMapper
- Foobara::Ai::AnswerBot::DomainMappers::AnthropicApi::ChatToCreateMessage
- Defined in:
- foobara-ai-1.0.6/src/foobara/ai/answer_bot/domain_mappers/anthropic_api/chat_to_create_message.rb
Constant Summary
Constants included from TruncatedInspect
Instance Method Summary collapse
Methods inherited from DomainMapper
applicable?, applicable_score, #execute, foobara_on_register, from, #from, from_type, install!, map, map!, matches?, to, to_type
Methods included from CommandPatternImplementation
install_state_machine_callback_methods
Methods included from TruncatedInspect
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Method Details
#chat ⇒ Object
39 40 41 |
# File 'src/foobara/ai/answer_bot/domain_mappers/anthropic_api/chat_to_create_message.rb', line 39 def chat from[:chat] end |
#map ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'src/foobara/ai/answer_bot/domain_mappers/anthropic_api/chat_to_create_message.rb', line 19 def map , = chat..partition(&:system?) inputs = { messages: .map do || { role: .role, content: .content } end } unless .empty? inputs[:system] = .map(&:content).join("\n") end if model inputs[:model] = model end inputs end |
#model ⇒ Object
43 44 45 |
# File 'src/foobara/ai/answer_bot/domain_mappers/anthropic_api/chat_to_create_message.rb', line 43 def model from[:model] end |