Notebooks
L
Langfuse
Integration Llama Index Instrumentation

Integration Llama Index Instrumentation

observabilityllmsgenaicookbookprompt-managementhacktoberfestlarge-language-modelsnextraLangfuselangfuse-docs

description: Example cookbook for the experimental LlamaIndex Langfuse integration using the instrumentation module of LlamaIndex. category: Integrations

Cookbook LlamaIndex Integration (Instrumentation Module)

This is a simple cookbook that demonstrates how to use the LlamaIndex Langfuse integration using the instrumentation module by LlamaIndex (available in llama-index v0.10.20 and later).

Note: This integration is in beta. Please report any issues or feedback via GitHub.

Setup

Make sure you have both llama-index and langfuse installed.

[ ]

Initialize the integration. Get your API keys from the Langfuse project settings. This example uses OpenAI for embeddings and chat completions. You can also use any other model supported by LlamaIndex.

[2]

Register the Langfuse LlamaIndexInstrumentor:

[3]

Index

[4]
[5]

Query

[9]
He made home movies using a Super 8 camera.
[10]
He made home movies using a Super 8 camera growing up.

Custom trace properties

You can use the instrumentor.observe context manager to manage trace IDs, set custom trace properties, and access the trace client for later scoring.

[ ]