Repository navigation
docs: add Mistral AI model provider page for kagent 1.x (#517) #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
boxcee-interview
wants to merge
2
commits into
kagent-dev:main
Choose a base branch
from
boxcee-interview:fix/issue-517
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
docs-site/content/kagent/1.x/setup/model-providers/mistral.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||
| --- | ||||
| title: Mistral | ||||
| description: Configure kagent to use Mistral models by creating a ModelConfig for the Mistral provider. | ||||
| weight: 20 | ||||
| author: kagent.dev | ||||
| --- | ||||
|
|
||||
| The `Mistral` provider calls the Mistral API directly. Mistral speaks the OpenAI-compatible wire protocol, but kagent exposes it as its own `provider: Mistral` value rather than routing it through the `OpenAI` provider. | ||||
|
|
||||
| > [!NOTE] | ||||
| > This provider works on the `kagent` and `byo` runtimes, but not on `codex` or `claude`. For more information, see [Agent harness]({{< link path="agents/agent-harness#model-provider-support" >}}). | ||||
|
|
||||
| ## Create the ModelConfig | ||||
|
|
||||
| 1. Save your [Mistral API key](https://console.mistral.ai/api-keys) as an environment variable. | ||||
| ```bash | ||||
| export MISTRAL_API_KEY=<your_api_key> | ||||
| ``` | ||||
|
|
||||
| 2. Create a Kubernetes Secret that stores the API key. Create it in the same namespace as the AgentTemplates that use it, such as `kagent`. | ||||
| ```bash | ||||
| kubectl create secret generic kagent-mistral -n kagent --from-literal MISTRAL_API_KEY=$MISTRAL_API_KEY | ||||
| ``` | ||||
|
|
||||
| 3. Create a `ModelConfig` that references the Secret. Every field in the `mistral` block is optional, and an empty block is valid. | ||||
| ```yaml | ||||
| kubectl apply -f - <<EOF | ||||
| apiVersion: api.kagent.dev/v1alpha3 | ||||
| kind: ModelConfig | ||||
| metadata: | ||||
| name: mistral-model-config | ||||
| namespace: kagent | ||||
| spec: | ||||
| apiKeySecret: kagent-mistral | ||||
| apiKeySecretKey: MISTRAL_API_KEY | ||||
| model: mistral-large-latest | ||||
| provider: Mistral | ||||
| mistral: {} | ||||
| EOF | ||||
| ``` | ||||
|
|
||||
| | Field | Description | | ||||
| | ----- | ----------- | | ||||
| | `apiKeySecret` | The name of the Kubernetes Secret that stores the API key, in the same namespace as this ModelConfig. | | ||||
| | `apiKeySecretKey` | The key within that Secret that holds the API key. | | ||||
| | `model` | The model to use. For the available models, see the [Mistral model docs](https://docs.mistral.ai/models). | | ||||
| | `provider` | The provider to use, `Mistral`. | | ||||
| | `mistral` | Settings that only the Mistral provider takes. An empty block is valid. A CEL rule rejects a `mistral` block on any other provider. | | ||||
|
|
||||
| ## Mistral provider settings | ||||
|
|
||||
| The `mistral` block takes the following optional settings. For every field, including its type, default, and validation rules, see the [API reference]({{< link path="reference/api-ref#mistralconfig" >}}). | ||||
|
|
||||
| | Field | Description | | ||||
| | ----- | ----------- | | ||||
| | `baseUrl` | An alternative Mistral API endpoint. Defaults to `https://api.mistral.ai/v1`. | | ||||
| | `temperature` | How much randomness the model applies when it picks the next token, written as a string. | | ||||
| | `topP` | The nucleus sampling cutoff, written as a string. | | ||||
| | `maxTokens` | A cap on the tokens generated in one response. Minimum 1. | | ||||
| | `timeout` | How long to wait on a request to the provider, in seconds. Minimum 1. | | ||||
|
|
||||
| Mistral embeddings (`mistral-embed`) are out of scope for this page. | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is scoping guidance from the issue, not reader content. Remove it.
Suggested change
|
||||
|
|
||||
| ## Use the ModelConfig | ||||
|
|
||||
| Reference the ModelConfig by name from an AgentTemplate in the same namespace. | ||||
|
|
||||
| ```yaml | ||||
| spec: | ||||
| modelConfig: | ||||
| name: mistral-model-config | ||||
| ``` | ||||
|
|
||||
| ## Next steps | ||||
|
|
||||
| {{< cards >}} | ||||
| {{< card link=`{{< link path="get-started/your-first-agent" >}}` title="Your first agent" subtitle="Create an agent that uses this model, and hold a conversation with it." >}} | ||||
| {{< card link=`{{< link path="setup/model-providers/byo-openai" >}}` title="BYO OpenAI-compatible endpoint" subtitle="Point the OpenAI provider at a different service." >}} | ||||
| {{< /cards >}} | ||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue #517 asks for a run against a real Mistral key and an on-cluster check of the
kagent/byo-only restriction. Did you run either, and on which kagent version?