Sha256: e4dd5b6f910d05303f0776953ed0ba578a1a1f15cd9e2f09c3b9313d9f3fcbd5

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

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

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

        json[:stream] = block_given?

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

Version data entries

1 entries across 1 versions & 1 rubygems

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