Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from readme not working #746

Closed
jaanli opened this issue Apr 25, 2024 · 5 comments
Closed

Example from readme not working #746

jaanli opened this issue Apr 25, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@jaanli
Copy link

jaanli commented Apr 25, 2024

Description

Hi! This is such a helpful library - thank you!

Unfortunately, cannot reproduce the Readme example: https://github.com/jupyterlab/jupyter-ai/blob/main/docs/source/_static/sample-html-math.png

Any tips on how to get this example working please? Need it for several projects I am blocked on.

Screenshot:
screenshot

Attempt at reproduction leads to this trace:

Notebook:

https://github.com/jaanli/language-model-notebooks/blob/b90f6697a26f22ca3b5bcad74fd9aab63c655a48/notebooks/getting-started.ipynb

https://colab.research.google.com/github/jaanli/language-model-notebooks/blob/b90f6697a26f22ca3b5bcad74fd9aab63c655a48/notebooks/getting-started.ipynb

Screenshot:

image
---------------------------------------------------------------------------
UsageError                                Traceback (most recent call last)
Cell In[11], line 1
----> 1 get_ipython().run_line_magic('ai', 'anthropic:claude-v1.2')

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py:2480](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py#line=2479), in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2478     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2479 with self.builtin_trap:
-> 2480     result = fn(*args, **kwargs)
   2482 # The code below prevents the output from being displayed
   2483 # when using magics with decorator @output_can_be_silenced
   2484 # when the last Python token in the expression is a ';'.
   2485 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/jupyter_ai_magics/magics.py:575](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/jupyter_ai_magics/magics.py#line=574), in AiMagics.ai(self, line, cell)
    573     args = cell_magic_parser(raw_args, prog_name="%%ai", standalone_mode=False)
    574 else:
--> 575     args = line_magic_parser(raw_args, prog_name="%ai", standalone_mode=False)
    577 if args == 0:
    578     # this happens when `--help` is called on the root command, in which
    579     # case we want to exit early.
    580     return

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py:1157](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py#line=1156), in BaseCommand.__call__(self, *args, **kwargs)
   1155 def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
   1156     """Alias for :meth:`main`."""
-> 1157     return self.main(*args, **kwargs)

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py:1078](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py#line=1077), in BaseCommand.main(self, args, prog_name, complete_var, standalone_mode, windows_expand_args, **extra)
   1076 try:
   1077     with self.make_context(prog_name, args, **extra) as ctx:
-> 1078         rv = self.invoke(ctx)
   1079         if not standalone_mode:
   1080             return rv

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py:1682](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py#line=1681), in MultiCommand.invoke(self, ctx)
   1678 if not self.chain:
   1679     # Make sure the context is entered so we do not clean up
   1680     # resources until the result processor has worked.
   1681     with ctx:
-> 1682         cmd_name, cmd, args = self.resolve_command(ctx, args)
   1683         assert cmd is not None
   1684         ctx.invoked_subcommand = cmd_name

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py:1746](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py#line=1745), in MultiCommand.resolve_command(self, ctx, args)
   1744     if split_opt(cmd_name)[0]:
   1745         self.parse_args(ctx, ctx.args)
-> 1746     ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name))
   1747 return cmd_name if cmd else None, cmd, args[1:]

File [~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py:684](http://localhost:8888/~/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages/click/core.py#line=683), in Context.fail(self, message)
    678 def fail(self, message: str) -> "te.NoReturn":
    679     """Aborts the execution of the program with a specific error
    680     message.
    681 
    682     :param message: the error message to fail with.
    683     """
--> 684     raise UsageError(message, self)

UsageError: No such command 'anthropic:claude-v1.2'.
Click to add a cell.

Reproduce

  1. Go to https://github.com/jaanli/language-model-notebooks/ and install the virtual environment
  2. Run jupyter lab notebooks/getting-started.ipynb and open the jupyter lab in a browser.
  3. Run all the cells.
  4. See error in the last cell.

Expected behavior

The readme works

Context

  • Operating System and version: macOS 14.4.1
  • Browser and version: Chrome, latest
  • JupyterLab version: 4.1.1
Troubleshoot Output
❯ jupyter troubleshoot
$PATH:
        /Users/me/jaanli/language-model-notebooks/.venv/bin
        /Users/me/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/zsh
        /Users/me/jaanli/lonboard/.venv/bin
        /opt/homebrew/opt/llvm/bin
        /Users/me/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/zsh
        /Users/me/jaanli/lonboard/.venv/bin
        /opt/homebrew/bin
        /opt/homebrew/sbin
        /usr/local/bin
        /System/Cryptexes/App/usr/bin
        /usr/bin
        /bin
        /usr/sbin
        /sbin
        /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
        /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
        /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
        /Users/me/.vscode/extensions/ms-python.python-2024.4.1/python_files/deactivate/zsh
        /Users/me/jaanli/lonboard/.venv/bin
        /opt/homebrew/opt/llvm/bin
        /opt/homebrew/Caskroom/miniconda/base/condabin
        /opt/homebrew/bin
        /opt/homebrew/sbin
        /Users/me/.cargo/bin

sys.path:
/Users/me/jaanli/language-model-notebooks/.venv/bin
/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python312.zip
/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12
/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload
/Users/me/jaanli/language-model-notebooks/.venv/lib/python3.12/site-packages

sys.executable:
/Users/me/jaanli/language-model-notebooks/.venv/bin/python3.12

sys.version:
3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]

platform.platform():
macOS-14.4.1-arm64-arm-64bit

which -a jupyter:
/Users/me/jaanli/language-model-notebooks/.venv/bin/jupyter
/Users/me/jaanli/lonboard/.venv/bin/jupyter
/Users/me/jaanli/lonboard/.venv/bin/jupyter
/opt/homebrew/bin/jupyter
/Users/me/jaanli/lonboard/.venv/bin/jupyter
/opt/homebrew/bin/jupyter

pip list:
Package Version
------------------------- --------------
aiohttp 3.9.5
aiosignal 1.3.1
aiosqlite 0.20.0
annotated-types 0.6.0
anyio 4.3.0
appnope 0.1.4
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
Babel 2.14.0
beautifulsoup4 4.12.3
bleach 6.1.0
build 1.2.1
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 3.0.0
comm 0.2.2
dask 2024.4.2
dataclasses-json 0.6.4
debugpy 1.8.1
decorator 5.1.1
deepmerge 1.1.1
defusedxml 0.7.1
distributed 2024.4.2
executing 2.0.1
faiss-cpu 1.8.0
fastjsonschema 2.19.1
fqdn 1.5.1
frozenlist 1.4.1
fsspec 2024.3.1
h11 0.14.0
httpcore 1.0.5
httpx 0.27.0
idna 3.7
importlib_metadata 7.1.0
ipykernel 6.29.4
ipython 8.23.0
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.3
json5 0.9.25
jsonpatch 1.33
jsonpath-ng 1.6.1
jsonpointer 2.4
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_ai 2.13.0
jupyter_ai_magics 2.13.0
jupyter_client 8.6.1
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.5
jupyter_server 2.14.0
jupyter_server_terminals 0.5.3
jupyterlab 4.1.6
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.1
langchain 0.1.16
langchain-community 0.0.34
langchain-core 0.1.45
langchain-text-splitters 0.0.1
langsmith 0.1.50
locket 1.0.0
MarkupSafe 2.1.5
marshmallow 3.21.1
matplotlib-inline 0.1.7
mistune 3.0.2
msgpack 1.0.8
multidict 6.0.5
mypy-extensions 1.0.0
nbclient 0.10.0
nbconvert 7.16.3
nbformat 5.10.4
nest-asyncio 1.6.0
notebook_shim 0.2.4
numpy 1.26.4
orjson 3.10.1
overrides 7.7.0
packaging 23.2
pandocfilters 1.5.1
parso 0.8.4
partd 1.4.1
pexpect 4.9.0
pip 24.0
pip-tools 7.4.1
platformdirs 4.2.1
ply 3.11
prometheus_client 0.20.0
prompt-toolkit 3.0.43
psutil 5.9.8
ptyprocess 0.7.0
pure-eval 0.2.2
pycparser 2.22
pydantic 2.7.1
pydantic_core 2.18.2
Pygments 2.17.2
pyproject_hooks 1.0.0
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
python-json-logger 2.0.7
PyYAML 6.0.1
pyzmq 26.0.2
referencing 0.35.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.0
Send2Trash 1.8.3
setuptools 69.5.1
six 1.16.0
sniffio 1.3.1
sortedcontainers 2.4.0
soupsieve 2.5
SQLAlchemy 2.0.29
stack-data 0.6.3
tblib 3.0.0
tenacity 8.2.3
terminado 0.18.1
tinycss2 1.3.0
toolz 0.12.1
tornado 6.4
traitlets 5.14.3
types-python-dateutil 2.9.0.20240316
typing_extensions 4.11.0
typing-inspect 0.9.0
uri-template 1.3.0
urllib3 2.2.1
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.8.0
wheel 0.43.0
yarl 1.9.4
zict 3.0.0
zipp 3.18.1

conda list:
# packages in environment at /opt/homebrew/Caskroom/miniconda/base:
#
# Name Version Build Channel
archspec 0.2.1 pyhd3eb1b0_0
boltons 23.0.0 py311hca03da5_0
brotli-python 1.0.9 py311h313beb8_7
bzip2 1.0.8 h620ffc9_4
c-ares 1.19.1 h80987f9_0
ca-certificates 2023.12.12 hca03da5_0
certifi 2023.11.17 py311hca03da5_0
cffi 1.16.0 py311h80987f9_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
conda 23.11.0 py311hca03da5_0
conda-content-trust 0.2.0 py311hca03da5_0
conda-libmamba-solver 23.12.0 pyhd3eb1b0_1
conda-package-handling 2.2.0 py311hca03da5_0
conda-package-streaming 0.9.0 py311hca03da5_0
cryptography 41.0.7 py311hd4332d6_0
distro 1.8.0 py311hca03da5_0
fmt 9.1.0 h48ca7d4_0
icu 73.1 h313beb8_0
idna 3.4 py311hca03da5_0
jsonpatch 1.32 pyhd3eb1b0_0
jsonpointer 2.1 pyhd3eb1b0_0
krb5 1.20.1 hf3e1bf2_1
libarchive 3.6.2 h62fee54_2
libcurl 8.4.0 h3e2b118_1
libcxx 14.0.6 h848a8c0_0
libedit 3.1.20230828 h80987f9_0
libev 4.33 h1a28f6b_1
libffi 3.4.4 hca03da5_0
libiconv 1.16 h1a28f6b_2
libmamba 1.5.3 h15e39b3_0
libmambapy 1.5.3 py311h1c5506f_0
libnghttp2 1.57.0 h62f6fdd_0
libsolv 0.7.24 h514c7bf_0
libssh2 1.10.0 h02f6b3c_2
libxml2 2.10.4 h0dcf63f_1
lz4-c 1.9.4 h313beb8_0
menuinst 2.0.1 py311hca03da5_1
ncurses 6.4 h313beb8_0
openssl 3.0.12 h1a28f6b_0
packaging 23.1 py311hca03da5_0
pcre2 10.42 hb066dcc_0
pip 23.3.1 py311hca03da5_0
platformdirs 3.10.0 py311hca03da5_0
pluggy 1.0.0 py311hca03da5_1
pybind11-abi 4 hd3eb1b0_1
pycosat 0.6.6 py311h80987f9_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 23.2.0 py311hca03da5_0
pysocks 1.7.1 py311hca03da5_0
python 3.11.5 hb885b13_0
python.app 3 py311h80987f9_0
readline 8.2 h1a28f6b_0
reproc 14.2.4 hc377ac9_1
reproc-cpp 14.2.4 hc377ac9_1
requests 2.31.0 py311hca03da5_0
ruamel.yaml 0.17.21 py311h80987f9_0
setuptools 68.2.2 py311hca03da5_0
sqlite 3.41.2 h80987f9_0
tk 8.6.12 hb8d0fd4_0
tqdm 4.65.0 py311hb6e6a13_0
truststore 0.8.0 py311hca03da5_0
tzdata 2023c h04d1e81_0
urllib3 1.26.18 py311hca03da5_0
wheel 0.41.2 py311hca03da5_0
xz 5.4.5 h80987f9_0
yaml-cpp 0.8.0 h313beb8_0
zlib 1.2.13 h5a0b063_0
zstandard 0.19.0 py311h80987f9_0
zstd 1.5.5 hd90d995_0

conda env:
name: base
channels:
- defaults
dependencies:
- archspec=0.2.1=pyhd3eb1b0_0
- boltons=23.0.0=py311hca03da5_0
- brotli-python=1.0.9=py311h313beb8_7
- bzip2=1.0.8=h620ffc9_4
- c-ares=1.19.1=h80987f9_0
- ca-certificates=2023.12.12=hca03da5_0
- certifi=2023.11.17=py311hca03da5_0
- cffi=1.16.0=py311h80987f9_0
- charset-normalizer=2.0.4=pyhd3eb1b0_0
- conda=23.11.0=py311hca03da5_0
- conda-content-trust=0.2.0=py311hca03da5_0
- conda-libmamba-solver=23.12.0=pyhd3eb1b0_1
- conda-package-handling=2.2.0=py311hca03da5_0
- conda-package-streaming=0.9.0=py311hca03da5_0
- cryptography=41.0.7=py311hd4332d6_0
- distro=1.8.0=py311hca03da5_0
- fmt=9.1.0=h48ca7d4_0
- icu=73.1=h313beb8_0
- idna=3.4=py311hca03da5_0
- jsonpatch=1.32=pyhd3eb1b0_0
- jsonpointer=2.1=pyhd3eb1b0_0
- krb5=1.20.1=hf3e1bf2_1
- libarchive=3.6.2=h62fee54_2
- libcurl=8.4.0=h3e2b118_1
- libcxx=14.0.6=h848a8c0_0
- libedit=3.1.20230828=h80987f9_0
- libev=4.33=h1a28f6b_1
- libffi=3.4.4=hca03da5_0
- libiconv=1.16=h1a28f6b_2
- libmamba=1.5.3=h15e39b3_0
- libmambapy=1.5.3=py311h1c5506f_0
- libnghttp2=1.57.0=h62f6fdd_0
- libsolv=0.7.24=h514c7bf_0
- libssh2=1.10.0=h02f6b3c_2
- libxml2=2.10.4=h0dcf63f_1
- lz4-c=1.9.4=h313beb8_0
- menuinst=2.0.1=py311hca03da5_1
- ncurses=6.4=h313beb8_0
- openssl=3.0.12=h1a28f6b_0
- packaging=23.1=py311hca03da5_0
- pcre2=10.42=hb066dcc_0
- pip=23.3.1=py311hca03da5_0
- platformdirs=3.10.0=py311hca03da5_0
- pluggy=1.0.0=py311hca03da5_1
- pybind11-abi=4=hd3eb1b0_1
- pycosat=0.6.6=py311h80987f9_0
- pycparser=2.21=pyhd3eb1b0_0
- pyopenssl=23.2.0=py311hca03da5_0
- pysocks=1.7.1=py311hca03da5_0
- python=3.11.5=hb885b13_0
- python.app=3=py311h80987f9_0
- readline=8.2=h1a28f6b_0
- reproc=14.2.4=hc377ac9_1
- reproc-cpp=14.2.4=hc377ac9_1
- requests=2.31.0=py311hca03da5_0
- ruamel.yaml=0.17.21=py311h80987f9_0
- setuptools=68.2.2=py311hca03da5_0
- sqlite=3.41.2=h80987f9_0
- tk=8.6.12=hb8d0fd4_0
- tqdm=4.65.0=py311hb6e6a13_0
- truststore=0.8.0=py311hca03da5_0
- tzdata=2023c=h04d1e81_0
- urllib3=1.26.18=py311hca03da5_0
- wheel=0.41.2=py311hca03da5_0
- xz=5.4.5=h80987f9_0
- yaml-cpp=0.8.0=h313beb8_0
- zlib=1.2.13=h5a0b063_0
- zstandard=0.19.0=py311h80987f9_0
- zstd=1.5.5=hd90d995_0
prefix: /opt/homebrew/Caskroom/miniconda/base

Command Line Output
               "reportMissingTypeStubs": {
                  "default": "none",
                  "description": "Diagnostics for imports that have no corresponding type stub file (either a typeshed file or a custom type stub). The type checker requires type stubs to do its best job at analysis.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportNoOverloadImplementation": {
                  "default": "error",
                  "description": "Diagnostics for an overloaded function or method with a missing implementation.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOperatorIssue": {
                  "default": "error",
                  "description": "Diagnostics for related to unary or binary operators.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalCall": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to call a variable with an Optional type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalContextManager": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to use an Optional type as a context manager (as a parameter to a with statement).",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalIterable": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to use an Optional type as an iterable value (e.g. within a for statement).",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalMemberAccess": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to access a member of a variable with an Optional type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalOperand": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to use an Optional type as an operand to a binary or unary operator (like '+', '==', 'or', 'not').",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOptionalSubscript": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to subscript (index) a variable with an Optional type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportOverlappingOverload": {
                  "default": "none",
                  "description": "Diagnostics for function overloads that overlap in signature and obscure each other or have incompatible return types.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportPossiblyUnboundVariable": {
                  "default": "error",
                  "description": "Diagnostics for the use of variables that may be unbound on some code paths.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportPrivateImportUsage": {
                  "default": "error",
                  "description": "Diagnostics for incorrect usage of symbol imported from a \"py.typed\" module that is not re-exported from that module.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportPrivateUsage": {
                  "default": "none",
                  "description": "Diagnostics for incorrect usage of private or protected variables or functions. Protected class members begin with a single underscore _ and can be accessed only by subclasses. Private class members begin with a double underscore but do not end in a double underscore and can be accessed only within the declaring class. Variables and functions declared outside of a class are considered private if their names start with either a single or double underscore, and they cannot be accessed outside of the declaring module.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportPropertyTypeMismatch": {
                  "default": "none",
                  "description": "Diagnostics for property whose setter and getter have mismatched types.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportRedeclaration": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to declare the type of a symbol multiple times.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportReturnType": {
                  "default": "error",
                  "description": "Diagnostics related to function return type compatibility.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportSelfClsParameterName": {
                  "default": "warning",
                  "description": "Diagnostics for a missing or misnamed \u201cself\u201d parameter in instance methods and \u201ccls\u201d parameter in class methods. Instance methods in metaclasses (classes that derive from \u201ctype\u201d) are allowed to use \u201ccls\u201d for instance methods.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportShadowedImports": {
                  "default": "none",
                  "description": "Diagnostics for files that are overriding a module in the stdlib.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportTypeCommentUsage": {
                  "default": "none",
                  "description": "Diagnostics for usage of deprecated type comments.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportTypedDictNotRequiredAccess": {
                  "default": "error",
                  "description": "Diagnostics for an attempt to access a non-required key within a TypedDict without a check for its presence.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnboundVariable": {
                  "default": "error",
                  "description": "Diagnostics for unbound and possibly unbound variables.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUndefinedVariable": {
                  "default": "error",
                  "description": "Diagnostics for undefined variables.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUninitializedInstanceVariable": {
                  "default": "none",
                  "description": "Diagnostics for instance variables that are not declared or initialized within class body or `__init__` method.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnknownArgumentType": {
                  "default": "none",
                  "description": "Diagnostics for call arguments for functions or methods that have an unknown type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnknownLambdaType": {
                  "default": "none",
                  "description": "Diagnostics for input or return parameters for lambdas that have an unknown type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnknownMemberType": {
                  "default": "none",
                  "description": "Diagnostics for class or instance variables that have an unknown type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnknownParameterType": {
                  "default": "none",
                  "description": "Diagnostics for input or return parameters for functions or methods that have an unknown type.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnknownVariableType": {
                  "default": "none",
                  "description": "Diagnostics for variables that have an unknown type..",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnnecessaryCast": {
                  "default": "none",
                  "description": "Diagnostics for 'cast' calls that are statically determined to be unnecessary. Such calls are sometimes indicative of a programming error.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnnecessaryComparison": {
                  "default": "none",
                  "description": "Diagnostics for '==' and '!=' comparisons that are statically determined to be unnecessary. Such calls are sometimes indicative of a programming error.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnnecessaryContains": {
                  "default": "none",
                  "description": "Diagnostics for 'in' operation that is statically determined to be unnecessary. Such operations are sometimes indicative of a programming error.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnnecessaryIsInstance": {
                  "default": "none",
                  "description": "Diagnostics for 'isinstance' or 'issubclass' calls where the result is statically determined to be always true. Such calls are often indicative of a programming error.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnnecessaryTypeIgnoreComment": {
                  "default": "none",
                  "description": "Diagnostics for '# type: ignore' comments that have no effect.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnsupportedDunderAll": {
                  "default": "warning",
                  "description": "Diagnostics for unsupported operations performed on __all__.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUntypedBaseClass": {
                  "default": "none",
                  "description": "Diagnostics for base classes whose type cannot be determined statically. These obscure the class type, defeating many type analysis features.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUntypedClassDecorator": {
                  "default": "none",
                  "description": "Diagnostics for class decorators that have no type annotations. These obscure the class type, defeating many type analysis features.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUntypedFunctionDecorator": {
                  "default": "none",
                  "description": "Diagnostics for function decorators that have no type annotations. These obscure the function type, defeating many type analysis features.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUntypedNamedTuple": {
                  "default": "none",
                  "description": "Diagnostics when \u201cnamedtuple\u201d is used rather than \u201cNamedTuple\u201d. The former contains no type information, whereas the latter does.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedCallResult": {
                  "default": "none",
                  "description": "Diagnostics for call expressions whose results are not consumed and are not None.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedClass": {
                  "default": "none",
                  "description": "Diagnostics for a class with a private name (starting with an underscore) that is not accessed.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedCoroutine": {
                  "default": "error",
                  "description": "Diagnostics for call expressions that return a Coroutine and whose results are not consumed.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedExcept": {
                  "default": "error",
                  "description": "Diagnostics for unreachable except clause.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedExpression": {
                  "default": "warning",
                  "description": "Diagnostics for simple expressions whose value is not used in any way.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedFunction": {
                  "default": "none",
                  "description": "Diagnostics for a function or method with a private name (starting with an underscore) that is not accessed.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedImport": {
                  "default": "none",
                  "description": "Diagnostics for an imported symbol that is not referenced within that file.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportUnusedVariable": {
                  "default": "none",
                  "description": "Diagnostics for a variable that is not accessed.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                "reportWildcardImportFromLibrary": {
                  "default": "warning",
                  "description": "Diagnostics for an wildcard import from an external library.",
                  "enum": [
                    "none",
                    "information",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                }
              },
              "scope": "resource",
              "type": "object"
            },
            "python.analysis.extraPaths": {
              "default": [],
              "description": "Additional import search resolution paths",
              "items": {
                "type": "string"
              },
              "scope": "resource",
              "type": "array"
            },
            "python.analysis.logLevel": {
              "default": "Information",
              "description": "Specifies the level of logging for the Output panel",
              "enum": [
                "Error",
                "Warning",
                "Information",
                "Trace"
              ],
              "type": "string"
            },
            "python.analysis.stubPath": {
              "default": "typings",
              "description": "Path to directory containing custom type stub files.",
              "scope": "resource",
              "type": "string"
            },
            "python.analysis.typeCheckingMode": {
              "default": "basic",
              "description": "Defines the default rule set for type checking.",
              "enum": [
                "off",
                "basic",
                "strict"
              ],
              "scope": "resource",
              "type": "string"
            },
            "python.analysis.typeshedPaths": {
              "default": [],
              "description": "Paths to look for typeshed modules.",
              "items": {
                "type": "string"
              },
              "scope": "resource",
              "type": "array"
            },
            "python.analysis.useLibraryCodeForTypes": {
              "default": false,
              "description": "Use library implementations to extract type information when type stub is not present.",
              "scope": "resource",
              "type": "boolean"
            },
            "python.pythonPath": {
              "default": "python",
              "description": "Path to Python, you can use a custom version of Python.",
              "scope": "resource",
              "type": "string"
            },
            "python.venvPath": {
              "default": "",
              "description": "Path to folder with a list of Virtual Environments.",
              "scope": "resource",
              "type": "string"
            }
          },
          "title": "Pyright Language Server Configuration",
          "type": "object"
        },
        "display_name": "pyright",
        "install": {
          "jlpm": "jlpm add --dev pyright",
          "npm": "npm install --save-dev pyright",
          "yarn": "yarn add --dev pyright"
        },
        "languages": [
          "python"
        ],
        "mime_types": [
          "text/python",
          "text/x-ipython"
        ],
        "requires_documents_on_disk": false,
        "troubleshoot": "Node.js is required to install this server.",
        "urls": {
          "home": "https://github.com/microsoft/pyright",
          "issues": "https://github.com/microsoft/pyright/issues"
        },
        "version": 2
      }
    }
@jaanli jaanli added the bug Something isn't working label Apr 25, 2024
@jaanli jaanli changed the title Example from Readme not working Example from readme not working Apr 25, 2024
@JasonWeill
Copy link
Collaborator

@jaanli Thanks for reaching out to us! It looks like you're running a line magic, starting with one percent sign (%ai). To run an AI prompt, use a cell magic, starting with two percent signs (%%ai):

%%ai anthropic:claude-v1.2 -f html
Create a square using SVG with a black border and white fill.

I ran the prompt above in a new notebook with a newer version of the code than was used to create the sample notebooks. I got an HTML square, albeit with a warning about an obsolete module (see #394).

image

Are you able to run the cell magic commands with the Anthropic model provider?

jaanli added a commit to onefact/language-model-notebooks that referenced this issue Apr 25, 2024
@jaanli
Copy link
Author

jaanli commented Apr 26, 2024

Thanks so much @JasonWeill ! Yep, that's my bad on incorrectly transcribing the command from the screenshot -- appreciate you catching that.

Updated:

https://github.com/jaanli/language-model-notebooks/blob/f38a3db2c51aa582315712f514663b0c06ecc628/notebooks/getting-started.ipynb

Now I am getting a more informative error:

Cannot determine model provider from model ID anthropic:claude-v1.2.

@JasonWeill
Copy link
Collaborator

Make sure you have the langchain-anthropic package installed, as documented here: https://jupyter-ai.readthedocs.io/en/latest/users/index.html#model-providers

jaanli added a commit to onefact/language-model-notebooks that referenced this issue Apr 26, 2024
@jaanli
Copy link
Author

jaanli commented Apr 26, 2024

Yes! That works, thank you so much @JasonWeill !! Really excited to have gotten this working :)

I guess it would be nice if the Readme used examples that were self-contained to help people get started with more of a WYSIWYG feel from the screenshot?

I couldn't find the langchain requirement in the readme - https://github.com/jupyterlab/jupyter-ai

Result (I guess there's still a warning):

image

Will save a lot of time in debugging the dashboards I've been making, thank you 🙏 such as https://jaanli.github.io/new-york-real-estate/

@jaanli jaanli closed this as completed Apr 26, 2024
jaanli added a commit to onefact/language-model-notebooks that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants