example mistral sdk

This commit is contained in:
Ishaan Jaff 2024-07-25 19:48:54 -07:00
parent bb6f72b315
commit 68e94f0976
2 changed files with 17 additions and 0 deletions

View file

@ -8,6 +8,10 @@ model_list:
litellm_params:
model: fireworks_ai/accounts/fireworks/models/llama-v3-70b-instruct
api_key: "os.environ/FIREWORKS"
- model_name: mistral-small-latest
litellm_params:
model: mistral/mistral-small-latest
api_key: "os.environ/MISTRAL_API_KEY"
- model_name: tts
litellm_params:
model: openai/tts-1

View file

@ -0,0 +1,13 @@
import os
from mistralai.client import MistralClient
from mistralai.models.chat_completion import ChatMessage
client = MistralClient(api_key="sk-1234", endpoint="http://0.0.0.0:4000")
chat_response = client.chat(
model="mistral-small-latest",
messages=[
{"role": "user", "content": "this is a test request, write a short poem"}
],
)
print(chat_response.choices[0].message.content)