Project Sessions Llama Index Query Engine
Using Sessions with LlamaIndex
A Session is a sequence of traces representing a user's interaction with an application.
In this tutorial, you will:
- Build and trace a simple LlamaIndex application
- Use sessions to organize traces
âšī¸ This notebook requires an OpenAI API key.
1. Install Dependencies and Import Libraries
2. Configure Your OpenAI API Key
Set your OpenAI API key if it is not already set as an environment variable.
3. Configure the default project then Launch Phoenix
đ¨ Phoenix is configured with environment variables. đ¨
In this tutorial we want to change the default project we send traces to by modifying the PHOENIX_PROJECT_NAME environment variable defined blow.
Enable Phoenix tracing via LlamaIndexInstrumentor. Phoenix uses OpenInference traces - an open-source standard for capturing and storing LLM application traces that enables LLM applications to seamlessly integrate with LLM observability solutions such as Phoenix.
Launch Phoenix
4. Build Your LlamaIndex Application
This example uses a RetrieverQueryEngine over a pre-built index of the Arize documentation, but you can use whatever LlamaIndex application you like.
Download our pre-built index of the Arize docs from cloud storage and instantiate your storage context.
We are now ready to instantiate our query engine that will perform retrieval-augmented generation (RAG). Query engine is a generic interface in LlamaIndex that allows you to ask question over your data. A query engine takes in a natural language query, and returns a rich response. It is built on top of Retrievers. You can compose multiple query engines to achieve more advanced capability