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.
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.
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 case | Configuration | Description |
|---|---|---|
| Pure agent | Custom system prompt + specific model (no documents) | Uses the LLM's internal knowledge as a specialized assistant, without external data. |
| Classic RAG | Ingested documents | Answers questions based strictly on ingested documents. |
| Tool use | Enabled tools/APIs + system prompt | Performs actions and interacts with external systems instead of only answering questions. |
| Hybrid agent | Documents + tools + system prompt | Combines 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.
-
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.
-
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.
-
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.
Recommended guidance based on question type
Use the following guidance based on your question type:
| Type of question | What to do | Notes |
|---|---|---|
| Single document question | Create 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 question | Create 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 question | Follow 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:
- Supported file types for a Collection
- Create a Collection
- Add Documents to a Collection
- Chat with a Collection
- Collection settings
- Share a Collection
- Delete a Collection
- Submit and view feedback for this page
- Send feedback about Enterprise h2oGPTe to cloud-feedback@h2o.ai