Class: AIA::AiClientBackend

Inherits:
Tools
  • Object
show all
Includes:
BackendCommon
Defined in:
lib/aia/tools/ai_client_backend.rb

Constant Summary collapse

DEFAULT_PARAMETERS =
''
DIRECTIVES =
%w[
  model
  temperature
  max_tokens
  top_p
  frequency_penalty
  presence_penalty
]

Instance Attribute Summary collapse

Attributes included from BackendCommon

#command, #files, #parameters, #text

Instance Method Summary collapse

Methods included from BackendCommon

#sanitize, #set_parameter_from_directives

Methods inherited from Tools

catalog, get_meta, inherited, load_tools, #meta, meta, search_for, setup_backend, validate_tools

Constructor Details

#initialize(text: "", files: []) ⇒ AiClientBackend

Returns a new instance of AiClientBackend.



32
33
34
35
# File 'lib/aia/tools/ai_client_backend.rb', line 32

def initialize(text: "", files: [])
  super
  @client = AiClient.new
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



20
21
22
# File 'lib/aia/tools/ai_client_backend.rb', line 20

def client
  @client
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



20
21
22
# File 'lib/aia/tools/ai_client_backend.rb', line 20

def raw_response
  @raw_response
end

Instance Method Details

#build_commandObject



37
38
39
40
# File 'lib/aia/tools/ai_client_backend.rb', line 37

def build_command
  # No-op - ai_client doesn't use command line
  @parameters = ""
end

#runObject



42
43
44
45
46
# File 'lib/aia/tools/ai_client_backend.rb', line 42

def run
  handle_model(AIA.config.model)
rescue => e
  puts "Error handling model #{AIA.config.model}: #{e.message}"
end