I want to add metadata with llamaindex #6158
Replies: 2 comments 2 replies
-
To add metadata when using from openinference.instrumentation import using_metadata
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor
from phoenix.otel import register
# Register the tracer provider
tracer_provider = register(
project_name="default", endpoint="url"
)
# Instrument LlamaIndex
LlamaIndexInstrumentor().instrument(tracer_provider=tracer_provider)
# Define your metadata
metadata = {
"key-1": "value_1",
"key-2": "value_2",
# Add more key-value pairs as needed
}
# Use the context manager to add metadata
with using_metadata(metadata):
# Your code here will have the metadata added to the spans
# For example, querying or other operations
... This will ensure that the specified metadata is included in the spans generated within the context block [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
Hey @bhavya-giri, please check out this portion of the docs here. |
Beta Was this translation helpful? Give feedback.
-
from phoenix.otel import register
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor
tracer_provider = register(
project_name="default", endpoint="url"
)
LlamaIndexInstrumentor().instrument(tracer_provider=tracer_provider)
need help adding metadata
Beta Was this translation helpful? Give feedback.
All reactions