Learning from Help Documents

Users or applications can provide help documents to enhance the AppAgent's capabilities. The AppAgent retrieves relevant knowledge from these documents to improve task understanding, plan quality, and application interaction efficiency.

For instructions on providing help documents, see the Help Document Provision guide.

Mechanism

Help documents are structured as task-solution pairs. When processing a request, the AppAgent:

  1. Retrieves relevant help documents by matching the request against task descriptions
  2. Uses the retrieved solutions as references for plan generation
  3. Adapts the solutions to the specific context

Since retrieved documents may not be perfectly relevant, the AppAgent treats them as references rather than strict instructions, allowing for flexible adaptation to the actual task requirements.

Configuration

To enable learning from help documents:

  1. Provide Help Documents: Follow the Help Document Provision guide to prepare and index help documents

  2. Configure Parameters: Set the following options in config.yaml:

Configuration Option Description Type Default
RAG_OFFLINE_DOCS Enable offline help document retrieval Boolean False
RAG_OFFLINE_DOCS_RETRIEVED_TOPK Number of top documents to retrieve Integer 1

For more details on RAG configuration, see the RAG Configuration Guide.

API Reference

Bases: Retriever

Class to create offline retrievers.

Create a new OfflineDocRetriever. :appname: The name of the application.

Source code in rag/retriever.py
86
87
88
89
90
91
92
93
def __init__(self, app_name: str) -> None:
    """
    Create a new OfflineDocRetriever.
    :appname: The name of the application.
    """
    self.app_name = app_name
    indexer_path = self.get_offline_indexer_path()
    self.indexer = self.get_indexer(indexer_path)

get_indexer(path)

Load the retriever.

Parameters:
  • path (str) –

    The path to load the retriever from.

Returns:
  • The loaded retriever.

Source code in rag/retriever.py
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
def get_indexer(self, path: str):
    """
    Load the retriever.
    :param path: The path to load the retriever from.
    :return: The loaded retriever.
    """

    if path:
        logger.info(f"Loading offline indexer from {path}...")
    else:
        return None

    try:
        db = FAISS.load_local(
            path, get_hugginface_embedding(), allow_dangerous_deserialization=True
        )
        return db
    except Exception as e:
        logger.warning(
            f"Failed to load experience indexer from {path}, error: {e}."
        )
        return None

get_offline_indexer_path()

Get the path to the offline indexer.

Returns:
  • The path to the offline indexer.

Source code in rag/retriever.py
 95
 96
 97
 98
 99
100
101
102
103
104
105
def get_offline_indexer_path(self):
    """
    Get the path to the offline indexer.
    :return: The path to the offline indexer.
    """
    offline_records = get_offline_learner_indexer_config()
    for key in offline_records:
        if key.lower() in self.app_name.lower():
            return offline_records[key]

    return None