mito-ai 0.1.54__py3-none-any.whl → 0.1.55__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mito_ai/_version.py +1 -1
- mito_ai/completions/prompt_builders/agent_system_message.py +15 -5
- mito_ai/completions/prompt_builders/chat_system_message.py +17 -2
- mito_ai/completions/prompt_builders/prompt_constants.py +22 -0
- mito_ai/completions/prompt_builders/utils.py +7 -0
- mito_ai/utils/open_ai_utils.py +3 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/build_log.json +147 -102
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/package.json +3 -2
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/package.json.orig +3 -2
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.31462f8f6a76b1cefbeb.js → mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.49c79c62671528877c61.js +2351 -501
- mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.49c79c62671528877c61.js.map +1 -0
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.3f3c98eaba66bf084c66.js → mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.9dfbffc3592eb6f0aef9.js +21 -19
- mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.9dfbffc3592eb6f0aef9.js.map +1 -0
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/style_index_js.5876024bb17dbd6a3ee6.js → mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/style_index_js.f5d476ac514294615881.js +15 -7
- mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/static/style_index_js.f5d476ac514294615881.js.map +1 -0
- mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/themes/mito_ai/index.css +708 -0
- mito_ai-0.1.55.data/data/share/jupyter/labextensions/mito_ai/themes/mito_ai/index.js +0 -0
- {mito_ai-0.1.54.dist-info → mito_ai-0.1.55.dist-info}/METADATA +1 -1
- {mito_ai-0.1.54.dist-info → mito_ai-0.1.55.dist-info}/RECORD +41 -39
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.31462f8f6a76b1cefbeb.js.map +0 -1
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.3f3c98eaba66bf084c66.js.map +0 -1
- mito_ai-0.1.54.data/data/share/jupyter/labextensions/mito_ai/static/style_index_js.5876024bb17dbd6a3ee6.js.map +0 -1
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/etc/jupyter/jupyter_server_config.d/mito_ai.json +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/toolbar-buttons.json +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/node_modules_process_browser_js.4b128e94d31a81ebd209.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/node_modules_process_browser_js.4b128e94d31a81ebd209.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/style.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_apis_signOut_mjs-node_module-75790d.688c25857e7b81b1740f.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_apis_signOut_mjs-node_module-75790d.688c25857e7b81b1740f.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_tokenProvider_tokenProvider_-72f1c8.a917210f057fcfe224ad.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_tokenProvider_tokenProvider_-72f1c8.a917210f057fcfe224ad.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_dist_esm_index_mjs.6bac1a8c4cc93f15f6b7.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_dist_esm_index_mjs.6bac1a8c4cc93f15f6b7.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_ui-react_dist_esm_index_mjs.4fcecd65bef9e9847609.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_ui-react_dist_esm_index_mjs.4fcecd65bef9e9847609.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_react-dom_client_js-node_modules_aws-amplify_ui-react_dist_styles_css.b43d4249e4d3dac9ad7b.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_react-dom_client_js-node_modules_aws-amplify_ui-react_dist_styles_css.b43d4249e4d3dac9ad7b.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.3f6754ac5116d47de76b.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.3f6754ac5116d47de76b.js.map +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js +0 -0
- {mito_ai-0.1.54.data → mito_ai-0.1.55.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js.map +0 -0
- {mito_ai-0.1.54.dist-info → mito_ai-0.1.55.dist-info}/WHEEL +0 -0
- {mito_ai-0.1.54.dist-info → mito_ai-0.1.55.dist-info}/entry_points.txt +0 -0
- {mito_ai-0.1.54.dist-info → mito_ai-0.1.55.dist-info}/licenses/LICENSE +0 -0
mito_ai/_version.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from mito_ai.completions.prompt_builders.prompt_constants import (
|
|
5
5
|
CITATION_RULES,
|
|
6
|
+
CELL_REFERENCE_RULES,
|
|
6
7
|
FILES_SECTION_HEADING,
|
|
7
8
|
JUPYTER_NOTEBOOK_SECTION_HEADING,
|
|
8
9
|
VARIABLES_SECTION_HEADING,
|
|
@@ -291,7 +292,7 @@ When you have completed the user's task, respond with a message in this format:
|
|
|
291
292
|
|
|
292
293
|
Important information:
|
|
293
294
|
1. The message is a short summary of the ALL the work that you've completed on this task. It should not just refer to the final message. It could be something like "I've completed the sales strategy analysis by exploring key relationships in the data and summarizing creating a report with three recommendations to boost sales.""
|
|
294
|
-
2. The message should include citations for any insights that you shared with the user.
|
|
295
|
+
2. The message should include citations for any insights that you shared with the user and cell references for whenever you refer to specific cells that you've updated or created.
|
|
295
296
|
3. The next_steps is an optional list of 2 or 3 suggested follow-up tasks or analyses that the user might want to perform next. These should be concise, actionable suggestions that build on the work you've just completed. For example: ["Export the cleaned data to CSV", "Analyze revenue per customer", "Convert notebook into an app"].
|
|
296
297
|
4. The next_steps should be as relevant to the user's actual task as possible. Try your best not to make generic suggestions like "Analyze the data" or "Visualize the results". For example, if the user just asked you to calculate LTV of their customers, you might suggest the following next steps: ["Graph key LTV drivers: churn and average transaction value", "Visualize LTV per age group"].
|
|
297
298
|
5. If you are not sure what the user might want to do next, err on the side of suggesting next steps instead of making an assumption and using more CELL_UPDATES.
|
|
@@ -325,19 +326,29 @@ Output:
|
|
|
325
326
|
|
|
326
327
|
RULES
|
|
327
328
|
|
|
328
|
-
- You are working in a Jupyter Lab environment in a .ipynb file.
|
|
329
|
+
- You are working in a Jupyter Lab environment in a .ipynb file.
|
|
329
330
|
- You can only respond with CELL_UPDATES or FINISHED_TASK responses.
|
|
330
331
|
- In each message you send to the user, you can send one CellModification, one CellAddition, or one FINISHED_TASK response. BUT YOU WILL GET TO SEND MULTIPLE MESSAGES TO THE USER TO ACCOMPLISH YOUR TASK SO DO NOT TRY TO ACCOMPLISH YOUR TASK IN A SINGLE MESSAGE.
|
|
331
332
|
- After you send a CELL_UPDATE, the user will send you a message with the updated variables, code, and files in the current directory. You will use this information to decide what to do next, so it is critical that you wait for the user's response after each CELL_UPDATE before deciding your next action.
|
|
332
333
|
- When updating code, keep as much of the original code as possible and do not recreate variables that already exist.
|
|
333
|
-
- When you want to display a dataframe to the user, just write the dataframe on the last line of the code cell instead of writing print(<dataframe name>). Jupyter will automatically display the dataframe in the notebook.
|
|
334
334
|
- When writing the message, do not explain to the user how to use the CELL_UPDATE or FINISHED_TASK response, they will already know how to use them. Just provide a summary of your thought process. Do not reference any Cell IDs in the message.
|
|
335
335
|
- When writing the message, do not include leading words like "Explanation:" or "Thought process:". Just provide a summary of your thought process.
|
|
336
336
|
- When writing the message, use tickmarks when referencing specific variable names. For example, write `sales_df` instead of "sales_df" or just sales_df.
|
|
337
337
|
|
|
338
|
+
====
|
|
339
|
+
|
|
340
|
+
CODE STYLE
|
|
341
|
+
|
|
342
|
+
- Avoid using try/except blocks and other defensive programming patterns (like checking if files exist before reading them, verifying variables are defined before using them, etc.) unless there is a really good reason. In Jupyter notebooks, errors should surface immediately so users can identify and fix issues. When errors are caught and suppressed or when defensive checks hide problems, users continue running broken code without realizing it, and the agent's auto-error-fix loop cannot trigger. If a column doesn't exist, a file is missing, a variable isn't defined, or a module isn't installed, let it error. The user needs to know.
|
|
343
|
+
- When you want to display a dataframe to the user, just write the dataframe on the last line of the code cell instead of writing print(<dataframe name>). Jupyter will automatically display the dataframe in the notebook.
|
|
344
|
+
- When importing matplotlib, write the code `%matplotlib inline` to make sure the graphs render in Jupyter.
|
|
345
|
+
|
|
338
346
|
====
|
|
339
347
|
{CITATION_RULES}
|
|
340
348
|
|
|
349
|
+
====
|
|
350
|
+
{CELL_REFERENCE_RULES}
|
|
351
|
+
|
|
341
352
|
<Citation Example>
|
|
342
353
|
|
|
343
354
|
### User Message 1:
|
|
@@ -471,5 +482,4 @@ REMEMBER, YOU ARE GOING TO COMPLETE THE USER'S TASK OVER THE COURSE OF THE ENTIR
|
|
|
471
482
|
====
|
|
472
483
|
|
|
473
484
|
OTHER USEFUL INFORMATION:
|
|
474
|
-
1.
|
|
475
|
-
2. The active cell ID is shared with you so that when the user refers to "this cell" or similar phrases, you know which cell they mean. However, you are free to edit any cell that you see fit."""
|
|
485
|
+
1. The active cell ID is shared with you so that when the user refers to "this cell" or similar phrases, you know which cell they mean. However, you are free to edit any cell that you see fit."""
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
from mito_ai.completions.prompt_builders.prompt_constants import (
|
|
5
5
|
CHAT_CODE_FORMATTING_RULES,
|
|
6
|
-
CITATION_RULES,
|
|
6
|
+
CITATION_RULES,
|
|
7
|
+
CELL_REFERENCE_RULES,
|
|
7
8
|
ACTIVE_CELL_ID_SECTION_HEADING,
|
|
8
9
|
CODE_SECTION_HEADING,
|
|
9
10
|
get_database_rules
|
|
@@ -28,6 +29,9 @@ Other useful information:
|
|
|
28
29
|
====
|
|
29
30
|
{CITATION_RULES}
|
|
30
31
|
|
|
32
|
+
====
|
|
33
|
+
{CELL_REFERENCE_RULES}
|
|
34
|
+
|
|
31
35
|
<Example 1>
|
|
32
36
|
{ACTIVE_CELL_ID_SECTION_HEADING}
|
|
33
37
|
'7b3a9e2c-5d14-4c83-b2f9-d67891e4a5f2'
|
|
@@ -79,6 +83,18 @@ Notice in the example above that the user is just sending a friendly message, so
|
|
|
79
83
|
====
|
|
80
84
|
{CHAT_CODE_FORMATTING_RULES}
|
|
81
85
|
|
|
86
|
+
====
|
|
87
|
+
|
|
88
|
+
CODE STYLE
|
|
89
|
+
|
|
90
|
+
- Avoid using try/except blocks and other defensive programming patterns (like checking if files exist before reading them, verifying variables are defined before using them, etc.) unless there is a really good reason. In Jupyter notebooks, errors should surface immediately so users can identify and fix issues. When errors are caught and suppressed or when defensive checks hide problems, users continue running broken code without realizing it, and the agent's auto-error-fix loop cannot trigger. If a column doesn't exist, a file is missing, a variable isn't defined, or a module isn't installed, let it error. The user needs to know.
|
|
91
|
+
- Write code that preserves the intent of the original code shared with you and the task to complete.
|
|
92
|
+
- Make the solution as simple as possible.
|
|
93
|
+
- Do not add temporary comments like '# Fixed the typo here' or '# Added this line to fix the error'
|
|
94
|
+
- When importing matplotlib, write the code `%matplotlib inline` to make sure the graphs render in Jupyter.
|
|
95
|
+
|
|
96
|
+
====
|
|
97
|
+
|
|
82
98
|
IMPORTANT RULES:
|
|
83
99
|
- Do not recreate variables that already exist
|
|
84
100
|
- Keep as much of the original code as possible
|
|
@@ -87,6 +103,5 @@ IMPORTANT RULES:
|
|
|
87
103
|
- Write code that preserves the intent of the original code shared with you and the task to complete.
|
|
88
104
|
- Make the solution as simple as possible.
|
|
89
105
|
- Reuse as much of the existing code as possible.
|
|
90
|
-
- Do not add temporary comments like '# Fixed the typo here' or '# Added this line to fix the error'
|
|
91
106
|
- Whenever writing Python code, it should be a python code block starting with ```python and ending with ```
|
|
92
107
|
"""
|
|
@@ -46,6 +46,28 @@ Citation Rules:
|
|
|
46
46
|
8. Do not include the citation in the code block as a comment. ONLY include the citation in the message field of your response.
|
|
47
47
|
"""
|
|
48
48
|
|
|
49
|
+
CELL_REFERENCE_RULES = """RULES FOR REFERENCING CELLS
|
|
50
|
+
|
|
51
|
+
When referring to specific cells in the notebook in your messages, use cell references so the user can easily navigate to the cell you're talking about. The user sees cells numbered as "Cell 1", "Cell 2", etc., but internally cells are identified by their unique IDs.
|
|
52
|
+
|
|
53
|
+
To reference a cell, use this format inline in your message:
|
|
54
|
+
[MITO_CELL_REF:cell_id]
|
|
55
|
+
|
|
56
|
+
This will be displayed to the user as a clickable "Cell N" link that navigates to the referenced cell.
|
|
57
|
+
|
|
58
|
+
Cell Reference Rules:
|
|
59
|
+
|
|
60
|
+
1. Use cell references when discussing specific cells you've created or modified (e.g., "I've added the data cleaning code in [MITO_CELL_REF:abc123]").
|
|
61
|
+
2. Use cell references when referring to cells the user mentioned or that contain relevant context.
|
|
62
|
+
3. The cell_id must be an actual cell ID from the notebook - do not make up IDs.
|
|
63
|
+
4. Place the reference inline where it makes sense in your message, similar to how you would write "Cell 3" in natural language.
|
|
64
|
+
5. Do not use cell references in code - only in the message field of your responses.
|
|
65
|
+
6. Cell references are different from citations. Use citations for specific line-level insights; use cell references for general cell-level navigation.
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
"I've loaded the sales data in [MITO_CELL_REF:c68fdf19-db8c-46dd-926f-d90ad35bb3bc] and will now calculate the monthly totals."
|
|
69
|
+
"""
|
|
70
|
+
|
|
49
71
|
def get_active_cell_output_str(has_active_cell_output: bool) -> str:
|
|
50
72
|
"""
|
|
51
73
|
Used to tell the AI about the output of the active code cell.
|
|
@@ -39,6 +39,7 @@ def get_selected_context_str(additional_context: Optional[List[Dict[str, str]]])
|
|
|
39
39
|
selected_files = [context["value"] for context in additional_context if context.get("type") == "file"]
|
|
40
40
|
selected_db_connections = [context["value"] for context in additional_context if context.get("type") == "db"]
|
|
41
41
|
selected_images = [context["value"] for context in additional_context if context.get("type", "").startswith("image/")]
|
|
42
|
+
selected_cells = [context["value"] for context in additional_context if context.get("type") == "cell"]
|
|
42
43
|
|
|
43
44
|
# STEP 2: Create a list of strings (instructions) for each context type
|
|
44
45
|
context_parts = []
|
|
@@ -66,6 +67,12 @@ def get_selected_context_str(additional_context: Optional[List[Dict[str, str]]])
|
|
|
66
67
|
"The following images have been selected by the user to be used in the task:\n"
|
|
67
68
|
+ "\n".join(selected_images)
|
|
68
69
|
)
|
|
70
|
+
|
|
71
|
+
if len(selected_cells) > 0:
|
|
72
|
+
context_parts.append(
|
|
73
|
+
"The following cells have been selected by the user to be used in the task:\n"
|
|
74
|
+
+ "\n".join(selected_cells)
|
|
75
|
+
)
|
|
69
76
|
|
|
70
77
|
# STEP 3: Combine into a single string
|
|
71
78
|
return "\n\n".join(context_parts)
|
mito_ai/utils/open_ai_utils.py
CHANGED
|
@@ -171,6 +171,9 @@ def get_open_ai_completion_function_params(
|
|
|
171
171
|
"stream": stream,
|
|
172
172
|
"messages": messages,
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
if model == "gpt-5.2":
|
|
176
|
+
completion_function_params["reasoning_effort"] = "low"
|
|
174
177
|
|
|
175
178
|
# If a response format is provided, we need to convert it to a json schema.
|
|
176
179
|
# Pydantic models are supported by the OpenAI API, however, we need to be able to
|