Name | jupyter-ai-agents JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2025-02-23 08:50:20 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | BSD 3-Clause License Copyright (c) 2024, Datalayer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --- This library reuse part of Jupyter Server code licensed under BSD 3-Clause License Source: https://github.com/jupyter-server/jupyter_server/blame/v2.12.0/jupyter_server/services/kernels/connection/base.py This library reuse part of traitlets code licensed under BSD 3-Clause License Source: https://github.com/ipython/traitlets/blob/v5.14.3/traitlets/log.py |
keywords |
jupyter
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<!--
~ Copyright (c) 2023-2024 Datalayer, Inc.
~
~ BSD 3-Clause License
-->
[](https://datalayer.io)
[](https://github.com/sponsors/datalayer)
# 🪐 ✨ Jupyter AI Agents
[](https://github.com/datalayer/jupyter-ai-agents/actions/workflows/build.yml)
[](https://pypi.org/project/jupyter-ai-agents)
*The Jupyter AI Agents are equipped with tools like 'execute', 'insert_cell', and more, to transform your Jupyter Notebooks into an intelligent, interactive workspace!*

```
Jupyter AI Agents <-----------> JupyterLab
|
| (RTC Real Time Collaboration)
|
JNC + JKC
- JNC https://github.com/datalayer/jupyter-nbmodel-client
- JKC https://github.com/datalayer/jupyter-kernel-client
```
Jupyter AI Agents empowers **AI** models to **interact** with and **modify Jupyter Notebooks**. The agent is equipped with tools such as adding code cells, inserting markdown cells, executing code, enabling it to modify the notebook comprehensively based on user instructions or by reacting to notebook and kernel events.
This agent is **innovative** as it is designed to **operate on the entire notebook**, not just at the cell level, enabling more comprehensive and seamless modifications.
This powerful functionality is made possible through [jupyter-nbmodel-client](https://github.com/datalayer/jupyter-nbmodel-client) and [jupyter-kernel-client](https://github.com/datalayer/jupyter-kernel-client), enabling interaction with Jupyter Notebooks and Kernels.
[LangChain Agent Framework](https://python.langchain.com/v0.1/docs/modules/agents/how_to/custom_agent/) is used to manage the interactions between the AI model and the tools.
> [!WARNING]
>
> jupyter-nbmodel-client and jupyter-kernel-client are experimental and under active development.
> Unexpected behavior may occur, due to potential issue generated by 3rd party projects.
## Usage
This library is documented on https://jupyter-ai-agents.datalayer.tech.
## Install
To install Jupyter AI Agents, run the following command.
```bash
pip install jupyter_ai_agents
```
Or clone this repository and install it from source.
```bash
git clone https://github.com/datalayer/jupyter-ai-agents
cd jupyter-ai-agents
pip install -e .
```
The Jupyter AI Agents can directly interact with JupyterLab. The modifications made by the Jupyter AI Agents can be seen in real-time thanks to [Jupyter Real Time Collaboration](https://jupyterlab.readthedocs.io/en/stable/user/rtc.html). Make sure you have JupyterLab installed with the Collaboration extension.
```bash
pip install jupyterlab jupyter-collaboration ipykernel
```
We ask you to take additional actions to overcome limitations and bugs of the pycrdt library.
```bash
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt
```
## AI Agent CLI
We put here a quick example for a Out-Kernel Stateless Agent via CLI helping your JupyterLab session.
Start JupyterLab, setting a `port` and a `token` to be reused by the agent, and create a notebook `test.ipynb`.
```bash
jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN
```
You can also start JupyterLab with the following command.
```bash
make jupyterlab
```
Jupyter AI Agents supports multiple AI model providers (more information can be found on [this documentation page](https://jupyter-ai-agents.datalayer.tech/docs/models)).
The following takes you through an example with the Azure OpenAI provider.
Read the [Azure Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai) to get the needed credentials and make sure you define them in the following `.env` file.
```bash
cat << EOF >>.env
OPENAI_API_VERSION="..."
AZURE_OPENAI_ENDPOINT="..."
AZURE_OPENAI_API_KEY="..."
EOF
```
**Prompt Agent**
To use the Jupyter AI Agents, an easy way is to launch a CLI (update the Azure deployment name based on your setup).
```bash
# Prompt agent example.
jupyter-ai-agents prompt \
--url http://localhost:8888 \
--token MY_TOKEN \
--model-provider azure-openai \
--model-name gpt-4o-mini \
--path test.ipynb \
--input "Create a matplotlib example"
```
You can also start prompt with the following command.
```bash
make prompt
```

**Explain Error Agent**
```bash
# Explain Error agent example.
jupyter-ai-agents explain-error \
--url http://localhost:8888 \
--token MY_TOKEN \
--model-provider azure-openai \
--model-name gpt-4o-mini \
--path test.ipynb
```
You can also start request the error explanation with the following command.
```bash
make explain-error
```

## Uninstall
To uninstall the agent, execute.
```bash
pip uninstall jupyter_ai_agents
```
## Contributing
### Development install
```bash
# Clone the repo to your local environment
# Change directory to the jupyter_ai_agents directory
# Install package in development mode - will automatically enable
# The server extension.
pip install -e ".[test,lint,typing]"
```
### Running Tests
Install dependencies:
```bash
pip install -e ".[test]"
```
To run the python tests, use:
```bash
pytest
```
### Development uninstall
```bash
pip uninstall jupyter_ai_agents
```
### Packaging the library
See [RELEASE](RELEASE.md)
Raw data
{
"_id": null,
"home_page": null,
"name": "jupyter-ai-agents",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Jupyter",
"author": null,
"author_email": "Datalayer <info@datalayer.io>",
"download_url": null,
"platform": null,
"description": "<!--\n ~ Copyright (c) 2023-2024 Datalayer, Inc.\n ~\n ~ BSD 3-Clause License\n-->\n\n[](https://datalayer.io)\n\n[](https://github.com/sponsors/datalayer)\n\n# \ud83e\ude90 \u2728 Jupyter AI Agents\n\n[](https://github.com/datalayer/jupyter-ai-agents/actions/workflows/build.yml)\n[](https://pypi.org/project/jupyter-ai-agents)\n\n*The Jupyter AI Agents are equipped with tools like 'execute', 'insert_cell', and more, to transform your Jupyter Notebooks into an intelligent, interactive workspace!*\n\n\n\n```\nJupyter AI Agents <-----------> JupyterLab\n |\n | (RTC Real Time Collaboration)\n |\nJNC + JKC\n\n- JNC https://github.com/datalayer/jupyter-nbmodel-client\n- JKC https://github.com/datalayer/jupyter-kernel-client\n```\n\nJupyter AI Agents empowers **AI** models to **interact** with and **modify Jupyter Notebooks**. The agent is equipped with tools such as adding code cells, inserting markdown cells, executing code, enabling it to modify the notebook comprehensively based on user instructions or by reacting to notebook and kernel events.\n\nThis agent is **innovative** as it is designed to **operate on the entire notebook**, not just at the cell level, enabling more comprehensive and seamless modifications.\n\nThis powerful functionality is made possible through [jupyter-nbmodel-client](https://github.com/datalayer/jupyter-nbmodel-client) and [jupyter-kernel-client](https://github.com/datalayer/jupyter-kernel-client), enabling interaction with Jupyter Notebooks and Kernels.\n\n[LangChain Agent Framework](https://python.langchain.com/v0.1/docs/modules/agents/how_to/custom_agent/) is used to manage the interactions between the AI model and the tools.\n\n> [!WARNING] \n>\n> jupyter-nbmodel-client and jupyter-kernel-client are experimental and under active development.\n> Unexpected behavior may occur, due to potential issue generated by 3rd party projects.\n\n## Usage\n\nThis library is documented on https://jupyter-ai-agents.datalayer.tech.\n\n## Install\n\nTo install Jupyter AI Agents, run the following command.\n\n```bash\npip install jupyter_ai_agents\n```\n\nOr clone this repository and install it from source.\n\n```bash\ngit clone https://github.com/datalayer/jupyter-ai-agents\ncd jupyter-ai-agents\npip install -e .\n```\n\nThe Jupyter AI Agents can directly interact with JupyterLab. The modifications made by the Jupyter AI Agents can be seen in real-time thanks to [Jupyter Real Time Collaboration](https://jupyterlab.readthedocs.io/en/stable/user/rtc.html). Make sure you have JupyterLab installed with the Collaboration extension.\n\n```bash\npip install jupyterlab jupyter-collaboration ipykernel\n```\n\nWe ask you to take additional actions to overcome limitations and bugs of the pycrdt library.\n\n```bash\npip uninstall -y pycrdt datalayer_pycrdt\npip install datalayer_pycrdt\n```\n\n## AI Agent CLI\n\nWe put here a quick example for a Out-Kernel Stateless Agent via CLI helping your JupyterLab session.\n\nStart JupyterLab, setting a `port` and a `token` to be reused by the agent, and create a notebook `test.ipynb`.\n\n```bash\njupyter lab --port 8888 --IdentityProvider.token MY_TOKEN\n```\n\nYou can also start JupyterLab with the following command.\n\n```bash\nmake jupyterlab\n```\n\nJupyter AI Agents supports multiple AI model providers (more information can be found on [this documentation page](https://jupyter-ai-agents.datalayer.tech/docs/models)).\n\nThe following takes you through an example with the Azure OpenAI provider.\n\nRead the [Azure Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai) to get the needed credentials and make sure you define them in the following `.env` file.\n\n```bash\ncat << EOF >>.env\nOPENAI_API_VERSION=\"...\"\nAZURE_OPENAI_ENDPOINT=\"...\"\nAZURE_OPENAI_API_KEY=\"...\"\nEOF\n```\n\n**Prompt Agent**\n\nTo use the Jupyter AI Agents, an easy way is to launch a CLI (update the Azure deployment name based on your setup).\n\n```bash\n# Prompt agent example.\njupyter-ai-agents prompt \\\n --url http://localhost:8888 \\\n --token MY_TOKEN \\\n --model-provider azure-openai \\\n --model-name gpt-4o-mini \\\n --path test.ipynb \\\n --input \"Create a matplotlib example\"\n```\n\nYou can also start prompt with the following command.\n\n```bash\nmake prompt\n```\n\n\n\n**Explain Error Agent**\n\n```bash\n# Explain Error agent example.\njupyter-ai-agents explain-error \\\n --url http://localhost:8888 \\\n --token MY_TOKEN \\\n --model-provider azure-openai \\\n --model-name gpt-4o-mini \\\n --path test.ipynb\n```\n\nYou can also start request the error explanation with the following command.\n\n```bash\nmake explain-error\n```\n\n\n\n## Uninstall\n\nTo uninstall the agent, execute.\n\n```bash\npip uninstall jupyter_ai_agents\n```\n\n## Contributing\n\n### Development install\n\n```bash\n# Clone the repo to your local environment\n# Change directory to the jupyter_ai_agents directory\n# Install package in development mode - will automatically enable\n# The server extension.\npip install -e \".[test,lint,typing]\"\n```\n\n### Running Tests\n\nInstall dependencies:\n\n```bash\npip install -e \".[test]\"\n```\n\nTo run the python tests, use:\n\n```bash\npytest\n```\n\n### Development uninstall\n\n```bash\npip uninstall jupyter_ai_agents\n```\n\n### Packaging the library\n\nSee [RELEASE](RELEASE.md)",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2024, Datalayer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --- This library reuse part of Jupyter Server code licensed under BSD 3-Clause License Source: https://github.com/jupyter-server/jupyter_server/blame/v2.12.0/jupyter_server/services/kernels/connection/base.py This library reuse part of traitlets code licensed under BSD 3-Clause License Source: https://github.com/ipython/traitlets/blob/v5.14.3/traitlets/log.py",
"summary": null,
"version": "0.5.0",
"project_urls": {
"Home": "https://github.com/datalayer/jupyter-ai-agents"
},
"split_keywords": [
"jupyter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "75e4831a853e3a8cf88bad1d08d1b872ddf7e2b4d2ccdd44df4fc8d36d5769c0",
"md5": "bac29008ebaf49f10bdcd5eccf01e47b",
"sha256": "981e6783b196298e5ca9a8e5d38825e06a3cff76579b7516dc4d93304ddd925e"
},
"downloads": -1,
"filename": "jupyter_ai_agents-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bac29008ebaf49f10bdcd5eccf01e47b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 19654,
"upload_time": "2025-02-23T08:50:20",
"upload_time_iso_8601": "2025-02-23T08:50:20.045852Z",
"url": "https://files.pythonhosted.org/packages/75/e4/831a853e3a8cf88bad1d08d1b872ddf7e2b4d2ccdd44df4fc8d36d5769c0/jupyter_ai_agents-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-23 08:50:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "datalayer",
"github_project": "jupyter-ai-agents",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "jupyter-ai-agents"
}