Registry / llm-agents / h2ogpte

h2ogpte

JSON →
library1.7.2pypypi✓ verified 85d ago

h2ogpte is the Python client library for H2O.ai's Enterprise h2oGPTe, a Retrieval-Augmented Generation (RAG) based platform designed to help organizations leverage generative AI. It focuses on contextualizing chat with private data, offering scalable backend and frontend, multi-user support, and multi-modal capabilities for text, images, and audio. The current version is 1.7.0, and major releases appear to occur every few months, introducing new features and improvements.

pip install h2ogpte
INSTALL
IMPORT
SIG · H2OGPTE
H
h2ogpte
llm-agentspythonv1.7.2
Install
16.5s avg
Import
20593ms
Disk
243MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 16.846s · 239.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 16.5s · import 16.102s · 233MB
243MB installed
● package 243MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

H2OGPTE
from h2ogpte import H2OGPTE

This quickstart demonstrates how to connect to an h2oGPTe instance, create a collection, upload a document, create a chat session, and query the collection using the Python client. Ensure you have your h2oGPTe instance address and a valid API key set as environment variables or replaced in the code.

import os from h2ogpte import H2OGPTE # Replace with your h2oGPTe instance address and API key # It's recommended to use environment variables for sensitive information H2OGPTE_ADDRESS = os.environ.get('H2OGPTE_ADDRESS', 'https://your-h2ogpte-instance.h2o.ai') H2OGPTE_API_KEY = os.environ.get('H2OGPTE_API_KEY', 'sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') client = H2OGPTE(address=H2OGPTE_ADDRESS, api_key=H2OGPTE_API_KEY) try: # Create a new collection collection_id = client.create_collection( name='My Contracts', description='Paper clip supply contracts and related documents', ) print(f"Collection created with ID: {collection_id}") # Example: Upload a dummy document (in a real scenario, this would be a file) dummy_content = "There were 55 paper clips shipped, 22 to Scranton and 33 to Filmer." with open('paper_clips_report.txt', 'w') as f: f.write(dummy_content) client.sync_folder(collection_id=collection_id, folder_path='.') print("Dummy document uploaded and synchronized.") # Create a chat session with the collection chat_session_id = client.create_chat_session(collection_id=collection_id) print(f"Chat session created with ID: {chat_session_id}") # Query the collection with client.connect(chat_session_id) as session: response = session.query( 'How many paper clips were shipped to Scranton?', timeout=60, ) print(f"Response: {response.content}") except Exception as e: print(f"An error occurred: {e}") finally: # Clean up (optional) - delete the dummy file and collection if 'paper_clips_report.txt' in os.listdir('.'): os.remove('paper_clips_report.txt') # In a real application, you might also delete the collection and chat session # client.delete_collection(collection_id=collection_id) # client.delete_chat_session(chat_session_id=chat_session_id)
Debug
Known issues
breakingSpecific versions of other h2oGPTe ecosystem components (e.g., h2oGPTe GitHub Action) may have strict compatibility requirements with particular client library versions. For instance, h2oGPTe Action v0.2.2-beta requires h2oGPTe versions 1.6.31 through 1.6.47.
fix
Always consult the documentation for other H2O.ai tools and integrations to ensure you are using a compatible version of the `h2ogpte` client library.
affects: <1.6.31 and >1.6.47 for h2oGPTe Action v0.2.2-beta (example)
gotchaThere are two types of API keys: Global API keys and Collection-specific API keys. Global API keys grant full user impersonation and system-wide access, allowing creation, deletion, and interaction with all collections, documents, and chats. Collection-specific keys are restricted to chatting with the specified collection only. Misusing a global API key when only collection-level access is intended can pose a significant security risk.
fix
Always use the principle of least privilege. Generate and use collection-specific API keys for integrations that only need access to a particular collection. Only use global API keys for applications requiring full administrative access.
affects: All versions
gotchaThe `H2OGPTE` client requires a valid `address` (URL of your h2oGPTe instance) and `api_key` for connection. Incorrect values, network issues, or firewall restrictions preventing access to the h2oGPTe server are common sources of connection errors.
fix
Double-check the `H2OGPTE_ADDRESS` and `H2OGPTE_API_KEY` values. Ensure your environment has network access to the h2oGPTe instance and no firewalls are blocking the connection. Consult h2oGPTe server documentation for deployment-specific troubleshooting.
affects: All versions
gotchaWhen interacting with underlying Large Language Models (LLMs) through h2oGPTe, some LLM-specific parameters (e.g., `system_prompt`, `temperature`, `max_tokens`) might not behave as expected or might have fixed defaults if the underlying LLM backend (like oLLaMa in h2oGPT OSS) does not support runtime parameter changes. This can lead to unexpected model responses if the user assumes full control over all LLM hyperparameters via the client.
fix
Understand the capabilities and configurations of the LLMs deployed on your h2oGPTe instance. Consult the h2oGPTe server documentation or an administrator regarding LLM-specific parameter control and any hardcoded defaults.
affects: All versions, depending on the h2oGPTe server's LLM configuration
Errors
Common errors & fixes
h2ogpte.exceptions.H2OGPTeAPIError: HTTP status 401 Unauthorized
The H2OGPTE client failed to authenticate because the provided API key is invalid, lacks necessary permissions, or the server address is incorrect.
fix
Verify that the `api_key` and `address` used to initialize the `H2OGPTE` client are correct for your H2O.ai Enterprise h2oGPTe instance, and ensure the API key has the required permissions.
```python
from h2ogpte import H2OGPTE

H2OGPTE_URL = "https://your.h2ogpte.instance.com" # Replace with your actual h2oGPTe URL
H2OGPTE_API_KEY = "sk-YOUR_VALID_API_KEY" # Replace with your actual API key

try:
    client = H2OGPTE(address=H2OGPTE_URL, api_key=H2OGPTE_API_KEY)
    print("Successfully connected to h2oGPTe.")
except Exception as e:
    print(f"Connection failed: {e}")
```
TypeError: 'NoneType' object is not subscriptable
A variable or function call that was expected to return an object (like a dictionary or list) instead returned `None`, and subsequent code attempted to access an element using `[]` on that `None` value. This often happens if an `h2ogpte` client method fails or an API call does not return the expected data structure.
fix
Before attempting to subscript an object, add a check to ensure it is not `None`.
```python
from h2ogpte import H2OGPTE

client = H2OGPTE(address="https://your.h2ogpte.instance.com", api_key="sk-YOUR_VALID_API_KEY")

# Example: Assuming 'get_collection' might return None if collection_id is not found
collection_info = client.get_collection(collection_id="non_existent_id")

if collection_info is not None:
    # Safely access elements if collection_info is not None
    print(f"Collection Name: {collection_info.name}") # Assuming 'name' is an attribute
else:
    print("Collection not found or API call failed to return data.")
```
TypeError: Chroma.init() got an unexpected keyword argument 'anonymized_telemetry'
This error indicates a version incompatibility between `langchain` and `chromadb`, which are often used with or are components of H2O.ai's RAG-based platforms like `h2oGPTe` and `h2oGPT`.
fix
Check the `requirements.txt` or documentation for the `h2ogpte` or `h2oGPT` environment to identify the correct pinned versions of `langchain` and `chromadb`, and then reinstall them.
```bash
pip uninstall langchain chromadb
pip install langchain==<correct_version> chromadb==<correct_version>
# Example with known compatible versions (check official documentation for current best practice):
# pip install langchain==0.1.0 chromadb==0.4.0
```
RuntimeError: DefaultCPUAllocator: not enough memory: you tried to allocate N bytes.
The system running `h2ogpte` (or its underlying components like `h2oGPT` which loads models) has insufficient CPU RAM to load a model, process a large document, or handle a significant amount of data.
fix
Reduce the memory footprint by using a smaller or quantized model (e.g., GGUF/GGML models which can stream weights from disk), decreasing parameters like `max_seq_len` if applicable, or provisioning more CPU RAM for the environment.
```
# If interacting with h2ogpte client, ensure the server has adequate resources.
# If running h2oGPT locally:
# 1. Use a smaller or quantized model.
# 2. Adjust model parameters like --max_seq_len.
#    Example: python generate.py --base_model=path/to/model --max_seq_len=2048
# 3. Increase the available RAM for your Python environment or container.
```
Upgrade
Version history
1.7.2latest on PyPI · released May 20, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
h2ogpte — pip install h2ogpte · libregistry