fix: Add Mistral provider configuration and tests (#2200)

- Add Mistral provider to constants.py with API key config
- Add Mistral models to available models list
- Fix env file creation to only write when API keys are provided
- Add tests for Mistral provider setup with and without API key

Fixes #2200

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-02-22 16:36:25 +00:00
parent 409892d65f
commit dc765e6491
3 changed files with 83 additions and 1 deletions

View File

@@ -162,7 +162,12 @@ def create_crew(name, provider=None, skip_provider=False, parent_folder=None):
if api_key_value.strip():
env_vars[key_name] = api_key_value
if env_vars:
# Only write env file if we have API keys
has_api_keys = any(
key in env_vars and env_vars[key].strip()
for key in ["MISTRAL_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY"]
)
if has_api_keys:
write_env_file(folder_path, env_vars)
click.secho("API keys and model saved to .env file", fg="green")
else: