Skip to content

Commit

Permalink
Merge pull request #1 from dlqqq/local-providers-dlqqq
Browse files Browse the repository at this point in the history
Fix build and add user documentation
  • Loading branch information
krassowski authored Aug 9, 2023
2 parents c84bfea + 9534d11 commit df53b37
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
33 changes: 32 additions & 1 deletion docs/source/users/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ The chat backend remembers the last two exchanges in your conversation and passe
alt='Screen shot of an example follow up question sent to Jupyternaut, who responds with the improved code and explanation.'
class="screenshot" />

### Using the chat interface with SageMaker endpoints
### SageMaker endpoints usage

Jupyter AI supports language models hosted on SageMaker endpoints that use JSON
schemas. The first step is to authenticate with AWS via the `boto3` SDK and have
Expand Down Expand Up @@ -255,6 +255,37 @@ response. In this example, the endpoint returns an object with the schema
`{"generated_texts":["<output>"]}`, hence the response path is
`generated_texts.[0]`.

### GPT4All usage (early-stage)

Currently, we offer experimental support for GPT4All. To get started, first
decide which models you will use. We currently offer three models from GPT4All:

| Model name | Model size | Model bin URL |
|------------------------------|------------|------------------------------------------------------------|
| `ggml-gpt4all-l13b-snoozy` | 7.6 GB | `http://gpt4all.io/models/ggml-gpt4all-l13b-snoozy.bin` |
| `ggml-gpt4all-j-v1.2-jazzy` | 3.8 GB | `https://gpt4all.io/models/ggml-gpt4all-j-v1.2-jazzy.bin` |
| `ggml-gpt4all-j-v1.3-groovy` | 3.8 GB | `https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin` |


Note that each model comes with its own license, and that users are themselves
responsible for verifying that their usage complies with the license. You can
find licensing details on the [GPT4All official site](https://gpt4all.io/index.html).

For each model you use, you will have to run the command

```
curl -LO --output-dir ~/.cache/gpt4all "<model-bin-url>"
```

, where `<model-bin-url>` should be substituted with the corresponding URL
hosting the model binary (within the double quotes). After restarting the
server, the GPT4All models installed in the previous step should be available to
use in the chat interface.

GPT4All support is still an early-stage feature, so some bugs may be encountered
during usage. Our team is still actively improving support for locally-hosted
models.

### Asking about something in your notebook

Jupyter AI's chat interface can include a portion of your notebook in your prompt.
Expand Down
5 changes: 4 additions & 1 deletion packages/jupyter-ai-magics/jupyter_ai_magics/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ def __init__(self, **kwargs):
model_id_key = "model"
pypi_package_deps = ["gpt4all"]
auth_strategy = None
fields = [IntegerField(key="n_threads", label="Threads")]
fields = [IntegerField(key="n_threads", label="CPU thread count (optional)")]

async def _acall(self, *args, **kwargs) -> Coroutine[Any, Any, str]:
return await self._call_in_executor(*args, **kwargs)


HUGGINGFACE_HUB_VALID_TASKS = (
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai-magics/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"ipython",
"pydantic",
"importlib_metadata~=5.2.0",
"langchain==0.0.220",
"langchain==0.0.223",
"typing_extensions==4.5.0",
"click~=8.0",
"jsonpath-ng~=1.5.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"openai~=0.26",
"aiosqlite~=0.18",
"importlib_metadata~=5.2.0",
"langchain==0.0.220",
"langchain==0.0.223",
"tiktoken", # required for OpenAIEmbeddings
"jupyter_ai_magics",
"dask[distributed]",
Expand Down
4 changes: 4 additions & 0 deletions packages/jupyter-ai/src/components/settings/model-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export function ModelField(props: ModelFieldProps): JSX.Element {
function handleChange(
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) {
if (!('format' in props.field)) {
return;
}

// Perform validation based on the field format
switch (props.field.format) {
case 'json':
Expand Down

0 comments on commit df53b37

Please sign in to comment.