{
"cells": [
{
"cell_type": "markdown",
"id": "99589ed4-2bbf-4f5f-bea1-d537860e33a0",
"metadata": {
"id": "fwukZZnNTYWE"
},
"source": [
"\n",
"\n",
"Jupyter has been extended with the [Jupyter AI](https://jupyter-ai.readthedocs.io/en/latest/index.html) library which adds:\n",
"- A conversational assistant (Jupyternaut)\n",
"- Generative AI capabilities within Jupyter notebooks in all applications\n",
"- Support for a wide range of generative model providers and models (AI21, Anthropic, Cohere, Gemini, Hugging Face, MistralAI, OpenAI, SageMaker, NVIDIA, etc. and many more local models via Ollama).\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"id": "20da1a3e-92f8-4846-ba41-bc7bf8ef09d5",
"metadata": {},
"source": [
"### Getting Started with Jupyter AI"
]
},
{
"cell_type": "markdown",
"id": "e3dbab2f-a86f-4aa9-9945-d5ddfd2f4427",
"metadata": {},
"source": [
"If you haven't done so already, you should [install Jupyter AI](https://jupyter-ai.readthedocs.io/en/latest/users/index.html#installation), the preferred method is using `pip`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "08d74766-1823-41df-b8a7-a60d6d27221e",
"metadata": {},
"outputs": [],
"source": [
"# install \n",
"!pip install jupyter-ai"
]
},
{
"cell_type": "markdown",
"id": "1cb2b828-0d17-48ed-9730-c4a67afb3fa8",
"metadata": {},
"source": [
"First, we reload the `jupyter_ai` extension, as per the documentation:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "55aac8ba-19b4-4c7b-9ece-b935cbb58e1e",
"metadata": {},
"outputs": [],
"source": [
"%reload_ext jupyter_ai"
]
},
{
"cell_type": "markdown",
"id": "18541559-9e0a-400c-92b2-1749a3e1dc8d",
"metadata": {},
"source": [
"You can list all model providers by using `%ai list`:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f189596d-9f12-4b07-a64e-596fea7668a1",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"| Provider | Environment variable | Set? | Models |\n",
"|----------|----------------------|------|--------|\n",
"| `ai21` | `AI21_API_KEY` | ❌ |
Copyright NLP from scratch, 2024. | \n", "![]() | \n",
"
---|