Skip to content

Entaigner/haystack-mistralai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

haystack-mistralai

A copy of components/generators/openai.py and components/generators/chat/openai.py adjusted to use the MistralAI API.


Table of Contents

Installation

git clone https://github.com/Entaigner/haystack-mistralai.git
cd haystack-mistralai
python -m pip install -e .

Example

from haystack.dataclasses import ChatMessage
from haystack_mistralai import MistralAIGenerator
from haystack_mistralai import MistralAIChatGenerator

generator = MistralAIGenerator(model_name="mistral-small")
prompt = "Tell me a joke about trees."
response = generator.run(prompt=prompt)
print(response["replies"][0])
print(response["metadata"][0])

# OR

generator = MistralAIChatGenerator(model_name="mistral-small")
prompt = "Tell me a joke about trees."
messages = [
    ChatMessage.from_user(prompt)
]
response = generator.run(messages=messages)
print(response["replies"][0])
print(response["metadata"][0])

License

haystack-mistralai is distributed under the terms of the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages