Skip to main content
Version: v1.6.1 🚧

Add a document to a Collection

Overview​

A Collection can contain multiple documents. Added documents are indexed and stored in a database. When you ask a question about the document(s), h2oGPTe crawls through the indexed document(s) in the Collection to find relevant content to answer the question while utilizing the Collection's large language model (LLM) to summarize a concise question response. A user can add documents during or after creating a Collection.

Example​

from h2ogpte import H2OGPTE

client = H2OGPTE(
address="https://h2ogpte.genai.h2o.ai",
api_key='sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
)

collection_id = client.create_collection(
name="The name of my Collection",
description="The description of my Collection",
)

with open("annual-report.pdf", "rb") as f:
report = client.upload("annual-report.pdf", f)

client.ingest_uploads(
collection_id=collection_id,
upload_ids=[report]
)

Feedback