fix(vector_io): compute usage_bytes from indexed chunks instead of leaving it at 0 - #6549
Merged
Merged
Conversation
…aving it at 0 openai_attach_file_to_vector_store initialized usage_bytes to 0 on both the VectorStoreFileObject and the parent vector store's metadata dict, but never updated it after successfully chunking, embedding, and inserting the file's content. Chunks were still indexed correctly, but usage_bytes stayed 0 indefinitely, matching ogx-ai#6542. Compute it from the UTF-8 byte length of the chunk text used for the embeddings request, set it on the file object, and add it to the parent vector store's running usage_bytes total under the existing per-store lock. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: elina priyadarshinee <elina.priyadarshinee1@ibm.com>
elinacse
requested review from
bbrowning,
cdoern,
franciscojavierarceo,
leseb,
mattf,
raghotham and
skamenan7
as code owners
September 15, 2026 08:25
mattf
approved these changes
Sep 15, 2026
mattf
left a comment
Collaborator
There was a problem hiding this comment.
ok, please do two follow ups -
- decrement in openai_delete_vector_store_file
- avoid adding to the usage count when insert_chunks fails
This was referenced Sep 15, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
openai_attach_file_to_vector_store initialized usage_bytes to 0 on both the VectorStoreFileObject and the parent vector store's metadata dict, but never updated it after successfully chunking, embedding, and inserting the file's content. Chunks were still indexed correctly, but usage_bytes stayed 0 indefinitely, matching #6542.
Compute it from the UTF-8 byte length of the chunk text used for the embeddings request, set it on the file object, and add it to the parent vector store's running usage_bytes total under the existing per-store lock.
Closes #6542