npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

h2ogpte

v1.6.43

Published

Javascript client for H2OGPTe.

Readme

H2OGPTe NodeJS/Typescript client

This client is experimental and subject to change.

Used for connecting to a Generative AI platform called H2OGPTe. See more at h2o.ai.

Installation

npm install h2ogpte

Auth

This client can authenticate in 2 ways.

  1. Using H2OGPTE API token (h2ogpte.setup('<endpoint_url>', '<token>')). See <h2ogpteinstance/api>.
  2. Using Azure Active Directory token (h2ogpte.setup('<endpoint_url>', '', '', '<azure_token>'))

Usage

import * as h2ogpte from 'h2ogpte'

async function main() {
  // Setup endpoint URL and access token.
  h2ogpte.setup('<endpoint_url>', '<token>', '<optional CSRF token>')

  // Or setup for Azure only.
  h2ogpte.setupForAzure('<endpoint_url>', '<Active Directory token>', '<optional CSRF token>')

  // Or setup with JWT token only
  h2ogpte.setupForJWT(
    '<endpoint_url>',
    '<JWT token>',
    '<optional CSRF token>',
    '<optional session ID>'
  )

  // Create new collection with English as embedding model.
  const collectionID = await h2ogpte.createCollection(
    'Name',
    'Description',
    'English (bge-large-en-v1.5)'
  )

  // Create dummy File. In real world, it would come from filepicker (browser).
  const blob = new Blob(['This is some text content'], { type: 'text/plain' })

  // Upload the file
  const uploadID = await h2ogpte.uploadFile(
    new File([blob], 'myTextFile.txt', { type: 'text/plain' })
  )

  // Ingest the file.
  await h2ogpte.ingestUploads(
    'Ingesting documents',
    collectionID,
    [uploadID],
    false, // Generate document summaries.
    false // Generate document questions.
  )

  // Create a chat session.
  const { chatID } = await h2ogpte.createChatSession(collectionID)

  const onMessage = message => console.log(message)
  // Prepare a websocket client to start chatting. Pass onMessage callback.
  const socket = h2ogpte.Socket(onMessage)
  // Connect to server.
  const close = socket.connect()

  // Send a message.
  socket.send({
    t: 'cq',
    mode: 's',
    session_id: chatID,
    correlation_id: correlationID,
    body: 'Hello world',
    system_prompt: null,
    pre_prompt_query: null,
    prompt_query: null,
    pre_prompt_summary: null,
    prompt_summary: null,
    llm: null,
    llm_args: null,
    self_reflection_config: null,
    rag_config: null,
  })
  // Close the connection.
  close()

  // Fetch first 100 documents in a collection.
  const docs = await h2ogpte.listDocumentsInCollection(collectionID, 0, 99)
  // Summarize all documents in collection.
  const summaries = await Promise.all(
    docs.map(({ id }) => {
      return h2ogpte.createDocumentSummary(
        'Document summary',
        null,
        id,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null
      )
    })
  )
}

main()

Underlying REST API client

The client utilizes a generated REST API client for establishing communication with the H2OGPTe server. This generated layer is also accessible and documented here.