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)