Skip to main content
Version: v1.7.0

Collections usage overview

Overview

In Enterprise h2oGPTe, Collections are groups of knowledge sources and configuration for Retrieval-Augmented Generation (RAG) and custom agents.

Collections support RAG, which allows an LLM to use information from documents, audio transcriptions, and other data in a Collection to generate more contextual responses. Collections also function as custom agents defined by system prompts, agent settings, and guardrails, with or without ingested documents. When RAG is enabled, Enterprise h2oGPTe retrieves information from the Collection's knowledge sources and sends it to the LLM as context. When RAG is not enabled, the Collection can still operate as a fully configured agent focused on task execution or reasoning.

You can use several strategies to import and create Collections for optimal responses. The following sections cover common use cases and data setup strategies.

info

For a list of supported file types, see Supported file types for a Collection.

Collection use cases

Depending on how you combine system prompts, documents, and tools, you can customize a Collection for various use cases.

note

This describes the overall Collection setup, not the per-chat generation approach. For details on retrieval mechanics during a chat, see Default chat settings.

Use caseConfigurationDescription
Pure agentCustom system prompt + specific model (no documents)Uses the LLM's internal knowledge as a specialized assistant, without external data.
Classic RAGIngested documentsAnswers questions based strictly on ingested documents.
Tool useEnabled tools/APIs + system promptPerforms actions and interacts with external systems instead of only answering questions.
Hybrid agentDocuments + tools + system promptCombines information from uploaded documents with the agent's ability to reason.

Types of questions

When using Classic RAG, there are generally three types of questions. The following examples use menus from different restaurants to illustrate each type.

  1. Single document questions: Questions that use context from only a specific document.

    • Example: "What chicken dishes are served at Restaurant: Mesita?"
    • In this case, you only want the LLM to use the menu document from Restaurant: Mesita. The LLM should not 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 combines information from the various menus into a single response, finding examples of healthy chicken dishes across them rather than comparing menus.
  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 determines the cost of steak from each menu document and compares the prices in the response.

Use the following guidance based on your question type:

Type of questionWhat to doNotes
Single document questionCreate a Collection with the single document you want to use. Don't ask the question in a Collection with multiple documents, because RAG might retrieve chunks from irrelevant documents.If the document is already in a Collection with multiple documents, you don't need to re-upload it. Instead, add the document to a new Collection to prevent duplication.
Aggregating questionCreate a Collection with the documents you want the LLM to use. Using RAG+ is recommended because it provides more context to the LLM.For Collections with more documents, consider increasing the number of neighboring chunks in RAG+ to 1 or 2. For more information, see Additional note context.
Compare/contrast questionFollow the steps for aggregating questions listed above, or ask the question to each document separately (each in its own Collection) and collect the responses. The aggregating approach might not pass chunks from each document to the LLM.None

Aggregating question: additional note context

The following example uses the h2oGPTe Python client to query with RAG+ and neighboring chunks:

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

Further reading

To learn more about Collections, refer to the following pages:


Feedback