From e9c8662931b8172938247f91633442001f18c97b Mon Sep 17 00:00:00 2001 From: jaanli Date: Thu, 25 Apr 2024 18:11:21 -0600 Subject: [PATCH] wip: debug and fix thanks to @JasonWeill in https://github.com/jupyterlab/jupyter-ai/issues/746 --- notebooks/getting-started.ipynb | 56 ++++++++++++++++----------------- requirements.in | 3 +- requirements.txt | 39 ++++++++++++++++++++--- 3 files changed, 65 insertions(+), 33 deletions(-) diff --git a/notebooks/getting-started.ipynb b/notebooks/getting-started.ipynb index afd6752..f36ded6 100644 --- a/notebooks/getting-started.ipynb +++ b/notebooks/getting-started.ipynb @@ -31,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "18fbede1-a82a-4929-938e-25cf18d160f7", "metadata": {}, "outputs": [], @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "945fb6ae-e03c-4670-8210-cae493757ee6", "metadata": {}, "outputs": [], @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "42d67f40-462b-43ba-a63f-fdd9e126a423", "metadata": {}, "outputs": [], @@ -85,45 +85,45 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "9ae14480-b195-4686-9c80-70654bccfd24", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/me/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/langchain_anthropic/llms.py:164: UserWarning: This Anthropic LLM is deprecated. Please use `from langchain_anthropic import ChatAnthropic` instead\n", + " warnings.warn(\n" + ] + }, { "data": { - "text/markdown": [ - "Cannot determine model provider from model ID `anthropic:claude-v1.2`.\n", - "\n", - "To see a list of models you can use, run `%ai list`\n", - "\n", - "If you were trying to run a command, run `%ai help` to see a list of commands." + "text/html": [ + " \n", + " \n", + "" ], "text/plain": [ - "Cannot determine model provider from model ID 'anthropic:claude-v1.2'.\n", - "\n", - "To see a list of models you can use, run '%ai list'\n", - "\n", - "If you were trying to run a command, run '%ai help' to see a list of commands." + "" ] }, - "execution_count": 8, - "metadata": {}, + "execution_count": 7, + "metadata": { + "text/html": { + "jupyter_ai": { + "model_id": "claude-v1.2", + "provider_id": "anthropic" + } + } + }, "output_type": "execute_result" } ], "source": [ - "%%ai anthropic:claude-v1.2\n", - "\n", - "Test" + "%%ai anthropic:claude-v1.2 -f html\n", + "Create a square using SVG with a black border and white fill." ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8e36a7e9-edfd-4379-b8f8-0bd6654b0d3c", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/requirements.in b/requirements.in index 0d0457e..c552650 100644 --- a/requirements.in +++ b/requirements.in @@ -1,3 +1,4 @@ jupyter-ai jupyterlab -python-dotenv \ No newline at end of file +python-dotenv +langchain-anthropic \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 134d75d..3ad52fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile @@ -14,8 +14,11 @@ aiosqlite==0.20.0 # via jupyter-ai annotated-types==0.6.0 # via pydantic +anthropic==0.25.6 + # via langchain-anthropic anyio==4.3.0 # via + # anthropic # httpx # jupyter-server appnope==0.1.4 @@ -76,15 +79,21 @@ decorator==5.1.1 deepmerge==1.1.1 # via jupyter-ai defusedxml==0.7.1 - # via nbconvert + # via + # langchain-anthropic + # nbconvert distributed==2024.4.2 # via dask +distro==1.9.0 + # via anthropic executing==2.0.1 # via stack-data faiss-cpu==1.8.0 # via jupyter-ai fastjsonschema==2.19.1 # via nbformat +filelock==3.13.4 + # via huggingface-hub fqdn==1.5.1 # via jsonschema frozenlist==1.4.1 @@ -92,13 +101,19 @@ frozenlist==1.4.1 # aiohttp # aiosignal fsspec==2024.3.1 - # via dask + # via + # dask + # huggingface-hub h11==0.14.0 # via httpcore httpcore==1.0.5 # via httpx httpx==0.27.0 - # via jupyterlab + # via + # anthropic + # jupyterlab +huggingface-hub==0.22.2 + # via tokenizers idna==3.7 # via # anyio @@ -108,6 +123,7 @@ idna==3.7 # yarl importlib-metadata==7.1.0 # via + # dask # jupyter-ai # jupyter-ai-magics ipykernel==6.29.4 @@ -187,11 +203,14 @@ jupyterlab-server==2.27.1 # via jupyterlab langchain==0.1.16 # via jupyter-ai-magics +langchain-anthropic==0.1.11 + # via -r requirements.in langchain-community==0.0.34 # via langchain langchain-core==0.1.45 # via # langchain + # langchain-anthropic # langchain-community # langchain-text-splitters langchain-text-splitters==0.0.1 @@ -251,6 +270,7 @@ packaging==23.2 # via # dask # distributed + # huggingface-hub # ipykernel # jupyter-server # jupyterlab @@ -288,6 +308,7 @@ pycparser==2.22 # via cffi pydantic==2.7.1 # via + # anthropic # langchain # langchain-core # langsmith @@ -309,6 +330,7 @@ pyyaml==6.0.1 # via # dask # distributed + # huggingface-hub # jupyter-events # langchain # langchain-community @@ -325,6 +347,7 @@ referencing==0.35.0 # jupyter-events requests==2.31.0 # via + # huggingface-hub # jupyterlab-server # langchain # langchain-community @@ -351,6 +374,7 @@ six==1.16.0 # rfc3339-validator sniffio==1.3.1 # via + # anthropic # anyio # httpx sortedcontainers==2.4.0 @@ -376,6 +400,8 @@ terminado==0.18.1 # jupyter-server-terminals tinycss2==1.3.0 # via nbconvert +tokenizers==0.19.1 + # via anthropic toolz==0.12.1 # via # dask @@ -389,6 +415,8 @@ tornado==6.4 # jupyter-server # jupyterlab # terminado +tqdm==4.66.2 + # via huggingface-hub traitlets==5.14.3 # via # comm @@ -409,6 +437,9 @@ types-python-dateutil==2.9.0.20240316 typing-extensions==4.11.0 # via # aiosqlite + # anthropic + # huggingface-hub + # ipython # jupyter-ai # jupyter-ai-magics # pydantic