-
Notifications
You must be signed in to change notification settings - Fork 310
Add MistralAI LLM client #622
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
Conversation
Ololoshechkin
left a comment
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.
Thank you so much for your contribution! Appreciate that a lot!
Please consider adding KDocs for public API, and supporting media types.
Adding all models is rather optional (we can auto-generate it later) but nice to have :)
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Show resolved
Hide resolved
prompt/prompt-executor/prompt-executor-clients/prompt-executor-mistralai-client/Module.md
Outdated
Show resolved
Hide resolved
...ai-client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAIModels.kt
Outdated
Show resolved
Hide resolved
...commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/mapper/MistralAIMessageMapper.kt
Outdated
Show resolved
Hide resolved
devcrocod
left a comment
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.
Thank you for your contribution!
I have reviewed the client class and left a few comments. please take a look at them
From what I can tell, Mistral is generally similar to an OpenAI-like client. To address this, you might consider:
- Inheriting from AbstractOpenAILLMClient. This way, you would not need to reimplement the core logic and types
- Waiting for this PR #645 to be merged, and then adding only the Mistral request.
Compared to OpenAI, Mistral is missing many fields and instead introduces a different field,prompt_mode
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Outdated
Show resolved
Hide resolved
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Outdated
Show resolved
Hide resolved
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Outdated
Show resolved
Hide resolved
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Outdated
Show resolved
Hide resolved
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/MistralAILLMClient.kt
Show resolved
Hide resolved
antoniibelyshev
left a comment
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.
Thank you for your contribution!
Could you please also implement the executeMultipleChoices method to support the multiple choices functionality supported by the parameter n?
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.
Pull Request Overview
This PR adds comprehensive MistralAI LLM client integration to the Koog framework, enabling support for MistralAI's chat, embedding, and moderation models with full parameter control and multimodal capabilities.
- Adds new MistralAI client implementation with support for chat completions, embeddings, and content moderation
- Integrates MistralAI provider across all framework modules including Spring Boot starter and Ktor integration
- Includes comprehensive test coverage for serialization, parameters, models, and client functionality
Reviewed Changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Adds MistralAI client module to build configuration |
| prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/dsl/ModerationAPI.kt | Adds hashCode method to ModerationCategory |
| prompt/prompt-llm/src/commonMain/kotlin/ai/koog/prompt/llm/LLMProvider.kt | Adds MistralAI provider definition |
| prompt-executor-mistralai-client/ | Core MistralAI client implementation with models, parameters, and API integration |
| prompt-executor-llms-all/ | Adds simple MistralAI executor factory method |
| Spring Boot starter modules | Adds auto-configuration and properties for MistralAI integration |
| Ktor modules | Adds configuration loading and model parsing for MistralAI |
| Examples | Adds MistralAI usage examples and tool integration |
Comments suppressed due to low confidence (2)
prompt/prompt-executor/prompt-executor-clients/prompt-executor-mistralai-client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/mistralai/models/MistralAIChatCompletion.kt:1
- The moderationPath property is declared as val instead of var, making it immutable and always null. This prevents customization of the moderation API path.
package ai.koog.prompt.executor.clients.mistralai.models
koog-ktor/src/commonMain/kotlin/ai/koog/ktor/KoogAgentsConfig.kt:1
- Comment incorrectly refers to 'Google configuration' in the MistralAI configuration section.
package ai.koog.ktor
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
prompt/prompt-llm/src/commonMain/kotlin/ai/koog/prompt/llm/LLMProvider.kt
Outdated
Show resolved
Hide resolved
...tor-llms-all/src/commonMain/kotlin/ai/koog/prompt/executor/llms/all/SimplePromptExecutors.kt
Outdated
Show resolved
Hide resolved
devcrocod
left a comment
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.
So the PR doesn’t get blocked
Co-authored-by: Copilot <[email protected]>
…te MistralAI model usage, and reduce max iterations.
…tExecutor bean count to 6
… in MistralAI client
…d update related configurations
antoniibelyshev
left a comment
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.
Thank you, looks good
|
@Ololoshechkin please take a look at this PR |
MistralAI provides a list of models for working with completions, agents. Also the company has a high-speed inference. Another aspect -- GDPR, models are deployed in Europe and it allows working with projects where GDPR is crucial. Original issue -- #530 Co-authored-by: Andrey Bragin <[email protected]> Co-authored-by: devcrocod <[email protected]> Co-authored-by: Copilot <[email protected]>
MistralAI provides a list of models for working with completions, agents. Also the company has a high-speed inference. Another aspect -- GDPR, models are deployed in Europe and it allows working with projects where GDPR is crucial. Original issue -- #530 Co-authored-by: Andrey Bragin <[email protected]> Co-authored-by: devcrocod <[email protected]> Co-authored-by: Copilot <[email protected]>
MistralAI provides a list of models for working with completions, agents. Also the company has a high-speed inference. Another aspect -- GDPR, models are deployed in Europe and it allows working with projects where GDPR is crucial. Original issue -- #530 Co-authored-by: Andrey Bragin <[email protected]> Co-authored-by: devcrocod <[email protected]> Co-authored-by: Copilot <[email protected]>
Motivation and Context
MistralAI provides a list of models for working with completions, agents. Also the company has a high-speed inference.
Another aspect -- GDPR, models are deployed in Europe and it allows working with projects where GDPR is crucial.
Original issue -- #530
Breaking Changes
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature