Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code completion for jupyter lab/notebook #419

Closed
wants to merge 96 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
e8a0f4f
add bigcode readme.md
Wzixiao Aug 17, 2023
7132c25
fix readmd image bug
Wzixiao Aug 17, 2023
4e7763f
Improve method in readme
Wzixiao Aug 17, 2023
25251cd
Improve method in readme
Wzixiao Aug 17, 2023
d6e5038
add merge plan
Wzixiao Aug 17, 2023
f85b05c
Continue to improve readme.md
Wzixiao Aug 17, 2023
d9e630c
add changed code color to readme
Wzixiao Aug 18, 2023
10165e9
add save data to laocl plan
Wzixiao Aug 18, 2023
b97fc85
move md Images to local ./mdImages
Wzixiao Aug 18, 2023
7691d2b
fix logic bug in readme
Wzixiao Aug 18, 2023
78730d3
fix logic bug in readme
Wzixiao Aug 19, 2023
9d25bf6
refactor readme
Wzixiao Aug 23, 2023
c0899c4
Complete the preliminary structure
Wzixiao Aug 23, 2023
db8980b
Add dependencies on readme
Wzixiao Aug 23, 2023
7c2d49e
A simple version that completes the continuation
Wzixiao Aug 23, 2023
d7ca78f
Merge pull request #3 from Wzixiao/request
Wzixiao Aug 23, 2023
de3f65e
perfect readme
Wzixiao Aug 23, 2023
b3f5c88
Merge pull request #4 from Wzixiao/request
Wzixiao Aug 23, 2023
ae8087b
perfect readme
Wzixiao Aug 23, 2023
2e7b074
Merge pull request #5 from Wzixiao/request
Wzixiao Aug 23, 2023
0e43347
Added functionality to animate on request
Wzixiao Aug 23, 2023
1502810
add animation to bigcode-zh.md
Wzixiao Aug 23, 2023
84da159
Merge pull request #6 from Wzixiao/animation
Wzixiao Aug 23, 2023
3c5a6f5
fix request loading animation bug
chenJuZ Aug 23, 2023
22aa6a1
remove irrelevant code
Wzixiao Aug 24, 2023
2414664
Merge pull request #7 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
9d9412d
format code
Wzixiao Aug 24, 2023
2c6b302
Merge pull request #8 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
eca890a
fix get cell error
Wzixiao Aug 24, 2023
7c7fe46
Merge pull request #9 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
f6654ae
Fixed issue where no code would appear after pressing enter
Wzixiao Aug 24, 2023
3341761
Merge pull request #10 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
61ba755
Fixed issue where no code would appear after pressing enter
Wzixiao Aug 24, 2023
18b1841
Merge pull request #11 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
01cc1fa
Change use other shortcut keys to determine the way to enter the method
Wzixiao Aug 24, 2023
6959e00
Merge pull request #12 from Wzixiao/shortcut-keys
Wzixiao Aug 24, 2023
b682dbc
Fix bug when formatting prompt
Wzixiao Aug 24, 2023
a7fbdab
Merge pull request #13 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
c3eed45
Fixed that when the code is displayed and the current cell is empty, …
Wzixiao Aug 24, 2023
00a8c1a
Merge pull request #14 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
7e9a22f
When reloading the animation, the original animation dom should be re…
Wzixiao Aug 24, 2023
6107997
Merge pull request #15 from Wzixiao/fix-bug
Wzixiao Aug 24, 2023
938047d
add debug log
Wzixiao Aug 25, 2023
5e11485
add hot key on request
Wzixiao Aug 25, 2023
aa1e3d3
Merge pull request #16 from Wzixiao/debug-log
Wzixiao Aug 25, 2023
916510b
Merge pull request #17 from Wzixiao/hotkey
Wzixiao Aug 25, 2023
80021b0
Improve the hotkey context, including log, readme, etc.
Wzixiao Aug 25, 2023
ec6919f
Merge pull request #18 from Wzixiao/hotkey
Wzixiao Aug 25, 2023
cbcee9f
add examples
Wzixiao Aug 25, 2023
c4ce981
[200~Fixed a hint error~
Wzixiao Aug 25, 2023
ddbe16f
Merge pull request #19 from Wzixiao/examples
Wzixiao Aug 25, 2023
95942cf
Replace 'continue writing' with 'code complement'
Wzixiao Aug 27, 2023
0440066
Replace 'Add a part function docstring
Wzixiao Aug 27, 2023
77e46e3
add docstring
Wzixiao Aug 28, 2023
247b187
Merge pull request #20 from Wzixiao/file_name
Wzixiao Aug 28, 2023
771c52a
update bigcode icon
Wzixiao Aug 28, 2023
390fad5
Merge pull request #21 from Wzixiao/icon
Wzixiao Aug 28, 2023
2e8c611
add 'Enable code completion' function
Wzixiao Sep 3, 2023
9e007a5
Merge pull request #22 from Wzixiao/select-monitor
Wzixiao Sep 3, 2023
d17070f
Improve some docstring
Wzixiao Sep 3, 2023
758d14b
Merge pull request #23 from Wzixiao/docstring
Wzixiao Sep 3, 2023
1db503c
add token limit
Wzixiao Sep 3, 2023
106cbd3
Merge pull request #24 from Wzixiao/token-limit
Wzixiao Sep 3, 2023
fa1bc6e
Fix the bug of adding new cells
Wzixiao Sep 3, 2023
b156446
remove garbage output
Wzixiao Sep 3, 2023
21ea03d
Merge pull request #25 from Wzixiao/fix-bug
Wzixiao Sep 3, 2023
a99ebc3
Merge pull request #2 from Wzixiao/code-continue-writing
Wzixiao Sep 3, 2023
b2c17f9
Merge remote-tracking branch 'upstream/main'
Wzixiao Sep 3, 2023
054fc10
Improve readme for code completion
Wzixiao Sep 3, 2023
701d798
Add code completion examples to the readme.md
Wzixiao Sep 3, 2023
4b46ea5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 3, 2023
63f719e
change css asking price style
Wzixiao Sep 3, 2023
d38323e
merge remote branch
Wzixiao Sep 3, 2023
90342de
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 3, 2023
1bcc70c
change css asking price style
Wzixiao Sep 3, 2023
951a94a
Merge branch 'main' of github.com:Wzixiao/jupyter-ai-bigcode-code-com…
Wzixiao Sep 3, 2023
1f2ad83
Delete incorrectly uploaded files
Wzixiao Sep 9, 2023
d290932
Merge branch 'main' of https://github.com/jupyterlab/jupyter-ai
Wzixiao Sep 9, 2023
9bbefa8
Add key completion code completion
Wzixiao Oct 14, 2023
8f653f5
Add developer readme
Wzixiao Oct 15, 2023
dbfd77d
Fix the bug of remote call not using stram
Wzixiao Oct 18, 2023
57cec96
Comment out useless methods and improve development documentation
Wzixiao Oct 18, 2023
be49934
Optimize code naming
chenJuZ Oct 22, 2023
9ff32b2
Fixed the issue where enter would intercept automatic requests
Wzixiao Oct 23, 2023
8b01aac
Fixed the issue where enter fails when pressing the ghost text to start.
Wzixiao Oct 23, 2023
d23c242
Complete autocomplete
Wzixiao Oct 25, 2023
0c1a5be
Merge branch 'main' of https://github.com/jupyterlab/jupyter-ai into …
Wzixiao Oct 26, 2023
c8e6ddb
Animations now also exist on automatic requests
Wzixiao Oct 26, 2023
dc40985
Remove DEVELOP.md
Wzixiao Oct 29, 2023
b5a0ada
Mock request (#27)
Wzixiao Oct 31, 2023
8f2390c
Merge branch 'main' into auto-completion
Wzixiao Oct 31, 2023
161a4d2
Remove wrong characters pressed in code
Wzixiao Oct 31, 2023
f311580
Reconstruct yarn.lock to solve the problem of stuck installation of e…
Wzixiao Oct 31, 2023
9b3d4bf
Improve some comments
Wzixiao Nov 1, 2023
a17f2ed
Fix the bug that the first one returned by stream is \n, which is una…
Wzixiao Nov 1, 2023
c32637e
Add code comments
Wzixiao Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ dev.sh
.jupyter_ystore.db

.yarn

.venv
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ that include variable values.

![Sample with code interpolation and markdown output](./docs/source/_static/sample-markdown.png)


## Code completion

In a cell, press {Short cut configured in the bigcode sidebar} to trigger

![Sample of pressing a shortcut key in code completion](./docs/source/_static/code-completion-setting-key-down.jpg)

Press "enter" to accpet the proposition.

![Sample of pressing enter after a successful request in code completion](./docs/source/_static/code-completion-setting-completion.jpg)

## JupyterLab extension

The Jupyter AI extension for JupyterLab offers a native UI that enables multiple users
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/code-completion-setting.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/debug-levels.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions docs/source/users/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,45 @@ The `--request-schema` parameter is the JSON object the endpoint expects as inpu
The `--response-path` option is a [JSONPath](https://goessner.net/articles/JsonPath/index.html) string that retrieves the language model's output from the endpoint's JSON response. For example, if your endpoint returns an object with the schema `{"generated_texts":["<output>"]}`, its response path is `generated_texts.[0]`.


## Code completion

### Usage

We first need to configure the huggingface token and short cut

![](../_static/code-completion-setting.jpg)

In a cell, press {The short cut configured in the image above} to trigger

![](../_static/code-completion-setting-key-down.jpg)

Press "enter" to accpet the proposition.

![](../_static/code-completion-setting-completion.jpg)


### Configure

Bigcode service url:

- The endpoint URL of the Bigcode service. This is the base URL that the code completion system will connect to when requesting code completions.

Huggingface Access Token:

- Your personal access token for Huggingface's service. This token authenticates and authorizes your requests to the Huggingface API.

Short cut for completion:

- A shortcut or key combination that, when pressed, triggers the code completion feature.

Max prompt tokens:

- The maximum number of tokens that can be sent in the prompt to the code completion API.

Max response tokens:

- Set 'Max Response Tokens' judiciously; a higher value can slow response times, and since we don't support streaming, you'll await the entire response.

## Configuration

You can specify an allowlist, to only allow only a certain list of providers, or a blocklist, to block some providers.
Expand Down
83 changes: 83 additions & 0 deletions examples/code-completion/sklearn_digits.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "dcbb2940-4d47-45ac-923a-f80eed1d26f5",
"metadata": {},
"outputs": [],
"source": [
"# load Digits Dataset from sklearn\n"
]
},
{
"cell_type": "markdown",
"id": "f3a60c45-244b-49f2-8527-519c5a2557a6",
"metadata": {},
"source": [
"Print to show there are 1797 images (8 by 8 images for a dimensionality of 64)"
]
},
{
"cell_type": "markdown",
"id": "0c159867-a499-4181-9713-d2558f1a258d",
"metadata": {},
"source": [
"Print to show there are 1797 labels (integers from 0–9)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e216707c-1ea7-446a-ac69-cd013e76b5f2",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "fe688a3e-29cb-464d-9eef-7e17ce4b9dee",
"metadata": {},
"source": [
"Showing the Images and the Labels (Digits Dataset)"
]
},
{
"cell_type": "markdown",
"id": "f2f5505f-32b1-4e22-8878-39f20e71335d",
"metadata": {},
"source": [
"This section is really just to show what the images and labels look like. It usually helps to visualize your data to see what you are working with."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4328fb40-b40c-4fde-8ef4-6a5b38c5dd10",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
5 changes: 4 additions & 1 deletion packages/jupyter-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@
"@jupyterlab/codeeditor": "^4",
"@jupyterlab/codemirror": "^4",
"@jupyterlab/collaboration": "^3",
"@jupyterlab/completer": "file:../../../jupyterlab/packages/completer",
"@jupyterlab/coreutils": "^6",
"@jupyterlab/fileeditor": "^4",
"@jupyterlab/notebook": "^4",
"@jupyterlab/services": "^7",
"@jupyterlab/ui-components": "^4",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.11.0",
"mobx": "^6.10.0",
"mobx-react": "^9.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.6",
Expand Down Expand Up @@ -103,7 +106,7 @@
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"ts-jest": "^29",
"typescript": "~4.3.0",
"typescript": "5.1.6",
"y-protocols": "^1.0.5"
},
"sideEffects": [
Expand Down
Loading
Loading