Skip to content

Comments

Add support for embedding models#21

Merged
tonybaloney merged 10 commits intotonybaloney:mainfrom
cmbrose:cmbrose/embeddings-support
May 26, 2025
Merged

Add support for embedding models#21
tonybaloney merged 10 commits intotonybaloney:mainfrom
cmbrose:cmbrose/embeddings-support

Conversation

@cmbrose
Copy link
Contributor

@cmbrose cmbrose commented May 17, 2025

Fixes #20

Exposes the already-defined embedding models for use with llm embed. Additionally exposes smaller dimension versions of text-embedding-3-large (256, 1024) and text-embedding-3-small (512).

I took the approach from the openai embedding models from llm itself.

$ llm embed -m github/text-embedding-3-large -c "Hello world"
[ ... embedding floats ... ]

$ llm embed -m github/text-embedding-3-small-512 -c "Hello world"
[ ... embedding floats ... ]

$ llm embed -m github/text-embedding-3-small -c "Hello world" | jq 'length'
1536

$ llm embed -m github/text-embedding-3-small-512 -c "Hello world" | jq 'length'
512

@cmbrose cmbrose force-pushed the cmbrose/embeddings-support branch 2 times, most recently from 94d8a27 to b208f68 Compare May 19, 2025 17:50
)

kwargs = {
"input": texts,
Copy link
Owner

Choose a reason for hiding this comment

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

input in EmbeddingModel accepts a iterable of str or bytes, whereas client.embed takes str or Embedding Token. For now, I think bytes will probably fail. We should add a test for that too

@tonybaloney tonybaloney merged commit 3261a4d into tonybaloney:main May 26, 2025
5 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.

Register the embedding models to be used with llm embed

2 participants