You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are seeing the frontend extension, but it is not working, check
6
+
that the server extension is enabled:
7
+
8
+
```bash
9
+
jupyter server extension list
10
+
```
11
+
12
+
If the server extension is installed and enabled, but you are not seeing
13
+
the frontend extension, check the frontend extension is installed:
14
+
15
+
```bash
16
+
jupyter labextension list
17
+
```
18
+
19
+
## Contributing
20
+
21
+
### Development install
22
+
23
+
Note: You will need NodeJS to build the extension package.
24
+
25
+
The `jlpm` command is JupyterLab's pinned version of
26
+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
27
+
`yarn` or `npm` in lieu of `jlpm` below.
28
+
29
+
```bash
30
+
# Clone the repo to your local environment
31
+
# Change directory to the jupyterlab_magic_wand directory
32
+
# Install package in development mode
33
+
pip install -e "."
34
+
# Link your development version of the extension with JupyterLab
35
+
jupyter labextension develop . --overwrite
36
+
# Server extension must be manually installed in develop mode
37
+
jupyter server extension enable jupyterlab_magic_wand
38
+
# Rebuild extension Typescript source after making changes
39
+
jlpm build
40
+
```
41
+
42
+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
43
+
44
+
```bash
45
+
# Watch the source directory in one terminal, automatically rebuilding when needed
46
+
jlpm watch
47
+
# Run JupyterLab in another terminal
48
+
jupyter lab
49
+
```
50
+
51
+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
52
+
53
+
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
54
+
55
+
```bash
56
+
jupyter lab build --minimize=False
57
+
```
58
+
59
+
### Development uninstall
60
+
61
+
```bash
62
+
# Server extension must be manually disabled in develop mode
63
+
jupyter server extension disable jupyterlab_magic_wand
64
+
pip uninstall jupyterlab_magic_wand
65
+
```
66
+
67
+
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
68
+
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
69
+
folder is located. Then you can remove the symlink named `jupyterlab_magic_wand` within that folder.
response= (awaitllm.ainvoke(input=f"Does the following input look like a prompt to write code (answer 'code' only) or content to be editted (answer 'content' only)?\n Input: {current['source']}")).content
97
+
if"code"inresponse.lower():
98
+
response= (awaitllm.ainvoke(input=f"Write code based on the prompt. Then, update the code to make it more efficient, add code comments, and respond with only the code and comments.\n Input: {current['source']}")).content
The code below came from a code cell in Jupyter. It raised the exception below. Update the code to fix the exception and add code comments explaining what you fixed. Respond with code only. Be succint.
The input below came from a code cell in Jupyter. If the input does not look like code, but instead a prompt, write code based on the prompt. Then, update the code to make it more efficient, add code comments, and respond with only the code and comments.
192
+
193
+
The code:
194
+
{code}
195
+
"""
196
+
197
+
USE_CONTEXT_TO_WRITE_CELL="""
198
+
You are working in a Jupyter Notebook. Use the previous ordered cells for context and write some code to add to a fourth cell. Look for opportunities to make a plot if data is involved. Respond with code only.
199
+
"""
200
+
201
+
defprompt_new_cell_using_context(cell_id, state):
202
+
content=state["context"]["content"]
203
+
cells=content["cells"]
204
+
205
+
fori, cellinenumerate(cells):
206
+
ifcell["id"] ==cell_id:
207
+
break
208
+
209
+
previous_cells= []
210
+
forjinrange(1, 4):
211
+
try:
212
+
previous_cells.append(cells[i-j])
213
+
except:
214
+
pass
215
+
216
+
prompt=USE_CONTEXT_TO_WRITE_CELL
217
+
fork, cellinenumerate(previous_cells):
218
+
prompt+=f"\ncCell {k} was a {cell['cell_type']} cell with source:\n{cell['source']}\n"
0 commit comments