Sha256: 5f2613dcaee3febe74d378b4bc97693cc315c32035808dc1dc5998ceaabf059c

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

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

      def list
        @client.get "/api/tags"
      end

      def create(name:, modelfile: nil, path: nil, &block)
        @client.post "/api/create", json: { name: name, modelfile: modelfile, path: path, stream: block_given? }.compact, &block
      end

      def show(name)
        @client.post "/api/show", json: { name: name }
      end

      def copy(source:, destination: nil)
        @client.post "/api/copy", json: { source: source, destination: destination || "#{source}-backup" }
      end

      def delete(name)
        @client.delete "/api/delete", json: { name: name }
      end

      def pull(name:, insecure: nil, &block)
        @client.post "/api/pull", json: { name: name, insecure: insecure, stream: block_given? }.compact, &block
      end

      def push(name:, insecure: nil, &block)
        @client.post "/api/push", json: { name: name, insecure: insecure, stream: block_given? }.compact, &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/models.rb