Class: Ollama::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama/providers/base.rb

Overview

Base class for API providers (Ollama, OpenAI, etc.)

Direct Known Subclasses

LlamaCpp, Ollama, OpenAI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, transport) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/ollama/providers/base.rb', line 9

def initialize(config, transport)
  @config = config
  @transport = transport
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/ollama/providers/base.rb', line 7

def config
  @config
end

#transportObject (readonly)

Returns the value of attribute transport.



7
8
9
# File 'lib/ollama/providers/base.rb', line 7

def transport
  @transport
end

Instance Method Details

#chat_endpointObject

This method is abstract.

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/ollama/providers/base.rb', line 15

def chat_endpoint
  raise NotImplementedError
end

#embeddings_endpointObject

This method is abstract.

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/ollama/providers/base.rb', line 25

def embeddings_endpoint
  raise NotImplementedError
end

#format_chat_request(params) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/ollama/providers/base.rb', line 35

def format_chat_request(params)
  raise NotImplementedError
end

#format_embeddings_request(params) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/ollama/providers/base.rb', line 45

def format_embeddings_request(params)
  raise NotImplementedError
end

#format_generate_request(params) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/ollama/providers/base.rb', line 40

def format_generate_request(params)
  raise NotImplementedError
end

#generate_endpointObject

This method is abstract.

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/ollama/providers/base.rb', line 20

def generate_endpoint
  raise NotImplementedError
end

#models_endpointObject

This method is abstract.

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/ollama/providers/base.rb', line 30

def models_endpoint
  raise NotImplementedError
end

#normalize_chat_response(response_data) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/ollama/providers/base.rb', line 50

def normalize_chat_response(response_data)
  raise NotImplementedError
end

#normalize_embeddings_response(response_data) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/ollama/providers/base.rb', line 60

def normalize_embeddings_response(response_data)
  raise NotImplementedError
end

#normalize_generate_response(response_data) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


55
56
57
# File 'lib/ollama/providers/base.rb', line 55

def normalize_generate_response(response_data)
  raise NotImplementedError
end

#normalize_models_response(response_data) ⇒ Object

This method is abstract.

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/ollama/providers/base.rb', line 65

def normalize_models_response(response_data)
  raise NotImplementedError
end