Skip to main content
Version: Next

Collections usage overview


Enterprise h2oGPTe supports Retrieval Augmented Generation (RAG) when getting responses from an LLM, which allows for contextualizing the question to the LLM with information from documents, audio transcriptions, and other data. Users can create one or more collections of data that they want to get answers about or generate new content from. When a user interacts with an LLM, the user’s prompt is compared with the collection of documents to find similar chunks of information. This information is then sent to the LLM.

There are many strategies for importing and creating collections so that you get the best responses for your use case. This page describes the common use cases and how to set up your data effectively.

Types of questions

At a high level, there are generally three types of questions. To describe these types, we will use an example where we have menus from different restaurants.

  1. Single Document Questions: Questions that only use context from a specific document to be answered.

    • Example: "What chicken dishes are served at Restaurant: Mesita?"
    • In this case, we only want the LLM to use the menu document from the Restaurant: Mesita. We do not want it to use information from any other menu.
  2. Aggregating Questions: Questions that aggregate information across multiple documents.

    • Example: "Based on the menus, what are some examples of healthy chicken dishes."
    • In this case, Enterprise h2oGPTe must combine information that it learns from the menus into a single response. It is not comparing the menus, but instead simply finding examples of healthy chicken dishes across them.
  3. Compare/Contrast Questions: Questions that compare or contrast information from multiple documents.

    • Example: "What is the cost of a steak at each of the restaurants?
    • In this case, Enterprise h2oGPTe needs to determine the cost of the steak at each restaurant (cost from each menu document) and compare it in the response.

The following is the recommended guidance based on the question you have:

Type of QuestionWhat to DoNotes
Single Document QuestionCreate a collection with the single document you want to use to answer the question. It is not recommended to ask the question in a collection with multiple documents, since RAG may use chunks from documents that the user does not consider to be relevant.If you have your document already loaded in a collection with multiple documents, you do not need to re-upload your document into a new collection. Instead, you can add your document to a new collection. This prevents the document from being duplicated in the system.
Aggregating QuestionCreate a collection with the documents you want the LLM to use to create its answer. Using RAG+ is recommended, as this provides more context to the LLM.For collections with more documents, consider increasing the number of neighboring chunks in RAG+ to 1 or 2. This increases the context that is passed to the LLM. For more information, see Additional note context.
Compare/Contrast QuestionTo compare or contrast all documents in the collection, you have two options. You can follow the steps for Aggregating Questions listed above—however, it is not guaranteed to pass chunks from each document to the LLM. If you must have information from each document in the response, you can instead ask the question to each document separately (document in its own collection) and collect the responses.In future releases, Enterprise h2oGPTe will include metadata about the document and associate with each of the chunks to improve the accuracy of asking compare/contrast questions on a collection with multiple documents.

Aggregating Question: Additional note context

The following example shows how to increase the number of neighboring chunks in RAG+ to 1 or 2.

with client.connect(chat_session_id) as session:
reply = session.query(
'Based on the menus, what are some examples of healthy chicken dishes?',
rag_config={"rag_type": "rag+", "num_neighbor_chunks_to_include": 2},