Skip to content
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

Feature/add mistral generator #1135

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

dimensi0n
Copy link

Mistral is an advanced language model that offers powerful and precise text generation capabilities. It has been specifically designed to follow precise instructions, reason, handle multi-turn conversations, and generate code. By integrating Mistral into Garak, we enable users to test this state-of-the-art model against various attacks and vulnerabilities, ensuring safer and more reliable use in real-world applications.

Verification

$ export MISTRAL_API_KEY=abcdefg123456789
$ python3 -m garak --model_type mistral --model_name mistral-small-latest --probes test.Blank

The default model name is [mistral-large-latest] (https://mistral.ai/fr/news/mistral-large-2407)

Copy link
Contributor

github-actions bot commented Mar 22, 2025

DCO Assistant Lite bot All contributors have signed the DCO ✍️ ✅

@dimensi0n
Copy link
Author

I have read the DCO Document and I hereby sign the DCO

@dimensi0n
Copy link
Author

recheck

github-actions bot added a commit that referenced this pull request Mar 22, 2025
Copy link
Collaborator

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good first pass, API keys and default values are part for the Configurable plugin implementation. I have offered a refactor that would move this validation and default to enable our yaml and json based configuration to work with this generator.

It would be helpful to have a few example generation responses as mocks for pytests added to validate this new generator code.

@dimensi0n
Copy link
Author

How to add the mistral api key for the pytests in github actions ?

@jmartin-tech
Copy link
Collaborator

How to add the mistral api key for the pytests in github actions ?

Tests can exist that require a key for usage in integration testing however, these test are not run in CI.

Github actions will not use a live API key, tests should exists that mock the http response and intercept the API call.

@dimensi0n
Copy link
Author

Here we go, we have a mock prompt test, pytests should be fine now.

@dimensi0n
Copy link
Author

dimensi0n commented Mar 25, 2025

Thanks for the example, it was a hard path to find how to create the mock file but I found this on my way https://github.com/mistralai/client-python/blob/main/docs/models/chatcompletionresponse.md. Should be done with the last commit

@dimensi0n dimensi0n requested a review from jmartin-tech March 25, 2025 15:59
Copy link
Collaborator

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimensi0n this is great progress, I noted a question about why the code is pushing a value into the environment that is explicitly passed to the client object and have requested some more work in the backoff handling.

@dimensi0n dimensi0n requested a review from jmartin-tech March 26, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants