Giter VIP home page Giter VIP logo

Comments (2)

dosubot avatar dosubot commented on June 14, 2024 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:

  1. 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))
  2. Use TreeSelectLeafRetriever for Detailed Tracing: The TreeSelectLeafRetriever 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.

  3. Customize Query Processing: For advanced observability, customize the behavior of the TreeSelectLeafRetriever class by providing your own implementations of the BasePromptTemplate 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.

  4. 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


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.

logan-markewich avatar logan-markewich commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.