Skip to content

Conversation

@franciscojavierarceo
Copy link
Collaborator

@franciscojavierarceo franciscojavierarceo commented Dec 19, 2025

What does this PR do?

Move embedding generation responsibility from VectorStoreWithIndex.insert_chunks() to OpenAIVectorStoreMixin.openai_attach_file_to_vector_store() and make ChunkMetadata required.

Important call outs:

  • Add new EmbeddedChunk class that inherits from Chunk with embedding fields
  • Remove embedding fields from base Chunk and ChunkMetadata classes
  • Make ChunkMetadata required in Chunk class
  • Fix vector store file attachment error handling
  • Update all providers and tests to use EmbeddedChunk for vector operations

Test Plan

Updated tests

Resolves #2981

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 19, 2025
@franciscojavierarceo franciscojavierarceo changed the title chore: Refactor embedding out of VectorStoreWithIndex and into OpenAI… chore: Refactor embedding out of VectorStoreWithIndex and into OpenAIVectorStoreMixin Dec 19, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

chore: Refactor embedding out of VectorStoreWithIndex and into OpenAI…

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-node studio · code · diff

Your SDK built successfully.
generate ⚠️build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/llama-stack-client-node/95d5132cffa03bf650b3b048ae56555b6d61a7f9/dist.tar.gz
llama-stack-client-kotlin studio · code · diff

Your SDK built successfully.
generate ⚠️lint ✅test ❗

llama-stack-client-python studio · code · diff

generate ⚠️build ⏳lint ⏳test ⏳

llama-stack-client-go studio · code · diff

Your SDK built successfully.
generate ⚠️lint ❗test ❗

go get github.com/stainless-sdks/llama-stack-client-go@c4eed4b81913a556ac5b30b7c1900400cd88d49e

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
Last updated: 2025-12-25 03:16:05 UTC

@franciscojavierarceo franciscojavierarceo changed the title chore: Refactor embedding out of VectorStoreWithIndex and into OpenAIVectorStoreMixin chore!: Refactor embedding out of VectorStoreWithIndex and into OpenAIVectorStoreMixin Dec 19, 2025
@franciscojavierarceo franciscojavierarceo force-pushed the migrate-embedding-to-vector-store-mixin branch 2 times, most recently from cd40891 to d34448b Compare December 22, 2025 21:18
@franciscojavierarceo franciscojavierarceo changed the title chore!: Refactor embedding out of VectorStoreWithIndex and into OpenAIVectorStoreMixin chore!: Refactor embeddings out of VectorStoreWithIndex and into OpenAIVectorStoreMixin. Make ChunkMetadata required. Dec 22, 2025
@franciscojavierarceo franciscojavierarceo changed the title chore!: Refactor embeddings out of VectorStoreWithIndex and into OpenAIVectorStoreMixin. Make ChunkMetadata required. chore!: Refactor embeddings out of VectorStoreWithIndex and into OpenAIVectorStoreMixin and make ChunkMetadata required. Dec 22, 2025
@franciscojavierarceo franciscojavierarceo marked this pull request as ready for review December 22, 2025 21:34
Copy link
Collaborator

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

one question, otherwise lgtm!


# Get embedding model info from vector store metadata
store_info = self.openai_vector_stores[vector_store_id]
embedding_model = store_info["metadata"].get("embedding_model")
Copy link
Collaborator

Choose a reason for hiding this comment

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

will store_info["metadata"] always be set? just want to check because we are calling .get on it unconditionally. I guess its ok because we are in a try except, but double checking :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In release v0.2.13 (https://github.com/llamastack/llama-stack/releases/tag/v0.2.13) I added the metadata object but now I'm forcing it to be required so the edge case is for users that are migrating data from <0.2.13 and upgrading to 0.4.0.

I think it's okay for those users to reingest the data. Now that the metadata and child fields are required, we won't have that concern going forward.

if isinstance(data.embedding, list):
c.embedding = data.embedding
else:
raise ValueError(f"Expected embedding to be a list, got {type(data.embedding)}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

this looks like a 500 instead of a 400

Copy link
Collaborator

Choose a reason for hiding this comment

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

did you see a non-list here? that'd be an api violation. remove the isinstance check and let it fail, which will result in a 500.

Comment on lines 70 to 71
embedding: list[float]
chunk_metadata: ChunkMetadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this api need to be changed as part of the refactor?

Comment on lines 199 to 200
chunk_embedding_model=embedding_model,
chunk_embedding_dimension=embedding_dimension,
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are these used?

mattf
mattf previously requested changes Dec 25, 2025
Copy link
Collaborator

@mattf mattf left a comment

Choose a reason for hiding this comment

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

looking better!

for later -

  • turn OpenAIVectorStoreMixin into a BaseModel

if isinstance(data.embedding, list):
c.embedding = data.embedding
else:
raise ValueError(f"Expected embedding to be a list, got {type(data.embedding)}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you see a non-list here? that'd be an api violation. remove the isinstance check and let it fail, which will result in a 500.

@franciscojavierarceo franciscojavierarceo force-pushed the migrate-embedding-to-vector-store-mixin branch 4 times, most recently from 61faef4 to 7dd3abd Compare January 3, 2026 05:27
@mergify
Copy link

mergify bot commented Jan 6, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @franciscojavierarceo please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jan 6, 2026
…VectorStoreMixin

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
@franciscojavierarceo franciscojavierarceo force-pushed the migrate-embedding-to-vector-store-mixin branch from 9597d7c to 2611343 Compare January 6, 2026 15:00
@mergify mergify bot removed the needs-rebase label Jan 6, 2026
@franciscojavierarceo
Copy link
Collaborator Author

@mattf you mind reviewing? I'd like to get this into the 0.4 and backport it into the 0.3.x releases.

@leseb
Copy link
Collaborator

leseb commented Jan 6, 2026

@mattf you mind reviewing? I'd like to get this into the 0.4 and backport it into the 0.3.x releases.

we won't backport in 0.3.x if it's a breaking change / feature.

@franciscojavierarceo
Copy link
Collaborator Author

@leseb oh yeah that makes sense.

Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

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

Would like to land this so we can cut 0.4.0 today. I believe all @mattf comments have been addressed. Also, any small miss can be addressed in a 0.4.x release quickly. Thanks!

chunk_id="c1",
created_timestamp=1234567890,
updated_timestamp=1234567890,
chunk_embedding_model="test-model",
Copy link
Member

Choose a reason for hiding this comment

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

ChunkMetadata no longer has embedding info?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope, moving it to the EmbeddedChunk as Chunks will no longer have embeddings.

It's an annoying change but it makes things much cleaner and explicit about when Chunks have embeddings and don't.

Copy link
Member

Choose a reason for hiding this comment

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

should you then instantiate ChunkMetadata with these params? or am i missing the fact that this is a failure test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I missed cleaning these up 🤦. Removing them in this PR: #4454

Copy link
Member

@raghotham raghotham left a comment

Choose a reason for hiding this comment

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

looks good

@franciscojavierarceo franciscojavierarceo dismissed mattf’s stale review January 6, 2026 17:03

Thanks for the feedback Matt, I think I incorporated the changes. Given you're OOO and we have enough approvals, we want to land this for 0.4. Let me know if you have other followups, happy to make them in subsequent PRs.

@franciscojavierarceo franciscojavierarceo merged commit 6aacfef into llamastack:main Jan 6, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate VectorDB API, update VectorIO, and enhance OpenAIVectorStoreMixin

6 participants