File size: 523 Bytes
a63e449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from mistralai.client import Mistral
import os
from dotenv import load_dotenv
load_dotenv()

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.chat.complete(model="mistral-large-latest", messages=[
        {
            "role": "user",
            "content": "Who is the best French painter? Answer in one short sentence.\nWhat is the most powerful AI today",
        },
    ], stream=False, response_format={
        "type": "text",
    })

    # Handle response
    print(res)