Skip to content

fix(vector_io): compute usage_bytes from indexed chunks instead of leaving it at 0 - #6549

Merged
mattf merged 1 commit into
ogx-ai:mainfrom
elinacse:fix-vector-store-usage-bytes
Sep 15, 2026
Merged

mattf merged 1 commit into
ogx-ai:mainfrom
elinacse:fix-vector-store-usage-bytes

Conversation

@elinacse

Copy link
Copy Markdown
Contributor

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

…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>

@mattf mattf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok, please do two follow ups -

  • decrement in openai_delete_vector_store_file
  • avoid adding to the usage count when insert_chunks fails

@mattf
mattf added this pull request to the merge queue Sep 15, 2026
Merged via the queue into ogx-ai:main with commit cea766a Sep 15, 2026
57 checks passed
@elinacse

Copy link
Copy Markdown
Contributor Author

@mattf I have addressed this in the PR #6552 please review it . Thanks !

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.

Bug: usage_bytes always 0 - RAG file_search pipeline not indexing files (FAISS + Ollama)

2 participants