Class: Aoororachain::Llms::LlamaServer

Inherits:
Object
  • Object
show all
Defined in:
lib/aoororachain/llms/llama_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ LlamaServer

Returns a new instance of LlamaServer.



8
9
10
11
12
# File 'lib/aoororachain/llms/llama_server.rb', line 8

def initialize(host)
  LlmClient.host = host
  LlmClient.logger = Aoororachain.logger
  LlmClient.log_level = Aoororachain.log_level
end

Instance Method Details

#complete(prompt:) ⇒ Object



14
15
16
17
18
# File 'lib/aoororachain/llms/llama_server.rb', line 14

def complete(prompt:)
  result = LlmClient.completion(prompt)

  [result.success?, result.success? ? result.success.body : result.failure.body]
end