Skip to content

LlamaIndex instrumentation #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions literalai/instrumentation/llamaindex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from literalai.client import LiteralClient
from llama_index.core.instrumentation import get_dispatcher

from literalai.instrumentation.llamaindex.event_handler import LiteralEventHandler
from literalai.instrumentation.llamaindex.span_handler import LiteralSpanHandler


def instrument_llamaindex(client: "LiteralClient"):
root_dispatcher = get_dispatcher()

span_handler = LiteralSpanHandler()
root_dispatcher.add_span_handler(span_handler)

event_handler = LiteralEventHandler(
literal_client=client, llama_index_span_handler=span_handler
)
root_dispatcher.add_event_handler(event_handler)
Loading
Loading