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

Merge from JupyterAI v2_28_3 #4

Merged
merged 119 commits into from
Dec 18, 2024
Merged

Merge from JupyterAI v2_28_3 #4

merged 119 commits into from
Dec 18, 2024

Conversation

cl-gavan
Copy link
Collaborator

Tested locally and verified that Bedrock models and AI Inference models work. Commented out some provider imports to reduce the required dependencies to be installed.

krassowski and others added 30 commits July 8, 2024 08:41
* Fix incorrect plugin ID

* Update plugin ID for inline completions
* Limit the number of displayed rows in chat input to 20

* affix send button to bottom of chat input

---------

Co-authored-by: David L. Qiu <[email protected]>
* Address error on `/learn` after change of embedding model.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Set `all_files` option to default to False

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix removal of prefix when streaming

* Fix typo

Co-authored-by: david qiu <[email protected]>

---------

Co-authored-by: david qiu <[email protected]>
* Focus chat input with keyboard

* Focus chat input with keyboard

* Rename `inputFocusRequested` to `focusInputSignal`

* Make sure that the shortcut does not interrupt default action
…s (#881)

* add preferred dir functionality to BaseChatHandler

* remove print

* cleanup

* Change /learn to use _output_dir instead of root dir

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add preferred dir functionality to BaseChatHandler

* remove print

* cleanup

* Change /learn to use _output_dir instead of root dir

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change _output_dir to output_dir

* Update packages/jupyter-ai/jupyter_ai/chat_handlers/base.py

Co-authored-by: david qiu <[email protected]>

* add type hint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: david qiu <[email protected]>
* Fix help for slash commands

* Do not add `-h` to the help command itself

Co-authored-by: david qiu <[email protected]>

* Fix typo

Co-authored-by: david qiu <[email protected]>

* Centralize handling of `-h`/`--help`, with opt-out via class attribute

by default the `/help` and "default" handlers opt-out from `-h` handling

* Add colon delimiter and wrap the arguments in backticks

* Use Title case for help messages

* Remove final leftover

* Rename `display_arguments_help` to `supports_help`

---------

Co-authored-by: david qiu <[email protected]>
* Add a test ensuring correct mode of index dir

* Ensure dir exists with correct mode
* Add Ollama

* mistral:text for embeddings

* Add gemma

* Update the list of models

Co-authored-by: Bc <[email protected]>

* Mention Ollama in the docs

* Apply suggestions from code review

Co-authored-by: Piyush Jain <[email protected]>
Co-authored-by: david qiu <[email protected]>

---------

Co-authored-by: Bc <[email protected]>
Co-authored-by: Piyush Jain <[email protected]>
Co-authored-by: david qiu <[email protected]>
* Upload `jupyter-releaser` built distributions

* Try fix paths

* fix path
* Add a test case for closing pending messages

* Remove pending message on error

* Add a test for not sending closing message twice

* Review: make `close_pending` idempotent
the overridden method is no longer overriding
allowed task list since #784 but is only breaking
streaming -  it can be removed
* remove replace selection checkbox

* add useCopy() hook

* fixup

* add useReplace() hook

* add menu for replacement & insertion options on agent messages

* show 'replace 1 line' instead of 'replace 1 lines'
* upgrade to langchain~=0.2.0 and langchain_community~=0.2.0

* lower version floor to allow for langchain v0.1

Co-authored-by: Michał Krassowski <[email protected]>

---------

Co-authored-by: Michał Krassowski <[email protected]>
SHA256 hashes:

jupyter-ai-core-2.19.0.tgz: f299f1a94c386b88359e7a240450e5e2ea74c51ebe82346c2566def204e7c5a0

jupyter_ai-2.19.0-py3-none-any.whl: d03540ea42b181946ccad7287b4306bd8f37af09d9f7b3e45b0adc0eb0449b34

jupyter_ai-2.19.0.tar.gz: 746220ac7205f57047cb8c7bb1c94c7a02cdbad9af0c534762cd06168cd66b8e

jupyter_ai_magics-2.19.0-py3-none-any.whl: b9ac48e70d7c452f739289e588d89ebbc1abbfd37b7e6f8ea085da7169052293

jupyter_ai_magics-2.19.0.tar.gz: a0a078ee9c533e576769ce1330f2571eda5c3e5d3f3ce74ee249126d6c3c9eb5
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)
- [github.com/psf/black: 23.9.1 → 24.4.2](psf/black@23.9.1...24.4.2)
- [github.com/PyCQA/isort: 5.12.0 → 5.13.2](PyCQA/isort@5.12.0...5.13.2)
- [github.com/asottile/pyupgrade: v3.15.0 → v3.16.0](asottile/pyupgrade@v3.15.0...v3.16.0)
- [github.com/pycqa/flake8: 6.1.0 → 7.1.0](PyCQA/flake8@6.1.0...7.1.0)
- [github.com/sirosen/check-jsonschema: 0.27.0 → 0.29.0](python-jsonschema/check-jsonschema@0.27.0...0.29.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add notebooks to the documentation

* pin docutils

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: David L. Qiu <[email protected]>
SHA256 hashes:

jupyter-ai-core-2.19.1.tgz: a2ca5466579fce1a63806f440ec40095ba096ccea8531195b93eeac2a361ad9d

jupyter_ai-2.19.1-py3-none-any.whl: 9521cdfaada7c2e9c660cdbd7084235ebfaa7dfbf4f734f639f88fa892661e74

jupyter_ai-2.19.1.tar.gz: 4a4f61411d41ac16bc5838970ed4c54c2dd64c9b56d9277430c6a83ebd792f3d

jupyter_ai_magics-2.19.1-py3-none-any.whl: bb6ab5287378869dd5fa5f9ef5e90aa40c6300a628fb2147b9e6da1c7972681c

jupyter_ai_magics-2.19.1.tar.gz: bf2452b4a40b13be5e325b0abc3ac8a7575d1c8377e7311571c7d05028c3305f
Added the latest llama-3.1 models available on Amazon Bedrock, and gpt-4o mini. All these models were recently released and have become popular.
* migrate to langchain-aws

* pre-commit

* update aws provider dependencies in docs

* correct SM endpoints docs URL

Co-authored-by: Jason Weill <[email protected]>

* add new Cohere model IDs to BedrockEmbeddings

Co-authored-by: Piyush Jain <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* use BedrockLLM instead of Bedrock class

* add Amazon, Meta, Mistral models to BedrockChatProvider

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Jason Weill <[email protected]>
Co-authored-by: Piyush Jain <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* respect selected persona in chat input placeholder

* simplify for loop in getPersonaName()

Co-authored-by: Andrii Ieroshenko <[email protected]>

---------

Co-authored-by: Andrii Ieroshenko <[email protected]>
srdas and others added 28 commits October 29, 2024 17:31
…tation (#1056)

* Add example of using fields for configuration.

I have created this example based on some delving into the code and looking
at examples of some of the community providers.
I haven't included the IntegerField, as I couldn't get it to work properly,
suggesting that I don't understand it properly, whereas I have
successfully tested the TextField and MultilineTextField.

* Add example of using the EnvAuthStrategy to provide API Keys

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Combined sections for API Keys and for Fields into a single section.

As per review feedback,  combined the two sections and examples for
brevity.  Also added a couple of missing imports to the example.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Update anthropic.py

* Update anthropic.py

* Update anthropic.py
* edit system prompt to request dollar signs not be used as inline math delimiters

* escape dollar signs in chat frontend

* escape `$` only if alone and not in a code element

* update docstring

* avoid double-escaping `$` symbols
* Fixes context generation for non-chat providers.

When we're calling provider.generate, ultimately we're calling the generate
 function as specified in langchain_core.language_models.llms.BaseLLM.
This function expects a list of string prompts, where each should have a
separate generation performed for it - this being to allow taking advantage
 of batch processing where possible.

The bug here is that we pass in each message from the context as a separate
generation question,  rather than combining them together into a single
prompt including both the context and human message.

The edit here concatenates them all with two new lines between each message
 and ensures that we pass only a single element list to the generate
function.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Reduced padding in cell around code icons in code toolbar

* Update code-toolbar.tsx

* Implemented icon separattion using sx prop

* Update tooltipped-icon-button.tsx
…(#1087)

* Updated documentation to include installation of provider packages

* Fixed trailing whitespace in doc update

* Updated README and User Docs for Installtion instructions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update documentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David L. Qiu <[email protected]>
* Updated `anthropic.py` to remove deprecated models, remove `AnthropicProvider` class, add new models

Removed all deprecated models as listed here: https://docs.anthropic.com/en/docs/resources/model-deprecations.

This makes the `AnthropicProvider` class redundant, so it is now removed. The corresponding entry in `pyproject.toml` is also deleted.

The class `ChatAnthropicProvider` is updated to include the new `Claude-3.5-Haiku`model, and the function to check for  API key exception has been added.  The older version of `Claude-3.5-sonnet` has also been removed.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Anthropic models added

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…s (#1094)

* allow dollar symbols to delimit inline math in human messages

* update escaping logic and system prompt

* update system prompt

* update system prompt
SHA256 hashes:

jupyter-ai-core-2.28.0.tgz: e169d793b98cf73623b5c9137fc0db3daa492f1e0425e55c671930d621e19be5

jupyter_ai-2.28.0-py3-none-any.whl: f52457018d1f81b12b7719e61e3694095d928cd9b9ef38714de9e7bd35e5ec81

jupyter_ai-2.28.0.tar.gz: e9a82f403042d1c8cee4dd1a3927aa3112777d1985241113a996e5b729c2151a

jupyter_ai_magics-2.28.0-py3-none-any.whl: 7073d3c67d22d5b30290aec33cf3b00d5ca3ecb4a7078d3982865a9e34e0a315

jupyter_ai_magics-2.28.0.tar.gz: 281f435417ee3f4e678b2ffc222d02bc96ce3287ab331e4668d61cb6514251ef
SHA256 hashes:

jupyter-ai-core-2.28.1.tgz: 0baa5f2b897ce3c2215480ce11ba28d6e0806580d3ab4b07cea0e8e42fb66b46

jupyter_ai-2.28.1-py3-none-any.whl: fee72b1d96a14b749880ef6854c92b742ad9d9c36c7dbc977d79c422d0581fca

jupyter_ai-2.28.1.tar.gz: db6dfff6bb61822b0cb1a1dfda489b995f3a8e5f23a580e518b0e420fd52d806

jupyter_ai_magics-2.28.1-py3-none-any.whl: 98cd748405d1b5daf5cafca1d83c8dca5636d384d5d1206284a24e842b0114e4

jupyter_ai_magics-2.28.1.tar.gz: 658168c6bb140ea684f735958a5162fa9abad8a5c4554d5e8b8683ebe16908c0
* fix rendering of code blocks in JupyterLab >=4.3.0

* add jp-ThemedContainer to root element

* dedupe style rules

* pre-commit
… chat (#1106)

* Prevent error on non plaintext files in `@file`

* Updated to handle binary blobs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update file.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update file.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
SHA256 hashes:

jupyter-ai-core-2.28.2.tgz: bf8c23f49ba192d872ca28f35332c190d0c3ecad806fe17c9404ba32b9d27ba1

jupyter_ai-2.28.2-py3-none-any.whl: 2a99fe405ee910150a095136207fafb0e469f6f4e5f0114c99a476cdbbcc6d73

jupyter_ai-2.28.2.tar.gz: e893f2494033bb948f04cf3aa28f44e1ea27a18767027e2b721198151b5ed8b0

jupyter_ai_magics-2.28.2-py3-none-any.whl: f289bd5aad421bfa5a81b960e38d39da6835b16c276d2686455bc6ff2402282d

jupyter_ai_magics-2.28.2.tar.gz: 4576186ef2f85dd7d667c64bb3f6ef87a662062bd50569c651d58a4f828fba2c
* Downgrade spurious 'error' logs

Since it is expected that not all model providers will be loadable, it
is wrong to log the case that one cannot be loaded with level 'error'.

Resolves #839.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fixes #836

	1.	Removed `gpt-3.5-turbo-0125` as it points to `got-3.5-turbo`.
	2.	Removed `gpt-3.5-turbo-0301`,  deprecated as of 2024-06-13
	3.	Removed `gpt-3.5-turbo-0613",  deprecated as of 2024-06-13
	4.	Removed `gpt-3.5-turbo-16k`, not offered any more
	5.	Removed `gpt-3.5-turbo-16k-0613`,  deprecated as of 2024-06-13
	6.	Removed `gpt-4-32k`, no longer offered
	7.	Removed `gpt-4-32k-0613`, no longer offered
	8.	Added `gpt-4o-2024-11-20`, `chatgpt-4o-latest`
	9.	Will add `o1-preview`, `o1-mini` later as this is not widely available as yet

While `gpt-3.5-turbo` OpenAI recommends using `gpt-4o` instead: “As of July 2024, gpt-4o-mini should be used in place of gpt-3.5-turbo, as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.”

There are no changes to the embedding models from OpenAI.
updates:
- [github.com/sirosen/check-jsonschema: 0.29.4 → 0.30.0](python-jsonschema/check-jsonschema@0.29.4...0.30.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add failing test that asserts fields are included in lm_provider_params

* fix lm_provider_params prop to include fields

* fix bug that writes to `self.settings["model_parameters"]`

* add test capturing bug introduced by #421

* pre-commit
* fix install in CI

* pre-commit
* fixing jupyterlab/jupyter-ai#1128

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* simplify impl and verify dict() requires no args

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David L. Qiu <[email protected]>
* fix completion fields and add unit test

* pre-commit

* fix install in CI

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
SHA256 hashes:

jupyter-ai-core-2.28.3.tgz: a45e43ca01993073257a1d5ca78db123f8781a8123a6b8f957bb2ebc8c86a981

jupyter_ai-2.28.3-py3-none-any.whl: b5a6a56d027b1083f66aaf134def754dc175cded903bc80c96e1bede31d26f93

jupyter_ai-2.28.3.tar.gz: 4be34772c3bd2b0dd34736843e57ce2f8b7bb271d2ae2b728df6645354074b89

jupyter_ai_magics-2.28.3-py3-none-any.whl: 62937989faae9974afea6d9acb252cdaf8930b4276ceab5a9f08762cbc3c9538

jupyter_ai_magics-2.28.3.tar.gz: 643c568b20a0aaf543da3291503bc493113ba1d3ee63260045722c3462a3a8de
…n Amazon Bedrock (#1134)

* Updated UI and documentation for Amazon Bedrock Cross Region Inference

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* screenshot for CRI usage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Consolidated Bedrock chat documentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bedrock.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update install.sh

* Update install.sh

* Fix install step in CI (#1139)

* fix install in CI

* pre-commit

* Update docs/source/users/index.md

Co-authored-by: david qiu <[email protected]>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: david qiu <[email protected]>
* Base API URL added for embedding models

Jupyter AI currently allows the user to call a model at a URL (location) different from the default one by specifying a selected Base API URL. This can be done for Ollama, OpenAI provider models. However, for these providers, there is no way to change the API URL for embedding models when using the `/learn` command in RAG mode. This PR adds an extra field to make this feasible.

Tested as follows for Ollama:
[1] Start the Ollama system from port 11435 instead 11434 (the default):
`OLLAMA_HOST=127.0.0.1:11435 ollama serve`
[2] Set the Base API URL:

[3] Check that the new API URL works:

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* allow embedding model fields to be saved

* exclude empty str fields from config manager

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David L. Qiu <[email protected]>
@cl-gavan cl-gavan merged commit 6e22026 into main Dec 18, 2024
1 of 9 checks passed
@cl-gavan cl-gavan deleted the merge_2_28_3 branch December 18, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.