Spaces:
Paused
Paused
add requirements
Browse files- Notebook_Ferro.ipynb +66 -0
- mistral.ipynb +0 -73
- requirements.txt +2 -0
Notebook_Ferro.ipynb
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 4,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [
|
8 |
+
{
|
9 |
+
"ename": "KeyError",
|
10 |
+
"evalue": "'API_KEY'",
|
11 |
+
"output_type": "error",
|
12 |
+
"traceback": [
|
13 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
14 |
+
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
|
15 |
+
"Cell \u001b[0;32mIn[4], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmistralai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodels\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mchat_completion\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ChatMessage\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m api_key \u001b[38;5;241m=\u001b[39m \u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menviron\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mAPI_KEY\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# model = \"mistral-tiny\"\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \n\u001b[1;32m 8\u001b[0m \u001b[38;5;66;03m# client = MistralClient(api_key=api_key)\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 19\u001b[0m \n\u001b[1;32m 20\u001b[0m \u001b[38;5;66;03m# print(chat_response.choices[0].message.content)\u001b[39;00m\n",
|
16 |
+
"File \u001b[0;32m<frozen os>:679\u001b[0m, in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n",
|
17 |
+
"\u001b[0;31mKeyError\u001b[0m: 'API_KEY'"
|
18 |
+
]
|
19 |
+
}
|
20 |
+
],
|
21 |
+
"source": [
|
22 |
+
"from mistralai.client import MistralClient\n",
|
23 |
+
"from mistralai.models.chat_completion import ChatMessage\n",
|
24 |
+
"import os\n",
|
25 |
+
"\n",
|
26 |
+
"api_key = os.environ['API_KEY']\n",
|
27 |
+
"# model = \"mistral-tiny\"\n",
|
28 |
+
"\n",
|
29 |
+
"# client = MistralClient(api_key=api_key)\n",
|
30 |
+
"\n",
|
31 |
+
"# messages = [\n",
|
32 |
+
"# ChatMessage(role=\"user\", content=\"What is the best French cheese?\")\n",
|
33 |
+
"# ]\n",
|
34 |
+
"\n",
|
35 |
+
"# # No streaming\n",
|
36 |
+
"# chat_response = client.chat(\n",
|
37 |
+
"# model=model,\n",
|
38 |
+
"# messages=messages,\n",
|
39 |
+
"# )\n",
|
40 |
+
"\n",
|
41 |
+
"# print(chat_response.choices[0].message.content)"
|
42 |
+
]
|
43 |
+
}
|
44 |
+
],
|
45 |
+
"metadata": {
|
46 |
+
"kernelspec": {
|
47 |
+
"display_name": "Python 3",
|
48 |
+
"language": "python",
|
49 |
+
"name": "python3"
|
50 |
+
},
|
51 |
+
"language_info": {
|
52 |
+
"codemirror_mode": {
|
53 |
+
"name": "ipython",
|
54 |
+
"version": 3
|
55 |
+
},
|
56 |
+
"file_extension": ".py",
|
57 |
+
"mimetype": "text/x-python",
|
58 |
+
"name": "python",
|
59 |
+
"nbconvert_exporter": "python",
|
60 |
+
"pygments_lexer": "ipython3",
|
61 |
+
"version": "3.11.5"
|
62 |
+
}
|
63 |
+
},
|
64 |
+
"nbformat": 4,
|
65 |
+
"nbformat_minor": 2
|
66 |
+
}
|
mistral.ipynb
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"metadata": {},
|
7 |
-
"outputs": [
|
8 |
-
{
|
9 |
-
"name": "stdout",
|
10 |
-
"output_type": "stream",
|
11 |
-
"text": [
|
12 |
-
"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",
|
13 |
-
"\n",
|
14 |
-
"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",
|
15 |
-
"\n",
|
16 |
-
"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",
|
17 |
-
"\n",
|
18 |
-
"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",
|
19 |
-
"\n",
|
20 |
-
"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",
|
21 |
-
"\n",
|
22 |
-
"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",
|
23 |
-
"\n",
|
24 |
-
"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"
|
25 |
-
]
|
26 |
-
}
|
27 |
-
],
|
28 |
-
"source": [
|
29 |
-
"from mistralai.client import MistralClient\n",
|
30 |
-
"from mistralai.models.chat_completion import ChatMessage\n",
|
31 |
-
"import os\n",
|
32 |
-
"\n",
|
33 |
-
"api_key = os.environ['API_KEY']\n",
|
34 |
-
"model = \"mistral-tiny\"\n",
|
35 |
-
"\n",
|
36 |
-
"client = MistralClient(api_key=api_key)\n",
|
37 |
-
"\n",
|
38 |
-
"messages = [\n",
|
39 |
-
" ChatMessage(role=\"user\", content=\"What is the best French cheese?\")\n",
|
40 |
-
"]\n",
|
41 |
-
"\n",
|
42 |
-
"# No streaming\n",
|
43 |
-
"chat_response = client.chat(\n",
|
44 |
-
" model=model,\n",
|
45 |
-
" messages=messages,\n",
|
46 |
-
")\n",
|
47 |
-
"\n",
|
48 |
-
"print(chat_response.choices[0].message.content)"
|
49 |
-
]
|
50 |
-
}
|
51 |
-
],
|
52 |
-
"metadata": {
|
53 |
-
"kernelspec": {
|
54 |
-
"display_name": "Python 3",
|
55 |
-
"language": "python",
|
56 |
-
"name": "python3"
|
57 |
-
},
|
58 |
-
"language_info": {
|
59 |
-
"codemirror_mode": {
|
60 |
-
"name": "ipython",
|
61 |
-
"version": 3
|
62 |
-
},
|
63 |
-
"file_extension": ".py",
|
64 |
-
"mimetype": "text/x-python",
|
65 |
-
"name": "python",
|
66 |
-
"nbconvert_exporter": "python",
|
67 |
-
"pygments_lexer": "ipython3",
|
68 |
-
"version": "3.11.5"
|
69 |
-
}
|
70 |
-
},
|
71 |
-
"nbformat": 4,
|
72 |
-
"nbformat_minor": 2
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
python-dotenv
|
2 |
+
mistralai
|