Skip to content

Commit d175ec0

Browse files
DYung26christianchimezie
authored andcommitted
fix(registry,notebooks): remove deprecated mixtral model from providers.json and update notebook interactive parameters
1 parent 73c2abf commit d175ec0

4 files changed

Lines changed: 497 additions & 104 deletions

File tree

notebooks/01-testing-explanations.ipynb

Lines changed: 104 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"name": "stdout",
3333
"output_type": "stream",
3434
"text": [
35-
"\u2705 Libraries imported successfully\n"
35+
" Libraries imported successfully\n"
3636
]
3737
}
3838
],
@@ -45,7 +45,7 @@
4545
"# Load environment variables from .env file\n",
4646
"load_dotenv()\n",
4747
"\n",
48-
"print(\"\u2705 Libraries imported successfully\")"
48+
"print(\" Libraries imported successfully\")"
4949
]
5050
},
5151
{
@@ -74,7 +74,7 @@
7474
"name": "stdout",
7575
"output_type": "stream",
7676
"text": [
77-
"\u2705 Test plot created\n"
77+
" Test plot created\n"
7878
]
7979
}
8080
],
@@ -91,7 +91,7 @@
9191
"plt.tight_layout()\n",
9292
"plt.show()\n",
9393
"\n",
94-
"print(\"\u2705 Test plot created\")"
94+
"print(\" Test plot created\")"
9595
]
9696
},
9797
{
@@ -146,19 +146,47 @@
146146
"name": "stdout",
147147
"output_type": "stream",
148148
"text": [
149-
"\u2705 GROQ_DEFAULT API key validated successfully.\n",
150-
"\u2705 GROQ_OPENAI API key validated successfully.\n",
151-
"\u2705 Explanation generated:\n",
152-
"\n",
153-
"Error: Groq query failed: Error code: 400 - {'error': {'message': 'The model `mixtral-8x7b-32768` has been decommissioned and is no longer supported. Please refer to https://console.groq.com/docs/deprecations for a recommendation on which model to use instead.', 'type': 'invalid_request_error', 'code': 'model_decommissioned'}}\n"
149+
"⚙️ OPENAI API key not found.\n",
150+
"🔗 Get it at 👉 https://platform.openai.com/api-keys 👈\n"
154151
]
155152
},
156153
{
157-
"name": "stderr",
154+
"name": "stdin",
158155
"output_type": "stream",
159156
"text": [
160-
"/home/dyung/Projects/PlotKit/plotsense/core/ai_interface.py:251: UserWarning: [AIModelInterface] Querying error for groq_default:mixtral-8x7b-32768 -> Groq query failed: Error code: 400 - {'error': {'message': 'The model `mixtral-8x7b-32768` has been decommissioned and is no longer supported. Please refer to https://console.groq.com/docs/deprecations for a recommendation on which model to use instead.', 'type': 'invalid_request_error', 'code': 'model_decommissioned'}}\n",
161-
" warnings.warn(f\"[AIModelInterface] Querying error for {provider}:{model} -> {str(e)}\")\n"
157+
"Enter OPENAI API key: ········\n"
158+
]
159+
},
160+
{
161+
"name": "stdout",
162+
"output_type": "stream",
163+
"text": [
164+
"✅ OPENAI_CHAT API key validated successfully.\n",
165+
"✅ OPENAI_RESPONSE API key validated successfully.\n",
166+
"✅ Explanation generated:\n",
167+
"\n",
168+
"# Data Visualization Analysis\n",
169+
"\n",
170+
"## 1. Overview\n",
171+
"The provided plot is a simple linear graph illustrating a perfect positive correlation between two variables, A and B, where an increase in A corresponds to a proportional increase in B.\n",
172+
"\n",
173+
"## 2. Key Features\n",
174+
"- **Title:** Simple Linear Plot\n",
175+
"- **Axes:**\n",
176+
" - **X Axis:** Ranges from 1 to 5, representing variable A.\n",
177+
" - **Y Axis:** Ranges from 2 to 10, representing variable B.\n",
178+
"- **Data Points:** The plot features five data points: (1, 2), (2, 4), (3, 6), (4, 8), and (5, 10), each marked with a blue circle.\n",
179+
"- **Linearity:** Data points are connected by a straight line, confirming a linear relationship.\n",
180+
"- **Legend:** The legend identifies the series as \"Data,\" representing the observed pairs of (A, B).\n",
181+
"\n",
182+
"## 3. Insights and Patterns\n",
183+
"- **Positive Correlation:** The linear trend demonstrates that as A increases from 1 to 5, B increases from 2 to 10, affirming a strong positive correlation.\n",
184+
"- **Slope Calculation:** The slope of the line is 2, indicating that for every unit increase in A, B increases by 2 units, showcasing a consistent relationship.\n",
185+
"- **Statistical Significance:** An R-squared value of 1.0 indicates a perfect fit, suggesting the model explains all the variability in B based on A.\n",
186+
"- **Data Distribution:** The evenly spaced points and absence of outliers further reinforce the linearity of the relationship, indicating a consistent rate of change.\n",
187+
"\n",
188+
"## 4. Conclusion\n",
189+
"This simple linear plot effectively illustrates a strong, quantifiable positive relationship between variables A and B, with significant implications for predictive modeling and decision-making. Understanding this correlation can inform further exploration into the underlying factors that may influence this relationship, while also considering the limitations of linear assumptions in broader contexts.\n"
162190
]
163191
}
164192
],
@@ -169,13 +197,13 @@
169197
" prompt=\"Explain this plot in one sentence.\",\n",
170198
" api_keys=api_keys,\n",
171199
" selected_models=[(\"openai\", \"gpt-4o-mini\")],\n",
172-
" interactive=len(api_keys) == 0,\n",
200+
" interactive=True, # len(api_keys) == 0,\n",
173201
" timeout=30\n",
174202
" )\n",
175-
" print(\"\u2705 Explanation generated:\")\n",
203+
" print(\" Explanation generated:\")\n",
176204
" print(f\"\\n{result}\")\n",
177205
"except ValueError as e:\n",
178-
" print(f\"\u274c Error: {e}\")"
206+
" print(f\" Error: {e}\")"
179207
]
180208
},
181209
{
@@ -200,10 +228,10 @@
200228
" interactive=len(api_keys) == 0,\n",
201229
" timeout=30\n",
202230
" )\n",
203-
" print(\"\u2705 OpenAI explanation generated:\")\n",
231+
" print(\" OpenAI explanation generated:\")\n",
204232
" print(f\"\\n{result}\")\n",
205233
"except ValueError as e:\n",
206-
" print(f\"\u274c Error: {e}\")"
234+
" print(f\" Error: {e}\")"
207235
]
208236
},
209237
{
@@ -215,23 +243,74 @@
215243
},
216244
{
217245
"cell_type": "code",
218-
"execution_count": null,
246+
"execution_count": 6,
219247
"metadata": {},
220-
"outputs": [],
248+
"outputs": [
249+
{
250+
"name": "stdout",
251+
"output_type": "stream",
252+
"text": [
253+
"✅ Groq explanation generated:\n",
254+
"\n",
255+
"# Refined Explanation of the Plot\n",
256+
"\n",
257+
"## Overview\n",
258+
"The plot depicts a perfect linear correlation between two variables, with the X-axis representing values from 1 to 5 and the Y-axis ranging from 2 to 10. The data points are connected by a straight line, indicating a direct and proportional relationship between the variables.\n",
259+
"\n",
260+
"## Key Features\n",
261+
"- **Axes**:\n",
262+
" - **X Axis**: Values range from 1 to 5.\n",
263+
" - **Y Axis**: Values range from 2 to 10.\n",
264+
" \n",
265+
"- **Data Points**: \n",
266+
" - Five distinct data points represented by blue circles at the coordinates: \n",
267+
" - (1, 2)\n",
268+
" - (2, 4)\n",
269+
" - (3, 6)\n",
270+
" - (4, 8)\n",
271+
" - (5, 10)\n",
272+
" - The even spacing of the points reinforces the consistency and reliability of the linear relationship.\n",
273+
"\n",
274+
"- **Trend Line**: \n",
275+
" - A straight line connecting the data points visually indicates a strong upward trend, reflecting the positive correlation.\n",
276+
"\n",
277+
"- **Legend**: \n",
278+
" - The legend labels the data series as \"Data,\" enhancing clarity.\n",
279+
"\n",
280+
"## Insights and Patterns\n",
281+
"- **Linear Relationship**: \n",
282+
" - The data exhibits a perfect positive correlation, quantified by a correlation coefficient of 1. This means that as X increases, Y increases predictably. \n",
283+
"\n",
284+
"- **Slope Calculation**: \n",
285+
" - The slope of the line is calculated as \\(\\Delta Y / \\Delta X = (10 - 2) / (5 - 1) = 8 / 4 = 2\\). This indicates that for each unit increase in X, Y increases by 2 units, demonstrating a consistent rate of change.\n",
286+
"\n",
287+
"- **Y-Intercept**: \n",
288+
" - The extrapolated Y-intercept is at (0, 0). This suggests that when X equals 0, Y would also theoretically equal 0, indicating that the model can be used for predictive purposes across various scenarios.\n",
289+
"\n",
290+
"- **Even Spacing Implications**: \n",
291+
" - The uniform distribution of data points reinforces the linear relationship, suggesting that the correlation is not only strong but also reliable across the observed range.\n",
292+
"\n",
293+
"## Conclusion\n",
294+
"The linear plot effectively visualizes the direct and proportional relationship between the two variables. The consistent increase in Y values corresponding to X underscores the utility of linear functions in predictive modeling. This model holds relevance in numerous fields, including economics, physics, and social sciences, where linear relationships often approximate real-world phenomena. \n",
295+
"\n",
296+
"However, it is important to recognize the limitations of linear models, such as their inability to account for non-linear relationships. Future work could involve evaluating the model's performance with real-world data to enhance its practical significance and encourage deeper analysis of trends and their implications. By considering the potential for outliers or variations that might disrupt linearity, a more nuanced understanding of the model's applicability can be achieved.\n"
297+
]
298+
}
299+
],
221300
"source": [
222301
"try:\n",
223302
" result = explainer(\n",
224303
" fig,\n",
225304
" prompt=\"Describe this plot briefly.\",\n",
226305
" api_keys=api_keys,\n",
227306
" selected_models=[(\"groq\", \"llama-3.1-8b-instant\")],\n",
228-
" interactive=len(api_keys) == 0,\n",
307+
" interactive=True, #len(api_keys) == 0,\n",
229308
" timeout=30\n",
230309
" )\n",
231-
" print(\"\u2705 Groq explanation generated:\")\n",
310+
" print(\" Groq explanation generated:\")\n",
232311
" print(f\"\\n{result}\")\n",
233312
"except ValueError as e:\n",
234-
" print(f\"\u274c Error: {e}\")"
313+
" print(f\" Error: {e}\")"
235314
]
236315
},
237316
{
@@ -256,7 +335,7 @@
256335
" interactive=False\n",
257336
" )\n",
258337
"except ValueError as e:\n",
259-
" print(\"\u2705 Error handling works!\")\n",
338+
" print(\" Error handling works!\")\n",
260339
" print(f\"\\n{e}\")"
261340
]
262341
},
@@ -277,7 +356,7 @@
277356
"\n",
278357
"registry = get_registry_loader()\n",
279358
"\n",
280-
"print(\"\ud83d\udccb AVAILABLE MODELS:\\n\")\n",
359+
"print(\"📋 AVAILABLE MODELS:\\n\")\n",
281360
"\n",
282361
"print(\"OpenAI (Chat):\")\n",
283362
"for model in registry.get_provider_models(\"openai\", \"chat\"):\n",
@@ -314,4 +393,4 @@
314393
},
315394
"nbformat": 4,
316395
"nbformat_minor": 4
317-
}
396+
}

notebooks/03-testing-multi-provider.ipynb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@
268268
" api_keys=api_keys,\n",
269269
" selected_models=[(\"openai\", \"gpt-99-invalid\")],\n",
270270
" interactive=False\n",
271-
" )\nexcept ValueError as e:\n",
271+
" )\n",
272+
"except ValueError as e:\n",
272273
" print(\"✅ Error caught (as expected):\")\n",
273274
" print(f\"\\n{e}\")\n",
274275
" print(f\"\\n📌 Notice: Error shows the exact model that's wrong\")\n",
@@ -300,7 +301,8 @@
300301
" api_keys=api_keys,\n",
301302
" selected_models=[(\"nonexistent-ai\", \"model-xyz\")],\n",
302303
" interactive=False\n",
303-
" )\nexcept ValueError as e:\n",
304+
" )\n",
305+
"except ValueError as e:\n",
304306
" print(\"✅ Error caught (as expected):\")\n",
305307
" print(f\"\\n{e}\")\n",
306308
" print(f\"\\n📌 Notice: Error lists all SUPPORTED providers\")"
@@ -391,15 +393,23 @@
391393
],
392394
"metadata": {
393395
"kernelspec": {
394-
"display_name": "Python 3",
396+
"display_name": "Python 3 (ipykernel)",
395397
"language": "python",
396398
"name": "python3"
397399
},
398400
"language_info": {
401+
"codemirror_mode": {
402+
"name": "ipython",
403+
"version": 3
404+
},
405+
"file_extension": ".py",
406+
"mimetype": "text/x-python",
399407
"name": "python",
408+
"nbconvert_exporter": "python",
409+
"pygments_lexer": "ipython3",
400410
"version": "3.13.7"
401411
}
402412
},
403413
"nbformat": 4,
404-
"nbformat_minor": 2
414+
"nbformat_minor": 4
405415
}

plotsense/data/providers.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
"gpt-3.5-turbo": 0.008,
103103
"llama-3.1-8b-instant": 0.005,
104104
"llama-3.3-70b-versatile": 0.02,
105-
"mixtral-8x7b-32768": 0.015,
106105
"claude-3-5-sonnet-20241022": 0.02,
107106
"claude-3-opus-20240229": 0.05,
108107
"claude-3-haiku-20240307": 0.009,
@@ -125,7 +124,6 @@
125124
"claude-3-haiku-20240307": 7.0,
126125
"llama-3.3-70b-versatile": 8.8,
127126
"llama-3.1-8b-instant": 6.5,
128-
"mixtral-8x7b-32768": 7.8,
129127
"gemini-1.5-pro": 9.3,
130128
"gemini-1.5-flash": 7.8,
131129
"gemini-2.0-flash": 8.5,

0 commit comments

Comments
 (0)