Skip to content

Commit

Permalink
Migrate to Dask (#244)
Browse files Browse the repository at this point in the history
* use dask to parallelize document learning

* prefer threads

* remove memory actor

* remove providers actor

* remove chat provider and embeddings actors

* remove config actor

* remove router actor

* move embedding logic from base to learn actor

* move remaining actors to chat_handlers

* remove references to ray and grpcio

* implement async handlers and concurrency

* precommit

* remove compute_delayed()

* clear chat history in clear handler

* log chat handler latency

* delete useless comment

* make /generate async and concurrent

* raise Python version ceiling to 3.11

* support Dask on Python 3.11

* pre-commit fixes

* create task per message in root chat handler, fix concurrency

* log server extension init time

* remove unused code from the era of model engines

* pre-commit fixes

* bump langchain to 0.0.220

* fix recursion error when switching embedding providers

* fix pickle issue and relearning logic

* relearn on /ask if embedding model was changed

* pre-commit

* implement _acall for AI21 and Cohere providers

* pin anthropic to 0.2.10

* pre-commit

* write to self.llm_params after creating chain

* fix LearnChatHandler to not throw on empty config

* update example notebooks

* return if no embedding provider selected

* make SM Endpoints provider async

* implement async for HF Hub provider

* strip quotation marks from generated notebook titles
  • Loading branch information
dlqqq authored Jul 10, 2023
1 parent 96465d1 commit d324673
Show file tree
Hide file tree
Showing 48 changed files with 1,802 additions and 2,506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: '3.10.x'
python_version: "3.11.x"
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.10.x"
python_version: "3.11.x"
- name: Install JupyterLab
run: pip install jupyterlab~=3.6
- name: Install JS dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: '3.10.x'
python_version: "3.11.x"
- name: Prep Release
id: prep-release
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: '3.10.x'
python_version: "3.11.x"
- name: Populate Release
id: populate-release
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Documentation is available on [ReadTheDocs](https://jupyter-ai.readthedocs.io/en

You can use `conda` or `pip` to install Jupyter AI. If you're using macOS on an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.), we strongly recommend using `conda`.

Python 3.8 or newer is required; older versions of Python do not support the `typing` module we use, and as of June 30, 2023, have reached end of life. Because of Ray's incompatibility with Python 3.11, you must use Python 3.8, 3.9, or 3.10 with Jupyter AI. The instructions below presume that you are using Python 3.10.
Python 3.8 or newer is required; older versions of Python do not support the `typing` module we use, and as of June 30, 2023, have reached end of life.

Before you can use Jupyter AI, you will need to install any packages and set environment variables with API keys for the model providers that you will use. See [our documentation](https://jupyter-ai.readthedocs.io/en/latest/users/index.html) for details about what you'll need.

Expand All @@ -33,16 +33,14 @@ If you are not using JupyterLab and you only want to install the Jupyter AI `%%a

### With conda

First, install [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) and create an environment that uses Python 3.10:
First, install
[conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html)
and create an environment that uses Python 3.11:

$ conda create -n jupyter-ai python=3.10
$ conda create -n jupyter-ai python=3.11
$ conda activate jupyter-ai
$ pip install jupyter_ai

If you are using an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.), you need to uninstall the `pip` provided version of `grpcio` and install the version provided by `conda` instead.

$ pip uninstall grpcio; conda install grpcio

If you are not using JupyterLab and you only want to install the Jupyter AI `%%ai` magic, skip the `pip install jupyter_ai` step above, and instead, run:

$ pip install jupyter_ai_magics
Expand Down
9 changes: 2 additions & 7 deletions docs/source/contributors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ This page is intended for people interested in building new or modified function

## Prerequisites

You can develop Jupyter AI on any system that can run a supported Python version up to and including 3.10, including recent Windows, macOS, and Linux versions.

:::{important}
:name: python-3-11-not-supported
Because the [ray](https://pypi.org/project/ray/) library that Jupyter AI uses is not compatible with Python 3.11, please use a supported version of Python up to and including Python 3.10.
:::
You can develop Jupyter AI on any system that can run a supported Python version up to and including 3.11, including recent Windows, macOS, and Linux versions.

We highly recommend that you install [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) to start developing on Jupyter AI, especially if you are developing on macOS on an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.).

Expand All @@ -24,7 +19,7 @@ Due to a compatibility issue with Webpack, Node.js 18.15.0 does not work with Ju
After you have installed the prerequisites, create a new conda environment and activate it.

```
conda create -n jupyter-ai python=3.10
conda create -n jupyter-ai python=3.11
conda activate jupyter-ai
```

Expand Down
22 changes: 7 additions & 15 deletions docs/source/users/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ please see our {doc}`contributor's guide </contributors/index>`.

## Prerequisites

You can run Jupyter AI on any system that can run a supported Python version from 3.8 to 3.10, including recent Windows, macOS, and Linux versions.
You can run Jupyter AI on any system that can run a supported Python version from 3.8 to 3.11, including recent Windows, macOS, and Linux versions.

:::{important}
:name: python-3-11-not-supported
Because the [ray](https://pypi.org/project/ray/) library that Jupyter AI uses is not compatible with Python 3.11, please use Python 3.8 to Python 3.10, inclusive.
:::

If you use `conda`, you can install Python 3.10 in your environment by running:
If you use `conda`, you can install Python 3.11 in your environment by running:

```
conda install python=3.10
conda install python=3.11
```

To use the `jupyter_ai` package, you will also need to have a currently-maintained version of JupyterLab 3 installed. We do not yet support JupyterLab 4. If you use `conda`, you can install JupyterLab in your environment by running:
Expand Down Expand Up @@ -76,7 +71,8 @@ provider's pricing information before submitting requests via Jupyter AI.

You can use `conda` or `pip` to install Jupyter AI. If you're using macOS on an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.), we strongly recommend using `conda`.

Python 3.8 or newer is required; older versions of Python do not support the `typing` module we use, and as of June 30, 2023, have reached end of life. Because of Ray's incompatibility with Python 3.11, you must use Python 3.8, 3.9, or 3.10 with Jupyter AI. The instructions below presume that you are using Python 3.10.
Python 3.8 or newer is required; older versions of Python do not support the
`typing` module we use, and as of June 30, 2023, have reached end of life.

Before you can use Jupyter AI, you will need to install any packages and set environment variables with API keys for the model providers that you will use. See [our documentation](https://jupyter-ai.readthedocs.io/en/latest/users/index.html) for details about what you'll need.

Expand All @@ -93,16 +89,12 @@ If you are not using JupyterLab and you only want to install the Jupyter AI `%%a

### With conda

First, install [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) and create an environment that uses Python 3.10:
First, install [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) and create an environment that uses Python 3.11:

$ conda create -n jupyter-ai python=3.10
$ conda create -n jupyter-ai python=3.11
$ conda activate jupyter-ai
$ pip install jupyter_ai

If you are using an Apple Silicon-based Mac (M1, M1 Pro, M2, etc.), you need to uninstall the `pip` provided version of `grpcio` and install the version provided by `conda` instead.

$ pip uninstall grpcio; conda install grpcio

If you are not using JupyterLab and you only want to install the Jupyter AI `%%ai` magic, you can run:

$ pip install jupyter_ai_magics
Expand Down
Loading

0 comments on commit d324673

Please sign in to comment.