Skip to main content

Client library for Enterprise h2oGPTe

Project description

H2O H2OGPTE Python Client

Install

pip install h2ogpte

Usage

from h2ogpte import H2OGPTE

h2ogpte = H2OGPTE(address='https://h2ogpte.h2o.ai', api_key='sk-xxxxxx')

# Create a new collection
collection_id = h2ogpte.create_collection(name='Contracts', description='Paper clip supply contracts')

# Upload documents
with open('/path/to/dunder_mifflin.pdf', 'rb') as f:
    dunder_mifflin = h2ogpte.upload('Dunder Mifflin.pdf', f)
with open('/path/to/wernham_hogg.pdf', 'rb') as f:
    initech = h2ogpte.upload('Wernham Hogg.pdf', f)

# Ingest documents
h2ogpte.ingest_uploads(collection_id, [dunder_mifflin, initech])

# Create a chat session
chat_session_id = h2ogpte.create_chat_session(collection_id)

# Query the collection
with h2ogpte.connect(chat_session_id) as session:
    reply = session.query('How many paper clips were shipped to Scranton?', timeout=10)
    print(reply.content)
    
    reply = session.query('Did David Brent co-sign the contract with Initech?', timeout=10)
    print(reply.content)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

h2ogpte-1.3.1-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file h2ogpte-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: h2ogpte-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for h2ogpte-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf9ae47919d95a009ef1bd130407ce1801fe8db234dfc503b07cbfb632b9a10
MD5 e3a72e193e0fa5b97092c0bacdc9c0a1
BLAKE2b-256 f90b0880ce0626510fe9a81712dddfbf5f6b9ae0a7d7134d1d0b83c3de63b941

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page