feat(llamaindex): add native LlamaIndex SDK integration#355
Merged
Abhijeet Prasad (AbhiPrasad) merged 13 commits intomainfrom Apr 27, 2026
Merged
feat(llamaindex): add native LlamaIndex SDK integration#355Abhijeet Prasad (AbhiPrasad) merged 13 commits intomainfrom
Abhijeet Prasad (AbhiPrasad) merged 13 commits intomainfrom
Conversation
240b786 to
5900bd5
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove event handler (redundant with span handler data extraction), remove separate helpers module, flatten classify/extract logic, drop per-span integration metadata noise, fix VCR markers on tests that make no HTTP calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test against both latest (0.14.21) and 0.13.0 (first version with llama_index_instrumentation as a separate package) - Set min_version="0.13.0" on LlamaIndexIntegration - Install llms/embeddings packages unpinned in nox since they are tightly version-coupled to llama-index-core Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When both LlamaIndex and OpenAI integrations are active, skip token metrics on the LlamaIndex LLM span so only the OpenAI leaf span owns token accounting. Same pattern as CrewAI's _litellm_owns_leaf_span(). Also fix CI: add pylint disable=import-error for optional imports, run ruff format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add LlamaIndex packages to the lint environment instead of suppressing import errors, tighten dispatcher state checks, and improve optional dependency fallback behavior. Avoid double-counting async OpenAI token metrics, preserve block-backed message content, improve error detail logging, and add VCR coverage for LLM error handling.
f3d8fe3 to
0783e8d
Compare
Abhijeet Prasad (AbhiPrasad)
approved these changes
Apr 27, 2026
Merged
Abhijeet Prasad (AbhiPrasad)
added a commit
that referenced
this pull request
Apr 29, 2026
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.
Summary
BraintrustSpanHandlerandBraintrustEventHandlerregistered on LlamaIndex's root dispatcherauto_instrument()— works with a single callFiles
py/src/braintrust/integrations/llamaindex/— new integration directory (8 files)py/src/braintrust/auto.py— addedllamaindexparameterpy/src/braintrust/integrations/__init__.py— registered integrationpy/noxfile.py— addedtest_llamaindexnox sessionpy/pyproject.toml— added version matrix, dep group, cassette-dirsTest plan
test_integration_setup— handler registration verifiedtest_integration_idempotent— no duplicate handlerstest_auto_instrument_includes_llamaindex— registry entry workstest_document_processing— SentenceSplitter spans capturedtest_span_hierarchy— parent-child relationships preservedtest_llm_error_handling— errors captured on spansnox -s "test_llamaindex(latest)" -- --vcr-record=allCloses #350
🤖 Generated with Claude Code