Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ class Config:
DOCSTAR_ORG_ID = os.getenv('DOCSTAR_ORG_ID')
DOCSTAR_COLLECTION_ID = os.getenv('DOCSTAR_COLLECTION_ID')
AI_ML_APIKEY = os.getenv('AI_ML_APIKEY')
AI_MIDDLEWARE_PAUTH_KEY = os.getenv('AI_MIDDLEWARE_PAUTH_KEY')
AI_MIDDLEWARE_PAUTH_KEY = os.getenv('AI_MIDDLEWARE_PAUTH_KEY')
OPENAI_API_KEY_GPT_5_NANO = os.getenv('OPENAI_API_KEY_GPT_5_NANO')
2 changes: 1 addition & 1 deletion src/configs/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}

new_agent_service = {
"openai": "gpt-4o",
"openai": "gpt-5-nano",
"anthropic": "claude-3-7-sonnet-latest",
"groq": "llama-3.3-70b-versatile",
"open_router": "deepseek/deepseek-chat-v3-0324:free",
Expand Down
12 changes: 9 additions & 3 deletions src/services/utils/getConfiguration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,17 @@ def setup_api_key(service, result, apikey, chatbot):
if folder_api_key:
db_api_key = folder_api_key

# Validate API key existence
if chatbot and (service == 'openai'):
if not apikey and result.get('bridges', {}).get('configuration', {}).get('model') == 'gpt-5-nano':
apikey = Config.OPENAI_API_KEY
model = result.get('bridges', {}).get('configuration', {}).get('model')
# If both keys are not present
if not (apikey or db_api_key):
# Use Config.OPENAI_API_KEY only if model is gpt-5-nano
if model == 'gpt-5-nano':
apikey = Config.OPENAI_API_KEY_GPT_5_NANO
else:
raise Exception('Could not find api key or Agent is not Published')

# Validate API key existence
if not (apikey or db_api_key):
raise Exception('Could not find api key or Agent is not Published')

Expand Down