jupyter-agent 2025.6.102__py3-none-any.whl → 2025.6.103__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.
- jupyter_agent/bot_magics.py +23 -2
- {jupyter_agent-2025.6.102.dist-info → jupyter_agent-2025.6.103.dist-info}/METADATA +42 -4
- {jupyter_agent-2025.6.102.dist-info → jupyter_agent-2025.6.103.dist-info}/RECORD +6 -6
- {jupyter_agent-2025.6.102.dist-info → jupyter_agent-2025.6.103.dist-info}/WHEEL +0 -0
- {jupyter_agent-2025.6.102.dist-info → jupyter_agent-2025.6.103.dist-info}/licenses/LICENSE +0 -0
- {jupyter_agent-2025.6.102.dist-info → jupyter_agent-2025.6.103.dist-info}/top_level.txt +0 -0
jupyter_agent/bot_magics.py
CHANGED
@@ -61,10 +61,33 @@ class BotMagics(Magics, Configurable):
|
|
61
61
|
|
62
62
|
return options
|
63
63
|
|
64
|
+
def ensure_notebook_path(self):
|
65
|
+
if self.notebook_path:
|
66
|
+
return self.notebook_path
|
67
|
+
result = self.shell and self.shell.run_cell("globals().get('__vsc_ipynb_file__')")
|
68
|
+
if result and result.success and result.result:
|
69
|
+
self.notebook_path = result.result
|
70
|
+
return self.notebook_path
|
71
|
+
try:
|
72
|
+
self.notebook_path = str(ipynbname.path())
|
73
|
+
return self.notebook_path
|
74
|
+
except Exception as e:
|
75
|
+
_F(f"Failed to get notebook path: {e}")
|
76
|
+
return None
|
77
|
+
|
64
78
|
@cell_magic
|
65
79
|
def bot(self, line, cell):
|
66
80
|
"""Jupyter cell magic: %%bot"""
|
67
81
|
try:
|
82
|
+
if not self.ensure_notebook_path():
|
83
|
+
_O(
|
84
|
+
Markdown(
|
85
|
+
"The notebook path is **empty**, we can't do anything.\n\n"
|
86
|
+
"Please set the notebook path in the configuration, and **RERUN** the cell again.\n\n"
|
87
|
+
'For example: `%config BotMagics.notebook_path = globals()["__vsc_ipynb_file__"]`'
|
88
|
+
)
|
89
|
+
)
|
90
|
+
return
|
68
91
|
AgentCellContext.SUPPORT_SAVE_META = self.support_save_meta
|
69
92
|
reset_output(stage="Logging", logging_level=self.logging_level)
|
70
93
|
_I("Cell magic %%bot executing ...")
|
@@ -85,8 +108,6 @@ class BotMagics(Magics, Configurable):
|
|
85
108
|
options = self.parse_args(line)
|
86
109
|
_D(f"Cell magic called with options: {options}")
|
87
110
|
set_logging_level(options.logging_level)
|
88
|
-
self.notebook_path = self.notebook_path or ipynbname.path()
|
89
|
-
_D(f"Cell magic called with notebook path: {self.notebook_path}")
|
90
111
|
nb_context = NotebookContext(line, cell, notebook_path=self.notebook_path)
|
91
112
|
agent_factory = AgentFactory(
|
92
113
|
nb_context,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: jupyter-agent
|
3
|
-
Version: 2025.6.
|
3
|
+
Version: 2025.6.103
|
4
4
|
Summary: 调用LLM实现Jupyter代码的自动生成、执行、调试等功能
|
5
5
|
Author: viewstar000
|
6
6
|
License: MIT
|
@@ -75,6 +75,8 @@ pip install /path/to/jupyter-agent/dist/jupyter_agent-xxxx-py3-none-any.whl
|
|
75
75
|
|
76
76
|
### 全局配置
|
77
77
|
|
78
|
+
基础配置
|
79
|
+
|
78
80
|
```python
|
79
81
|
# 加载扩展的Magic命令
|
80
82
|
%load_ext jupyter_agent.bot_magics
|
@@ -84,12 +86,26 @@ pip install /path/to/jupyter-agent/dist/jupyter_agent-xxxx-py3-none-any.whl
|
|
84
86
|
%config BotMagics.default_api_key = 'API_KEY'
|
85
87
|
%config BotMagics.default_model_name = 'qwen3-30b-a3b'
|
86
88
|
%config BotMagics.coding_model_name = 'devstral-small-2505-mlx'
|
89
|
+
```
|
90
|
+
|
91
|
+
扩展配置
|
87
92
|
|
88
|
-
|
93
|
+
```python
|
94
|
+
# 设置当前Notebook的路径,当无法自动获取时需要手工指定,以Vscode中的Notebook为例
|
89
95
|
%config BotMagics.notebook_path = globals()["__vsc_ipynb_file__"]
|
90
96
|
|
91
97
|
# 设置是否保存任务数据到Metadata,只有Vscode中安装了jupyter-agent-extension后才支持
|
92
98
|
%config BotMagics.support_save_meta = True
|
99
|
+
|
100
|
+
# 设置日志级别,可选值为DEBUG、INFO、WARN、ERROR、FATAL,默认为INFO
|
101
|
+
%config BotMagics.logging_level = 'DEBUG'
|
102
|
+
|
103
|
+
# 设置是否显示思考过程,默认为True
|
104
|
+
%config BotMagics.display_think = True
|
105
|
+
|
106
|
+
# 设置是否显示发送给出LLM的消息和LLM的回答,默认为False
|
107
|
+
%config BotMagics.display_message = True
|
108
|
+
%config BotMagics.display_response = True
|
93
109
|
```
|
94
110
|
|
95
111
|
### 全局任务规划
|
@@ -118,7 +134,7 @@ pip install /path/to/jupyter-agent/dist/jupyter_agent-xxxx-py3-none-any.whl
|
|
118
134
|
|
119
135
|

|
120
136
|
|
121
|
-
>
|
137
|
+
> **注:**由于cell magic命令无法直接定位当前cell,需要通过cell的内容进行匹配,因此首次执行%%bot命令时,需要在cell中额外添加一些随机字符
|
122
138
|
|
123
139
|
接下来工具会调用相应的agent自动生成并执行相应步骤的代码,如下图:
|
124
140
|
|
@@ -130,6 +146,8 @@ pip install /path/to/jupyter-agent/dist/jupyter_agent-xxxx-py3-none-any.whl
|
|
130
146
|
|
131
147
|

|
132
148
|
|
149
|
+
> **注:**在执行`%%bot`命令前,必须确保当前Notebook已保存,否则Agent无法读取到完整的Notebook上下文。建议开启Notebook编辑器自动保存功能。
|
150
|
+
|
133
151
|
更详细用法可参考[示例Notebook](https://github.com/viewstar000/jupyter-agent/blob/main/examples/data_loader.ipynb)
|
134
152
|
|
135
153
|
## 贡献
|
@@ -195,6 +213,10 @@ pip install /path/to/jupyter-agent/dist/jupyter_agent-xxxx-py3-none-any.whl
|
|
195
213
|
|
196
214
|
After installing `jupyter-agent` and `jupyter-agent-extension`, you can use `%%bot` magic command to work on task planning, code generation and execution.
|
197
215
|
|
216
|
+
### Configuration
|
217
|
+
|
218
|
+
Basic Configuration:
|
219
|
+
|
198
220
|
First create or open a notebook in Vscode, create a new cell, enter and execute the following commands:
|
199
221
|
|
200
222
|
```python
|
@@ -206,12 +228,26 @@ First create or open a notebook in Vscode, create a new cell, enter and execute
|
|
206
228
|
%config BotMagics.default_api_key = 'API_KEY'
|
207
229
|
%config BotMagics.default_model_name = 'qwen3-30b-a3b'
|
208
230
|
%config BotMagics.coding_model_name = 'devstral-small-2505-mlx'
|
231
|
+
```
|
209
232
|
|
210
|
-
|
233
|
+
Advanced Configuration:
|
234
|
+
|
235
|
+
```python
|
236
|
+
# Set the current notebook path, when it is not automatically obtained, it needs to be manually specified, for example, in Vscode Notebook
|
211
237
|
%config BotMagics.notebook_path = globals()["__vsc_ipynb_file__"]
|
212
238
|
|
213
239
|
# Set whether to save task data to Metadata, only Vscode installed with jupyter-agent-extension supports
|
214
240
|
%config BotMagics.support_save_meta = True
|
241
|
+
|
242
|
+
# Set the log level, available values are DEBUG、INFO、WARN、ERROR、FATAL, default is INFO
|
243
|
+
%config BotMagics.logging_level = 'DEBUG'
|
244
|
+
|
245
|
+
# Set whether to display thinking process, default is True
|
246
|
+
%config BotMagics.display_think = True
|
247
|
+
|
248
|
+
# Set whether to display messages sent to LLM and LLM responses, default is False
|
249
|
+
%config BotMagics.display_message = True
|
250
|
+
%config BotMagics.display_response = True
|
215
251
|
```
|
216
252
|
|
217
253
|
Now, you can use the `%%bot` command to work on task rules and code generation.
|
@@ -249,6 +285,8 @@ After generating code for a subtask, the tool will call the corresponding agent
|
|
249
285
|
|
250
286
|

|
251
287
|
|
288
|
+
> **Note:** Before using the `%%bot` command, you must ensure that the current notebook has been saved, otherwise the agent will not be able to read the full context of the notebook. Suggested to enable the notebook editor's automatic save function.
|
289
|
+
|
252
290
|
For more details, please refer to [example notebook](https://github.com/viewstar000/jupyter-agent/blob/main/examples/data_loader.ipynb)
|
253
291
|
|
254
292
|
## Contributing
|
@@ -1,7 +1,7 @@
|
|
1
1
|
jupyter_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
jupyter_agent/bot_chat.py,sha256=RkaT-Cpkp3G24F1AtbcgqjKo-LBxwMNAYHVitaPZNOg,8834
|
3
3
|
jupyter_agent/bot_contexts.py,sha256=eFezr7ImokMz33jJJMlLLQspQBYnuE6Bc2bE1wLbXWU,19123
|
4
|
-
jupyter_agent/bot_magics.py,sha256=
|
4
|
+
jupyter_agent/bot_magics.py,sha256=whyGu6Jru7ZAIWXjwoq_CfNxqvlDawGTREUHX9XjHFY,7434
|
5
5
|
jupyter_agent/bot_outputs.py,sha256=7_cbOBaGdoYMR6qu43nZEsB9KY6wp4zA0Dh7Jq7LMTg,14065
|
6
6
|
jupyter_agent/utils.py,sha256=jbvDtVK6MfGaf5ZLoam_sq9R5TMriEG4HbMF0bHHDes,4387
|
7
7
|
jupyter_agent/bot_agents/__init__.py,sha256=IdlBlvfaDUfp3qhkNuwUVV_CdplafZsgLezLVkZCREw,1323
|
@@ -26,8 +26,8 @@ jupyter_agent/bot_flows/master_planner.py,sha256=2MvAMikMsBIarTL4QNYTjAs70bxo7VA
|
|
26
26
|
jupyter_agent/bot_flows/task_executor_v1.py,sha256=WzTfoOTjBpk1emvpiL3yeiudKdDf6EpVdJIugxxbqM4,2975
|
27
27
|
jupyter_agent/bot_flows/task_executor_v2.py,sha256=IyfxhzA4TljNd6iqqUYxxzB63r9lxfe1Zbu177hytRs,2949
|
28
28
|
jupyter_agent/bot_flows/task_executor_v3.py,sha256=NwJy7iAo2U3rl5iQYpACWVAkIA5DRMDdx0JadheRMMQ,3198
|
29
|
-
jupyter_agent-2025.6.
|
30
|
-
jupyter_agent-2025.6.
|
31
|
-
jupyter_agent-2025.6.
|
32
|
-
jupyter_agent-2025.6.
|
33
|
-
jupyter_agent-2025.6.
|
29
|
+
jupyter_agent-2025.6.103.dist-info/licenses/LICENSE,sha256=nWMmSIg7OepTIDX_OPP0-T9ImeCBBoog7eJxm5awtcM,1068
|
30
|
+
jupyter_agent-2025.6.103.dist-info/METADATA,sha256=ZtUJtanX1-RXpH1mMA6JH9fWCWK4YMaFU1h9e2nP_tE,9998
|
31
|
+
jupyter_agent-2025.6.103.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
32
|
+
jupyter_agent-2025.6.103.dist-info/top_level.txt,sha256=c3USTBZ7DZGuvLKlEW-QfGIx0tzn98iCEn3bpdYnDtE,14
|
33
|
+
jupyter_agent-2025.6.103.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|