File size: 2,673 Bytes
927bd19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "It is subjective to determine the \"best\" French cheese as it depends on personal preferences. Here are a few famous French cheeses that are highly regarded and beloved by many:\n",
      "\n",
      "1. Roquefort: A blue-veined cheese originating from the Massif Central region in France. It is made from sheep's milk and has a strong, pungent taste and a distinctive vegetal aftertaste.\n",
      "\n",
      "2. Camembert: A soft, creamy, and tangy cheese from Normandy. It is made from cow's milk and is known for its distinctive white mold rind.\n",
      "\n",
      "3. Comté: A firm, nutty, and slightly sweet cheese from the Franche-Comté region in eastern France. It is made from unpasteurized cow's milk and is often referred to as the \"King of French Cheeses.\"\n",
      "\n",
      "4. Brie de Meaux: A soft, creamy, and buttery cheese from the Île-de-France region. It is made from cow's milk and is known for its edible white rind and mild, velvety flavor.\n",
      "\n",
      "5. Munster: A smelly, soft, and runny cheese from the Alsace region, near the German border. It is made from cow's milk and has a pungent, sulfurous aroma and a strong, tangy flavor.\n",
      "\n",
      "Ultimately, the best French cheese for you will depend on your personal taste preferences and dietary restrictions. It's always a good idea to try a variety of French cheeses to find your favorite.\n"
     ]
    }
   ],
   "source": [
    "from mistralai.client import MistralClient\n",
    "from mistralai.models.chat_completion import ChatMessage\n",
    "\n",
    "api_key = \"Yb2kAF0DR4Mva5AEmoYFV3kYRAKdXB7i\"\n",
    "model = \"mistral-tiny\"\n",
    "\n",
    "client = MistralClient(api_key=api_key)\n",
    "\n",
    "messages = [\n",
    "    ChatMessage(role=\"user\", content=\"What is the best French cheese?\")\n",
    "]\n",
    "\n",
    "# No streaming\n",
    "chat_response = client.chat(\n",
    "    model=model,\n",
    "    messages=messages,\n",
    ")\n",
    "\n",
    "print(chat_response.choices[0].message.content)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}