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

Migrate to ChatOllama base class in Ollama provider #1015

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

srdas
Copy link
Collaborator

@srdas srdas commented Sep 26, 2024

Refactored the code to create a separate file for models provided by Ollama:

  1. Created a separate file ollama.py as a unique provider. Refactored other code accordingly.
  2. Also changed the Ollama class to ChatOllama so that it can support binding tools to the LLM.
  3. Updated the imports to come from langchain_ollama instead of langchain_community
  4. Tested on several Ollama models, both LLMs and embedding models: mxbai-embed-large, nomic-embed-text, ima/deepseek-math, mathstral, qwen2-math, snowflake-arctic-embed, mistral, llama3.1, starcoder2:15b-instruct

Reference: https://github.com/langchain-ai/langchain/blob/master/libs/partners/ollama/langchain_ollama/chat_models.py

srdas and others added 2 commits September 26, 2024 12:49
Created a separate file `ollama.py` as a unique provider. Refactored other code accordingly.

Also changed the `Ollama` class to `ChatOllama` so that it can support binding tools to the LLM.

Updated the imports to come from `langchain_ollama` instead of `langchain_community`

Tested on several Ollama models, both LLMs and embedding models: `mxbai-embed-large`, `nomic-embed-text`, `ima/deepseek-math`, `mathstral`, `qwen2-math`, `snowflake-arctic-embed`, `mistral`, `llama3.1`, `starcoder2:15b-instruct`
@srdas srdas added the enhancement New feature or request label Sep 26, 2024
@srdas srdas changed the title Added separate ollama provider Add separate ollama provider file Sep 26, 2024
@srdas srdas requested a review from dlqqq September 26, 2024 20:05
@dlqqq dlqqq changed the title Add separate ollama provider file Migrate to ChatOllama base class in Ollama provider Sep 26, 2024
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srdas Awesome, thanks! 🎉

@dlqqq dlqqq merged commit e6ec9e9 into jupyterlab:main Sep 26, 2024
12 of 13 checks passed
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Added separate `ollama` provider

Created a separate file `ollama.py` as a unique provider. Refactored other code accordingly.

Also changed the `Ollama` class to `ChatOllama` so that it can support binding tools to the LLM.

Updated the imports to come from `langchain_ollama` instead of `langchain_community`

Tested on several Ollama models, both LLMs and embedding models: `mxbai-embed-large`, `nomic-embed-text`, `ima/deepseek-math`, `mathstral`, `qwen2-math`, `snowflake-arctic-embed`, `mistral`, `llama3.1`, `starcoder2:15b-instruct`

* [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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants