Files
cleveragents-core/features/mistral_provider.feature
T
HAL9000 9c71c8fa3b feat(providers): implement OllamaProvider and MistralProvider
- Implemented OllamaChatProvider to enable local Ollama model support.
- Implemented MistralChatProvider to integrate with the Mistral API.
- Added Behave BDD tests for both providers.
- Updated dependencies: langchain-mistralai and ollama.
- Updated provider exports to include the new providers.

ISSUES CLOSED: #5257
2026-06-18 00:36:05 -04:00

72 lines
4.3 KiB
Gherkin

Feature: Mistral chat provider coverage
As a maintainer integrating Mistral API support
I want unit-level Behave scenarios for the Mistral chat provider
So that the Mistral adapter stays documented and regression tested
@unit @providers @mistral
Scenario: Mistral provider instantiates ChatMistralAI with provided credentials
Given I have sample provider domain inputs
When I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
And I request plan generation from the Mistral provider
Then the Mistral provider should construct ChatMistralAI with api key "test-key-123" and model "mistral-large-latest"
And the Mistral provider metadata should report name "mistral" and model "mistral-large-latest"
@unit @providers @mistral
Scenario: Mistral provider stubbed response reports metadata
Given I have sample provider domain inputs
And I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
When I request plan generation from the Mistral provider
Then the Mistral provider response should contain no generated changes
And the Mistral provider response should report the requested model without errors
@unit @providers @mistral
Scenario: Mistral provider rejects missing API key
Given I have sample provider domain inputs
When I attempt to create a Mistral chat provider without an API key
Then the Mistral provider creation should fail with error containing "Mistral API key is required"
@unit @providers @mistral
Scenario: Mistral provider reads API key from environment variable
Given I have sample provider domain inputs
And I set the MISTRAL_API_KEY environment variable to "env-key-456"
When I create a Mistral chat provider without explicit API key and model "mistral-large-latest"
And I request plan generation from the Mistral provider
Then the Mistral provider should construct ChatMistralAI with api key "env-key-456" and model "mistral-large-latest"
@unit @providers @mistral
Scenario: Mistral provider forwards extra kwargs
Given I have sample provider domain inputs
And I set the Mistral provider extra kwargs "temperature=0.5,max_tokens=512"
When I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
And I request plan generation from the Mistral provider
Then the Mistral provider should construct ChatMistralAI with api key "test-key-123" and model "mistral-large-latest"
And the Mistral provider should include kwargs "temperature=0.5,max_tokens=512" in the ChatMistralAI call
@unit @providers @mistral
Scenario: Mistral provider reports runtime errors
Given I have sample provider domain inputs
And I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
And the plan generation graph raises RuntimeError "API rate limit exceeded"
When I request plan generation from the Mistral provider
Then the Mistral provider response should report error "API rate limit exceeded"
And the Mistral provider response should contain no generated changes
@unit @providers @mistral
Scenario: Mistral provider streaming yields workflow events
Given I have sample provider domain inputs
And the plan generation graph returns a generated change for "app/mistral.py"
And the plan generation graph emits streaming nodes "load_context,analyze_requirements,generate_plan,validate"
And I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
When I stream plan generation from the Mistral provider
Then the Mistral provider streaming events should include nodes "load_context,analyze_requirements,generate_plan,validate"
And the Mistral provider streaming result should finish with a response containing 1 generated change
@unit @providers @mistral
Scenario: Mistral provider surfaces plan generation errors
Given I have sample provider domain inputs
And the plan generation graph raises ValueError "invalid request"
And I create a Mistral chat provider with API key "test-key-123" and model "mistral-large-latest"
When I request plan generation from the Mistral provider
Then the Mistral provider response should report error "invalid request"
And the Mistral provider response should contain no generated changes