Sha256: 20b8ad8798ad043f11667f53353e98dd3c597ad8adac8124f29016c2c3b1321d

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module Ollama
  module API
    class Completion
      def initialize(client:)
        @client = client
      end

      def create(model:, prompt:, images: [], **options, &block)
        json = {
          model: model,
          prompt: prompt,
          images: images
        }.merge(options).compact.transform_keys(&:to_sym)

        json[:stream] = block_given?

        @client.post "/api/generate", json: json, &block
      end

      alias generate create
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ollama-rb-0.1.0 lib/ollama/api/completion.rb