-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add Mistral Integration page #121
Comments
This works: from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
api_key = "MISTRAL-API-KEY"
model = "mistral-medium"
client = OpenAIChatGenerator(
api_key=api_key, model_name=model, api_base_url="https://api.mistral.ai/v1"
)
response = client.run(
messages=[ChatMessage.from_user("What is the best French cheese?")]
)
print(response) |
Embedders from haystack.components.embedders import OpenAITextEmbedder
api_key = "MISTRAL-API-KEY"
model = "mistral-embed"
embedder = OpenAITextEmbedder(api_key=api_key, model_name=model, api_base_url="https://api.mistral.ai/v1")
response = embedder.run(text="What is the best French cheese?")
print(response)
# {'embedding': [-0.0186004638671875, ...],
# 'meta': {'model': 'mistral-embed',
#'usage': {'prompt_tokens': 9, 'total_tokens': 9, 'completion_tokens': 0}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, Mistral AI is supported via the
OpenAIGenerator
simply by providing the right model and API key. Let's add an integration page for Mistral which is slightly different to the rest:OpenAIGenerator
to make use of MistralWe can explore adding full functionality as a separate integration next, and change the content of the integration tile accordingly.
Tasks
The text was updated successfully, but these errors were encountered: