Compare commits

...
1 Commits
Author SHA1 Message Date
Shivam Mishra 1f932391ac feat: kickstart groq 2025-02-04 13:40:10 +05:30
3 changed files with 8 additions and 1 deletions
+5
View File
@@ -138,6 +138,11 @@
display_title: 'OpenAI API Key'
description: 'The API key used to authenticate requests to OpenAI services for Captain AI.'
locked: false
- name: CAPTAIN_OPEN_AI_BASE_URL
display_title: 'API Base URL'
description: 'The base URL for the OpenAI API. Default: https://api.openai.com, this is useful when using other OpenAI compliant endpoints like Azure, Ollama or Groq.'
value: 'https://api.openai.com'
locked: false
- name: CAPTAIN_OPEN_AI_MODEL
display_title: 'OpenAI Model'
description: 'The OpenAI model configured for use in Captain AI. Default: gpt-4o-mini'
@@ -10,7 +10,7 @@ module Enterprise::SuperAdmin::AppConfigsController
when 'internal'
@allowed_configs = internal_config_options
when 'captain'
@allowed_configs = %w[CAPTAIN_OPEN_AI_API_KEY CAPTAIN_OPEN_AI_MODEL CAPTAIN_FIRECRAWL_API_KEY]
@allowed_configs = %w[CAPTAIN_OPEN_AI_API_KEY CAPTAIN_OPEN_AI_MODEL CAPTAIN_OPEN_AI_BASE_URL CAPTAIN_FIRECRAWL_API_KEY]
else
super
end
@@ -1,8 +1,10 @@
class Captain::Llm::BaseOpenAiService
DEFAULT_MODEL = 'gpt-4o-mini'.freeze
DEFAULT_BASE_URL = 'https://api.openai.com'.freeze
def initialize
@client = OpenAI::Client.new(
uri_base: InstallationConfig.find_by!(name: 'CAPTAIN_OPEN_AI_BASE_URL').value || OpenAI::Client::DEFAULT_BASE_URL,
access_token: InstallationConfig.find_by!(name: 'CAPTAIN_OPEN_AI_API_KEY').value,
log_errors: Rails.env.development?
)