Comments (2)
To inspect the intermediate steps in the response synthesis, including the context used for each Large Language Model (LLM) call and the associated answers in the refined response mode, you can utilize the debugging and tracing features of LlamaIndex. Here's how you can achieve this:
-
Enable Debug Logging: Start by enabling debug logging in your application. This will allow you to log operations at a basic level. You can do this by configuring the logging module in your Python script as follows:
import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
-
Use
TreeSelectLeafRetriever
for Detailed Tracing: TheTreeSelectLeafRetriever
class in LlamaIndex is designed for traversing the index graph to search for the best leaf node that answers your query. It supports detailed debugging and tracing, including logging debug information such as the selected node and the current answer response at each level of the tree traversal. -
Customize Query Processing: For advanced observability, customize the behavior of the
TreeSelectLeafRetriever
class by providing your own implementations of theBasePromptTemplate
and modifying the query templates used for LLM calls. This customization allows for detailed control over how queries are processed, how responses are synthesized and refined, and enables tracing the intermediate steps and the context used for each LLM call. -
Structured Answer Filtering and Node Selection: The class also supports structured answer filtering and node selection based on LLM responses, which can be fine-tuned by setting the
child_branch_factor
and using appropriate query templates. This feature allows for granular control over the answers provided by the LLM, including filtering out unsatisfactory responses and selecting the most relevant nodes for further querying.
For more detailed guidance, refer to the LlamaIndex documentation and specifically look into the TreeSelectLeafRetriever
class and the refine.py
module within the LlamaIndex repository. These resources will provide you with the necessary information to understand and implement the debugging and tracing features for your project.
Details
Sources
- llama-index-core/llama_index/core/response_synthesizers/refine.py
- docs/docs/understanding/tracing_and_debugging/tracing_and_debugging.md
- llama-index-legacy/llama_index/legacy/response_synthesizers/refine.py
- llama-index-core/llama_index/core/indices/tree/select_leaf_retriever.py
- llama-index-legacy/llama_index/legacy/indices/tree/select_leaf_retriever.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from llama_index.
You can enable logging for every llm input and output
import llama_index.core
llama_index.core.set_global_handler("simple")
from llama_index.
Related Issues (20)
- [Question]: Metadata filtering in chat engine. HOT 5
- [Question]: Llama Index with local Embedding Model Dont Finish HOT 5
- [Question]: nested agents HOT 2
- [Bug]: OpenAIAgent.astream_chat() does not work HOT 2
- [Question]: Further explanation of total embedding token usage HOT 3
- [Bug]: Nebulagraph - upsert_triplet() function has empty string obj HOT 2
- [Bug]: Getting deprecation message for Neo4jPropertyGraphStore HOT 4
- [Question]: Why does Bedrock prints out prompt and other unnecessary symbols? HOT 2
- [Question]: Retriever search depth in a custom node relationship environment HOT 3
- [Bug]: function_call does not generate langfuse subspans for a custom AsyncBaseTool class HOT 4
- [Bug]: AttributeError: 'Anthropic' object has no attribute 'beta' HOT 6
- [Bug]: ReplicateError: Unauthenticated HOT 3
- [Bug]: Unable to instantiate LiteLLM LlamaIndex Object HOT 2
- [Bug]: Bedrock cohere still not working as expected HOT 1
- [Feature Request]: support of faiss.IndexIVFFlat
- [Question]: How do I prioritize exact matches in my retriever? (BM25 or any other)
- [Bug]: Querying by specific doc_ids in the vector db not working properly HOT 1
- [Bug]: TypeError: expected str instance, int found when calling lazy_load_data method in llama_index/readers/mongodb/base.py
- [Question]: How big of a VectorStore is too big ? HOT 1
- [Bug]: llama-index-llms-langchain in not working with latest lanchain HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llama_index.