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

Add support for Ollama embedding models #1035

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

zioproto
Copy link
Contributor

Description

Ollama can also serve embedding models:
https://ollama.com/blog/embedding-models

helps with #1026 providing the possibility to generate embeddings with Ollama

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

ret.raise_for_status()
return ret.json()["embeddings"]

def embed_query(self, text: str) -> List[float]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pieroit I implemented using httpx following the style of other customer embedders.

However, I am doubt if I should refactory with the import ollama module, to do more complex logic like downloading on the fly models:

examples:

Copy link
Member

Choose a reason for hiding this comment

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

This will do for now! Thanks @zioproto

@pieroit pieroit merged commit 10e5f73 into cheshire-cat-ai:develop Feb 20, 2025
2 checks passed
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.

2 participants