Sha256: 4bd540996fbd6129ffc4dd2023c810973f003bbdb11bc862cf2497b7a5126d76
Contents?: true
Size: 892 Bytes
Versions: 3
Compression:
Stored size: 892 Bytes
Contents
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2024, by Samuel Williams. require "async/rest/representation" require_relative "wrapper" module Async module Ollama class Generate < Async::REST::Representation[Wrapper] # The response to the prompt. def response self.value[:response] end # The conversation context. Used to maintain state between prompts. def context self.value[:context] end # The model used to generate the response. def model self.value[:model] end # Generate a new response from the given prompt. # @parameter prompt [String] The prompt to generate a response from. # @yields {|response| ...} Optional streaming response. def generate(prompt, &block) self.class.post(self.resource, prompt: prompt, context: self.context, model: self.model, &block) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
async-ollama-0.4.0 | lib/async/ollama/generate.rb |
async-ollama-0.3.0 | lib/async/ollama/generate.rb |
async-ollama-0.2.0 | lib/async/ollama/generate.rb |