Class: Ace::LLM::Organisms::LMStudioClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- Ace::LLM::Organisms::LMStudioClient
- Defined in:
- lib/ace/llm/organisms/lmstudio_client.rb
Overview
LMStudioClient handles interactions with local LM Studio server LM Studio provides an OpenAI-compatible API for local models
Constant Summary collapse
- API_BASE_URL =
"http://localhost:1234"- DEFAULT_MODEL =
"local-model"- DEFAULT_GENERATION_CONFIG =
{ temperature: 0.7, max_tokens: nil, top_p: nil, top_k: nil }.freeze
Constants inherited from BaseClient
BaseClient::DEFAULT_SYSTEM_PROMPT_SEPARATOR
Instance Attribute Summary
Attributes inherited from BaseClient
#api_key, #base_url, #generation_config, #http_client, #model
Class Method Summary collapse
-
.provider_name ⇒ String
Get the provider name.
Instance Method Summary collapse
-
#generate(messages, **options) ⇒ Hash
Generate a response from LM Studio.
-
#needs_credentials? ⇒ Boolean
Check if this client needs API credentials.
Methods inherited from BaseClient
Constructor Details
This class inherits a constructor from Ace::LLM::Organisms::BaseClient
Class Method Details
.provider_name ⇒ String
Get the provider name
22 23 24 |
# File 'lib/ace/llm/organisms/lmstudio_client.rb', line 22 def self.provider_name "lmstudio" end |
Instance Method Details
#generate(messages, **options) ⇒ Hash
Generate a response from LM Studio
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ace/llm/organisms/lmstudio_client.rb', line 36 def generate(, **) = () generation_params = () request_body = build_request_body(, generation_params) response = make_api_request(request_body) parse_response(response) rescue => e handle_api_error(e) end |
#needs_credentials? ⇒ Boolean
Check if this client needs API credentials
28 29 30 |
# File 'lib/ace/llm/organisms/lmstudio_client.rb', line 28 def needs_credentials? false end |