Prioritize Mistral AI for AI agent requests and update default models
Reorders AI provider priority to favor Mistral, updates default models to Mistral variants, and adjusts client initialization logic in `ai_agent.py`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 923ae0e3-a363-4db8-b04a-e8baca2a1330 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 1d6be57f-2086-4267-b6c2-1439250ce53e Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8af7d2ec-2cc3-4ece-8af3-9f071488d072/923ae0e3-a363-4db8-b04a-e8baca2a1330/AOIftG8 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -18,23 +18,20 @@ _client: OpenAI | None = None
|
||||
def get_client() -> OpenAI:
|
||||
"""
|
||||
Supporte trois modes (par ordre de priorité) :
|
||||
1. Replit AI Integration : AI_INTEGRATIONS_OPENAI_BASE_URL + AI_INTEGRATIONS_OPENAI_API_KEY
|
||||
2. Mistral AI : MISTRAL_API_KEY (+ MISTRAL_BASE_URL optionnel)
|
||||
3. OpenAI standard : OPENAI_API_KEY (+ OPENAI_BASE_URL optionnel)
|
||||
1. Mistral AI : MISTRAL_API_KEY (+ MISTRAL_BASE_URL optionnel)
|
||||
2. OpenAI standard : OPENAI_API_KEY (+ OPENAI_BASE_URL optionnel)
|
||||
3. Replit AI Integration : AI_INTEGRATIONS_OPENAI_BASE_URL + AI_INTEGRATIONS_OPENAI_API_KEY
|
||||
"""
|
||||
global _client
|
||||
if _client is None:
|
||||
replit_base = os.environ.get("AI_INTEGRATIONS_OPENAI_BASE_URL")
|
||||
replit_key = os.environ.get("AI_INTEGRATIONS_OPENAI_API_KEY")
|
||||
mistral_key = os.environ.get("MISTRAL_API_KEY")
|
||||
mistral_base = os.environ.get("MISTRAL_BASE_URL", MISTRAL_BASE_URL)
|
||||
std_key = os.environ.get("OPENAI_API_KEY")
|
||||
std_base = os.environ.get("OPENAI_BASE_URL")
|
||||
replit_base = os.environ.get("AI_INTEGRATIONS_OPENAI_BASE_URL")
|
||||
replit_key = os.environ.get("AI_INTEGRATIONS_OPENAI_API_KEY")
|
||||
|
||||
if replit_base and replit_key:
|
||||
logger.info("Utilisation de l'intégration Replit AI")
|
||||
_client = OpenAI(base_url=replit_base, api_key=replit_key)
|
||||
elif mistral_key:
|
||||
if mistral_key:
|
||||
logger.info("Utilisation de l'API Mistral AI (%s)", mistral_base)
|
||||
_client = OpenAI(base_url=mistral_base, api_key=mistral_key)
|
||||
elif std_key:
|
||||
@@ -43,6 +40,9 @@ def get_client() -> OpenAI:
|
||||
if std_base:
|
||||
kwargs["base_url"] = std_base
|
||||
_client = OpenAI(**kwargs)
|
||||
elif replit_base and replit_key:
|
||||
logger.info("Utilisation de l'intégration Replit AI")
|
||||
_client = OpenAI(base_url=replit_base, api_key=replit_key)
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Aucune clé IA configurée. "
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Reference in New Issue
Block a user