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 h2ogpteVerified import paths — ran on the pinned version, not inferred.
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.
Always consult the documentation for other H2O.ai tools and integrations to ensure you are using a compatible version of the `h2ogpte` client library.
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.
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.
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.
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}")
```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.")
```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 ```
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. ```
No dependency data recorded yet.