Class: Async::Ollama::Client

Inherits:
REST::Resource
  • Object
show all
Defined in:
lib/async/ollama/client.rb

Overview

Represents a connection to the Ollama service.

Constant Summary collapse

ENDPOINT =

The default endpoint to connect to.

Async::HTTP::Endpoint.parse("http://localhost:11434")

Instance Method Summary collapse

Instance Method Details

#generate(prompt, **options, &block) ⇒ Object

Generate a response from the given prompt.



18
19
20
21
22
23
# File 'lib/async/ollama/client.rb', line 18

def generate(prompt, **options, &block)
	options[:prompt] = prompt
	options[:model] ||= "llama3"
	
	Generate.post(self.with(path: "/api/generate"), options, &block)
end