Class: RailsOrchestrator::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_orchestrator/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config: nil) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/rails_orchestrator/client.rb', line 9

def initialize(config: nil)
  @config = config || RailsOrchestrator.configuration
end

Instance Method Details

#chat(messages) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rails_orchestrator/client.rb', line 13

def chat(messages)
  messages = messages.to_a if messages.is_a?(Conversation)
  messages = normalize_messages(messages)

  body = { model: @config.model, messages: messages, stream: false }
  Response.new(post("/api/chat", body))
end