Class: Everyai

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

Class Method Summary collapse

Class Method Details

.generate(prompt, model: "llama3.1") ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/everyai.rb', line 5

def generate(prompt, model: "llama3.1")
  client = Ollama.new(
    credentials: { address: 'http://localhost:11434' },
    opiions: { server_sent_events: true }
  )

  result = client.generate(
    { model: model,
      prompt: prompt }
  )
  result.map { |r| r['response']}.join
end