Skip to main content

h2oGPTe REST API (v1.0.0)

Download OpenAPI specification:Download

Overview

Users can easily interact with the h2oGPTe API through its REST API, allowing HTTP requests from any programming language.

Authorization: Getting an API key

Sign up/in at Enterprise h2oGPTe and generate one of the following two types of API keys:

  • Global API key: If a Collection is not specified when creating a new API Key, that key is considered to be a global API Key. Use global API Keys to grant full user impersonation and system-wide access to all of your work. Anyone with access to one of your global API Keys can create, delete, or interact with any of your past, current, and future Collections, Documents, Chats, and settings.

  • Collection-specific API key: Use Collection-specific API Keys to grant external access to only Chat with a specified Collection and make related API calls to it. Collection-specific API keys do not allow other API calls, such as creation, deletion, or access to other Collections or Chats.

Access Enterprise h2oGPTe through your H2O Generative AI app store account, available with a freemium tier.

Authorization: Using an API key

All h2oGPTe REST API requests must include an API Key in the "Authorization" HTTP header, formatted as follows:

Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
curl -X 'POST' \
  'https://h2ogpte.genai.h2o.ai/api/v1/collections' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -d '{
    "name": "The name of my Collection",
    "description": "The description of my Collection",
    "embedding_model": "BAAI/bge-large-en-v1.5"
  }'

Interactive h2oGPTe API testing

This page only showcases the h2oGPTe REST API; you can test it directly in the Swagger UI. Ensure that you are logged into your Enterprise h2oGPTe account.

Collections

Create a Collection

A Collection refers to a group of related Documents. A Collection lets a user aggregate documents in one location. A user can utilize Collections to group particular sets of material (documents) to explore individually through Chats utilizing a large language model (LLM).

Authorizations:
bearerAuth
Request Body schema: application/json
required
name
required
string
description
required
string
embedding_model
string
object (CollectionSettings)

Responses

Request samples

Content type
application/json
{
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "collection_settings": {
    }
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

List collections.

List collections for a given user. If sort_column is not specified, the output is sorted by by last update time in descending order.

Authorizations:
bearerAuth
query Parameters
offset
integer
Default: 0

How many collections to skip before returning.

limit
integer
Default: 100

How many collections to return.

sort_column
string
Default: "updated_at"
Enum: "name" "document_count" "document_size" "updated_at" "sessions_count"

Sort column.

ascending
boolean
Default: false

When true, returns sorted by sort_column in ascending order.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of collections.

Counts a number of collections.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

Get a Collection

A user can obtain a Collection by specifying its ID.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of collection to return

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

Deletes collection.

Deletes collection with a given unique identifier.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of collection to delete

query Parameters
timeout
integer
Default: 300

Timeout in seconds

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Updates attributes of an existing collection.

Updates of an existing collection, particularly name and description.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of collection to to be updated

Request Body schema: application/json
required
name
string
description
string

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

Updates a prompt template reference of a collection.

Updates a prompt template reference of a collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection

Request Body schema: application/json
required
prompt_template_id
string

Responses

Request samples

Content type
application/json
{
  • "prompt_template_id": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

Removes a prompt template reference from the collection.

Removes a prompt template reference from the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

Fetches collection settings.

Returns details of collection settings

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection associated with the settings

Responses

Response samples

Content type
application/json
{
  • "max_tokens_per_chunk": 320,
  • "chunk_overlap_tokens": 0,
  • "guardrails_settings": {
    }
}

Updates collection settings.

Recreates entire settings on the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection

Request Body schema: application/json
max_tokens_per_chunk
integer

Approximate max. number of tokens per chunk for text-dominated document pages. For images, chunks can be larger.

chunk_overlap_tokens
integer

Approximate number of tokens that are overlapping between successive chunks.

object (GuardrailsSettings)

Responses

Request samples

Content type
application/json
{
  • "max_tokens_per_chunk": 320,
  • "chunk_overlap_tokens": 0,
  • "guardrails_settings": {
    }
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

List a Collection's documents

A user can list a Collection's documents.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

This parameter refers to the unique identifier ( ID) of the Collection to filter results.

query Parameters
offset
integer
Default: 0

This parameter refers to the number of documents to skip before retrieving results.

limit
integer
Default: 100

This parameter refers to the maximum number of documents to return in the result set.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Import an already stored document to an existing collection.

Import an already stored document to an existing collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to remove the document from.

document_id
required
string

Id of the document to be removed.

query Parameters
timeout
integer
Default: 300

Timeout in seconds

gen_doc_summaries
boolean
Default: false

Whether to auto-generate document summaries (uses LLM)

gen_doc_questions
boolean
Default: false

Whether to auto-generate sample questions for each document (uses LLM)

copy_document
boolean
Default: false

Whether to save a new copy of the document.

ocr_model
string
Default: "auto"

Which method to use to extract text from images using AI-enabled optical character recognition (OCR) models

tesseract_lang
string

Which language to use when using ocr_model="tesseract".

keep_tables_as_one_chunk
boolean
Default: false

When tables are identified by the table parser the table tokens will be kept in a single chunk.

chunk_by_page
boolean
Default: false

Each page will be a chunk. keep_tables_as_one_chunk will be ignored if this is true.

handwriting_check
boolean
Default: false

Check pages for handwriting. Will use specialized models if handwriting is found.

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Removes the document from the collection.

Removes the document from the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to remove the document from.

document_id
required
string

Id of the document to be removed.

query Parameters
timeout
integer
Default: 300

Timeout in seconds

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Counts a number of documents in the collection.

Counts a number of documents in the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to filter by.

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

List chat sessions for a given collection.

List chat sessions for a given collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to filter by.

query Parameters
offset
integer
Default: 0

How many chat sessions to skip before returning.

limit
integer
Default: 100

How many chat sessions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of chat sessions with the collection.

Counts a number of chat sessions with the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to filter by.

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

List suggested questions for a given collection.

List suggested questions for a given collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection to filter by.

query Parameters
limit
integer
Default: 100

How many questions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Returns a list of access permissions for a given collection.

The returned list of permissions denotes who has access to the collection.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Removes sharing of a collection to all other users except the original owner.

Removes sharing of a collection to all other users except the original owner.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection.

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Shares a collection to a user.

Shares a collection template to a user.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection.

username
required
string

User name that will obtain access to the collection

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Removes sharing of a collection to a user.

Removes sharing of a collection to a user.

Authorizations:
bearerAuth
path Parameters
collection_id
required
string

Id of the collection.

username
required
string

User name that will lose access to the collection

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Documents

List documents.

List documents for a given user. If sort_column is not specified, the output is sorted by by last update time in descending order.

Authorizations:
bearerAuth
query Parameters
offset
integer
Default: 0

How many collections to skip before returning.

limit
integer
Default: 100

How many documents to return.

sort_column
string
Default: "updated_at"
Enum: "name" "username" "type" "size" "page_count" "connector" "uri" "original_type" "original_mtime" "status" "updated_at"

Sort column.

ascending
boolean
Default: false

When true, returns sorted by sort_column in ascending order.

with_summaries
boolean
Default: false

When true, returns also summary and summary_parameter with other common attributes of the document.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of documents.

Counts a number of documents.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

Finds a document by id.

Returns a single document by its unique identifier.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of document to return

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "The Hitchhiker's Guide to the Galaxy",
  • "type": "string",
  • "size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "uri": "string",
  • "summary": "string",
  • "summary_parameters": "string"
}

Deletes a document.

Deletes a document with a given unique identifier.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of document to delete

query Parameters
timeout
integer
Default: 300

Timeout in seconds

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Updates attributes of an existing document.

Updates attributes of an existing document, particularly name and uri.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of document to to be updated

Request Body schema: application/json
required
name
string
uri
string

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "uri": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "The Hitchhiker's Guide to the Galaxy",
  • "type": "string",
  • "size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "uri": "string",
  • "summary": "string",
  • "summary_parameters": "string"
}

Lists collections for containing a given document.

Lists collections for containing a given document.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of the document.

query Parameters
offset
integer
Default: 0

How many collections to skip before returning.

limit
integer
Default: 100

How many collections to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Assigns a tag to the document.

Assigns a tag to the document.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of the document to to be associated with a tag

Request Body schema: application/json
required
name
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "marvel"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "marvel",
  • "description": "Stories based on Marvel's comics.",
  • "format": "string"
}

Removes a tag from a document.

Removes a tag from a document.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of the document to remove the tag from

tag_name
required
string

Name of the tag to be removed.

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

List chat sessions for a given document.

List chat sessions for a given document.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of the document to filter by.

query Parameters
offset
integer
Default: 0

How many chat sessions to skip before returning.

limit
integer
Default: 100

How many chat sessions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of chat sessions with the document.

Counts a number of chat sessions with the document.

Authorizations:
bearerAuth
path Parameters
document_id
required
string

Id of the document to filter by.

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

Document Ingestion

upload_file

Uploads file to H2OGPTe instance

Authorizations:
bearerAuth
Request Body schema: multipart/form-data
required
file
string <binary>

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "filename": "my_favourite_book.pdf"
}

Ingest uploaded document

Ingests uploaded document identified to a given collection

Authorizations:
bearerAuth
path Parameters
upload_id
required
string

Id of uploaded document

query Parameters
collection_id
required
string

Id of target collection

timeout
integer
Default: 300

Timeout in seconds

gen_doc_summaries
boolean
Default: false

Whether to auto-generate document summaries (uses LLM)

gen_doc_questions
boolean
Default: false

Whether to auto-generate sample questions for each document (uses LLM)

audio_input_language
string
Default: "auto"

Language of audio files

ocr_model
string
Default: "auto"

Which method to use to extract text from images using AI-enabled optical character recognition (OCR) models

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Chat

Creates chat session.

Creates chat session with a collection if provided. Otherwise, the session will be with a generic LLM.

Authorizations:
bearerAuth
query Parameters
collection_id
string

Id of collection

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List chat sessions.

List chat sessions.

Authorizations:
bearerAuth
query Parameters
offset
integer
Default: 0

How many chat sessions to skip before returning.

limit
integer
Default: 100

How many chat sessions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of chat sessions.

Counts a number of chat sessions.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

Finds a chat session by id.

Returns a single chat session by its unique identifier.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Deletes collection.

Deletes collection with a given unique identifier.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

query Parameters
timeout
integer
Default: 300

Timeout in seconds

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Updates the name of a chat session.

Updates the name of a chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Request Body schema: application/json
name
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Updates a collection reference of a chat session.

Updates a collection reference of a chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Request Body schema: application/json
required
collection_id
required
string

Responses

Request samples

Content type
application/json
{
  • "collection_id": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Removes a collection reference from the chat session.

Removes a collection reference from the chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Updates a prompt template reference of a chat session.

Updates a prompt template reference of a chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Request Body schema: application/json
required
prompt_template_id
string

Responses

Request samples

Content type
application/json
{
  • "prompt_template_id": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Removes a prompt template reference from the chat session.

Removes a prompt template reference from the chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "Discussion about sci-fi heroes.",
  • "collection_id": "c91e7c84-65df-4b43-ba15-fbd3afb2e86f",
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90",
  • "latest_message_content": "The strongest hero is superman!",
  • "updated_at": "2019-08-24T14:15:22Z"
}

get_completion

Asks question in a given chat session. If stream is enabled, the server sends stream of delta messages. The stream is terminated with the massage having property finished set to true. This message terminating message contains also the full completion.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of a chat session

Request Body schema: application/json
required
message
required
string

A query or an instruction from the end user to the LLM.

system_prompt
string

A text sent to models which support system prompts. It gives the model overall context in how to respond. Use 'auto' for the model default. Don't specify for no system prompt.

pre_prompt_query
string
Default: "Pay attention and remember the information below, which will help to answer the question or imperative after the context ends.\\\\\\\\n"

A text that is prepended before the contextual document chunks. The default can be customized per environment.

prompt_query
string
Default: "According to only the information in the document sources provided within the context above,"

A text that is appended to the beginning of the user's message. The default can be customized per environment.

image_batch_final_prompt
string

A prompt for each image batch for vision models.

image_batch_image_prompt
string

A prompt to reduce all answers each image batch for vision models

llm
string

LLM name to send the query. Use "auto" for automatic model routing, set cost_controls of llm_args for detailed control over automatic routing.

object (ChatCompletionRequestLLMArgs)

A map of arguments sent to LLM with query.

  • temperature (type=double, default=0.0) - A value used to modulate the next token probabilities. 0 is the most deterministic and 1 is most creative.
  • top_k (type=integer, default=1) - A number of highest probability vocabulary tokens to keep for top-k-filtering.
  • top_p (type=double, default=0.0) - If set to a value < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation.
  • seed (type=integer, default=0) - A seed for the random number generator when sampling during generation (if temp>0 or top_k>1 or top_p<1), seed=0 picks a random seed.
  • repetition_penalty (type=double, default=1.07) - A parameter for repetition penalty. 1.0 means no penalty.
  • max_new_tokens (type=double, default=1024) - A maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction.
  • min_max_new_tokens (type=integer, default=512) - A minimum value for max_new_tokens when auto-adjusting for content of prompt, docs, etc.
  • response_format (type=enum[text, json_object, json_code], default=text) - An output type of LLM
  • guided_json (type=map) - If specified, the output will follow the JSON schema.
  • guided_regex (type=string) - If specified, the output will follow the regex pattern. Only for models that support guided generation.
  • guided_choice (type=array[string]) - If specified, the output will be exactly one of the choices. Only for models that support guided generation.
  • guided_grammar (type=string) - If specified, the output will follow the context free grammar. Only for models that support guided generation.
  • guided_whitespace_pattern (type=string) - If specified, will override the default whitespace pattern for guided json decoding. Only for models that support guided generation.
  • enable_vision (type=enum[on, off, auto], default=auto) - Controls vision mode, send images to the LLM in addition to text chunks.
  • visible_vision_models (type=array[string], default=[auto]) - Controls which vision model to use when processing images. Must provide exactly one model. [auto] for automatic.
  • cost_controls (type=map) A map with cost controls settings:
    • max_cost (type=double) - Sets the maximum allowed cost in USD per LLM call when doing Automatic model routing. If the estimated cost based on input and output token counts is higher than this limit, the request will fail as early as possible.
    • max_cost_per_million_tokens (type=double) - Only consider models that cost less than this value in USD per million tokens when doing automatic routing. Using the max of input and output cost.
    • model (type=array[string]) - Optional subset of models to consider when doing automatic routing. If not specified, all models are considered.
    • willingness_to_pay (type=double) - Controls the willingness to pay extra for a more accurate model for every LLM call when doing automatic routing, in units of USD per +10% increase in accuracy. We start with the least accurate model. For each more accurate model, we accept it if the increase in estimated cost divided by the increase in estimated accuracy is no more than this value divided by 10%, up to the upper limit specified above. Lower values will try to keep the cost as low as possible, higher values will approach the cost limit to increase accuracy. 0 means unlimited.
    • willingness_to_wait (type=double) - Controls the willingness to wait longer for a more accurate model for every LLM call when doing automatic routing, in units of seconds per +10% increase in accuracy. We start with the least accurate model. For each more accurate model, we accept it if the increase in estimated time divided by the increase in estimated accuracy is no more than this value divided by 10%. Lower values will try to keep the time as low as possible, higher values will take longer to increase accuracy. 0 means unlimited.
object (ChatCompletionSelfReflectionConfig)

A map with self reflection settings:

  • llm_reflection (type=string, example=gpt-4-0613)
  • prompt_reflection (type=string, example="""Prompt:\\n%s\\n"""\\n\\n""")
  • system_prompt_reflection (type=string)
  • llm_args_reflection (type=string, example={})
rag_config
object (ChatCompletionRAGConfig)

A map with arguments to control RAG (retrieval-augmented-generation) types.:

  • rag_type (type=enum[auto, llm_only, rag, hyde1, hyde2, rag+, all_data]) RAG type options:
    • auto - Automatically select the best rag_type.
    • llm_only LLM Only - Answer the query without any supporting document contexts. Requires 1 LLM call.
    • rag RAG (Retrieval Augmented Generation) - Use supporting document contexts to answer the query. Requires 1 LLM call.
    • hyde1 LLM Only + RAG composite - HyDE RAG (Hypothetical Document Embedding). Use 'LLM Only' response to find relevant contexts from a collection for generating a response. Requires 2 LLM calls.
    • hyde2 HyDE + RAG composite - Use the 'HyDE RAG' response to find relevant contexts from a collection for generating a response. Requires 3 LLM calls.
    • rag+ Summary RAG - Like RAG, but uses more context and recursive summarization to overcome LLM context limits. Keeps all retrieved chunks, puts them in order, adds neighboring chunks, then uses the summary API to get the answer. Can require several LLM calls.
    • all_data All Data RAG - Like Summary RAG, but includes all document chunks. Uses recursive summarization to overcome LLM context limits. Can require several LLM calls.
  • hyde_no_rag_llm_prompt_extension (type=string, example=\\nKeep the answer brief, and list the 5 most relevant key words at the end.) - Add this prompt to every user's prompt, when generating answers to be used for subsequent retrieval during HyDE. Only used when rag_type is hyde1 or hyde2.
  • num_neighbor_chunks_to_include (type=integer, default=1) - A number of neighboring chunks to include for every retrieved relevant chunk. It helps to keep surrounding context together. Only enabled for rag_type rag+.
  • meta_data_to_include (type=map) - A map with flags that indicate whether each piece of document metadata is to be included as part of the context for a chat with a collection.
    • name (type: boolean, default=True)
    • text (type: boolean, default=True)
    • page (type: boolean, default=True)
    • captions (type: boolean, default=True)
    • uri (type: boolean, default=False)
    • connector (type: boolean, default=False)
    • original_mtime (type: boolean, default=False)
    • age (type: boolean, default=False)
    • score (type: boolean, default=False)
  • rag_max_chunks (type=integer, default=-1) - Maximum number of document chunks to retrieve for RAG. Actual number depends on rag_type and admin configuration. Set to >0 values to enable. Can be combined with rag_min_chunk_score.
  • rag_min_chunk_score (type=double, default=0.0) - Minimum score of document chunks to retrieve for RAG. Set to >0 values to enable. Can be combined with rag_max_chunks.
include_chat_history
string
Enum: "on" "off" "auto"

Whether to include chat history. Includes previous questions and answers for the current chat session for each new chat request. Disable if require deterministic answers for a given question.

tags
Array of strings

A list of tags from which to pull the context for RAG.

stream
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "message": "Who is the strongest hero?",
  • "system_prompt": "string",
  • "pre_prompt_query": "Pay attention and remember the information below, which will help to answer the question or imperative after the context ends.\\\\\\\\n",
  • "prompt_query": "According to only the information in the document sources provided within the context above,",
  • "image_batch_final_prompt": "string",
  • "image_batch_image_prompt": "string",
  • "llm": "string",
  • "llm_args": { },
  • "self_reflection_config": { },
  • "rag_config": { },
  • "include_chat_history": "on",
  • "tags": [
    ],
  • "stream": false
}

Response samples

Content type
Example
{
  • "body": "The strongest here is Superman!"
}

List suggested questions for a given chat session.

List suggested questions for a given chat session.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of a chat session

query Parameters
limit
integer
Default: 100

How many questions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Fetches chat message and metadata for messages in a chat session.

Fetches chat message and metadata for messages in a chat session. Messages without a reply_to are from the end user, messages with a reply_to are from an LLM and a response to a specific user message.

Authorizations:
bearerAuth
path Parameters
session_id
required
string

Id of the chat session

query Parameters
offset
integer
Default: 0

How many chat sessions to skip before returning.

limit
integer
Default: 100

How many chat sessions to return.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Fetches metadata for references of a chat message.

Fetches metadata for references of a chat message. References are only available for messages sent from an LLM, an empty list will be returned for messages sent by the user.

Authorizations:
bearerAuth
path Parameters
message_id
required
string

Id of the chat message

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Fetches chat message meta information.

Fetches chat message meta information.

Authorizations:
bearerAuth
path Parameters
message_id
required
string

Id of the chat message.

query Parameters
info_type
string
Enum: "self_reflection" "usage_stats" "prompt_raw" "llm_only" "hyde1"

Metadata type to fetch.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Prompt Templates

Creates a new prompt template.

Creates a new prompt template that can be subsequently associated with a collection.

Authorizations:
bearerAuth
Request Body schema: application/json
required
name
required
string

A name of the prompt template.

description
string

A description of the prompt template.

lang
string

A language code.

system_prompt
string

A system prompt.

pre_prompt_query
string

A text that is prepended before the contextual document chunks.

prompt_query
string

A text that is appended to the beginning of the user's message.

hyde_no_rag_llm_prompt_extension
string

An LLM prompt extension.

pre_prompt_summary
string

A prompt that goes before each large piece of text to summarize.

prompt_summary
string

A prompt that goes after each large piece of text to summarize.

system_prompt_reflection
string

A system prompt for self-reflection.

prompt_reflection
string

A template for self-reflection, must contain two occurrences of %s for full previous prompt (including system prompt, document related context and prompts if applicable, and user prompts) and answer

auto_gen_description_prompt
string

A prompt to create a description of the collection.

auto_gen_document_summary_pre_prompt_summary
string

A pre_prompt_summary for summary of a freshly imported document (if enabled).

auto_gen_document_summary_prompt_summary
string

A prompt_summary for summary of a freshly imported document (if enabled).`

auto_gen_document_sample_questions_prompt
string

A prompt to create sample questions for a freshly imported document (if enabled).

default_sample_questions
Array of strings

Default sample questions in case there are no auto-generated sample questions.

image_batch_image_prompt
string

A prompt for each image batch for vision models.

image_batch_final_prompt
string

A prompt for each image batch for vision models.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "lang": "string",
  • "system_prompt": "string",
  • "pre_prompt_query": "string",
  • "prompt_query": "string",
  • "hyde_no_rag_llm_prompt_extension": "string",
  • "pre_prompt_summary": "string",
  • "prompt_summary": "string",
  • "system_prompt_reflection": "string",
  • "prompt_reflection": "string",
  • "auto_gen_description_prompt": "string",
  • "auto_gen_document_summary_pre_prompt_summary": "string",
  • "auto_gen_document_summary_prompt_summary": "string",
  • "auto_gen_document_sample_questions_prompt": "string",
  • "default_sample_questions": [
    ],
  • "image_batch_image_prompt": "string",
  • "image_batch_final_prompt": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "lang": "string",
  • "system_prompt": "string",
  • "pre_prompt_query": "string",
  • "prompt_query": "string",
  • "hyde_no_rag_llm_prompt_extension": "string",
  • "pre_prompt_summary": "string",
  • "prompt_summary": "string",
  • "system_prompt_reflection": "string",
  • "prompt_reflection": "string",
  • "auto_gen_description_prompt": "string",
  • "auto_gen_document_summary_pre_prompt_summary": "string",
  • "auto_gen_document_summary_prompt_summary": "string",
  • "auto_gen_document_sample_questions_prompt": "string",
  • "default_sample_questions": [
    ],
  • "image_batch_image_prompt": "string",
  • "image_batch_final_prompt": "string",
  • "id": "string",
  • "is_default": true,
  • "user_count": 0,
  • "username": "string",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List prompt templates.

List all existing prompt templates.

Authorizations:
bearerAuth
query Parameters
offset
integer
Default: 0

How many prompt templates to skip before returning.

limit
integer
Default: 100

How many prompt templates to return.

sort_column
string
Default: "updated_at"
Enum: "name" "description" "is_default" "lang" "updated_at" "username" "user_count"

Sort column.

ascending
boolean
Default: true

When true, returns sorted by sort_column in ascending order.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Counts a number of prompt templates.

Counts a number of prompt templates.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "count": 0
}

Finds a prompt template by id.

Returns a single tag by its unique identifier.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template to return

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "lang": "string",
  • "system_prompt": "string",
  • "pre_prompt_query": "string",
  • "prompt_query": "string",
  • "hyde_no_rag_llm_prompt_extension": "string",
  • "pre_prompt_summary": "string",
  • "prompt_summary": "string",
  • "system_prompt_reflection": "string",
  • "prompt_reflection": "string",
  • "auto_gen_description_prompt": "string",
  • "auto_gen_document_summary_pre_prompt_summary": "string",
  • "auto_gen_document_summary_prompt_summary": "string",
  • "auto_gen_document_sample_questions_prompt": "string",
  • "default_sample_questions": [
    ],
  • "image_batch_image_prompt": "string",
  • "image_batch_final_prompt": "string",
  • "id": "string",
  • "is_default": true,
  • "user_count": 0,
  • "username": "string",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Updates attributes of a given prompt template.

Updates attributes of a given prompt template.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template to update

Request Body schema: application/json
required
name
string

A name of the prompt template.

description
string

A description of the prompt template.

lang
string

A language code.

system_prompt
string

A system prompt.

pre_prompt_query
string

A text that is prepended before the contextual document chunks.

prompt_query
string

A text that is appended to the beginning of the user's message.

hyde_no_rag_llm_prompt_extension
string

An LLM prompt extension.

pre_prompt_summary
string

A prompt that goes before each large piece of text to summarize.

prompt_summary
string

A prompt that goes after each large piece of text to summarize.

system_prompt_reflection
string

A system prompt for self-reflection.

prompt_reflection
string

A template for self-reflection, must contain two occurrences of %s for full previous prompt (including system prompt, document related context and prompts if applicable, and user prompts) and answer

auto_gen_description_prompt
string

A prompt to create a description of the collection.

auto_gen_document_summary_pre_prompt_summary
string

A pre_prompt_summary for summary of a freshly imported document (if enabled).

auto_gen_document_summary_prompt_summary
string

A prompt_summary for summary of a freshly imported document (if enabled).`

auto_gen_document_sample_questions_prompt
string

A prompt to create sample questions for a freshly imported document (if enabled).

default_sample_questions
Array of strings

Default sample questions in case there are no auto-generated sample questions.

image_batch_image_prompt
string

A prompt for each image batch for vision models.

image_batch_final_prompt
string

A prompt for each image batch for vision models.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "lang": "string",
  • "system_prompt": "string",
  • "pre_prompt_query": "string",
  • "prompt_query": "string",
  • "hyde_no_rag_llm_prompt_extension": "string",
  • "pre_prompt_summary": "string",
  • "prompt_summary": "string",
  • "system_prompt_reflection": "string",
  • "prompt_reflection": "string",
  • "auto_gen_description_prompt": "string",
  • "auto_gen_document_summary_pre_prompt_summary": "string",
  • "auto_gen_document_summary_prompt_summary": "string",
  • "auto_gen_document_sample_questions_prompt": "string",
  • "default_sample_questions": [
    ],
  • "image_batch_image_prompt": "string",
  • "image_batch_final_prompt": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "lang": "string",
  • "system_prompt": "string",
  • "pre_prompt_query": "string",
  • "prompt_query": "string",
  • "hyde_no_rag_llm_prompt_extension": "string",
  • "pre_prompt_summary": "string",
  • "prompt_summary": "string",
  • "system_prompt_reflection": "string",
  • "prompt_reflection": "string",
  • "auto_gen_description_prompt": "string",
  • "auto_gen_document_summary_pre_prompt_summary": "string",
  • "auto_gen_document_summary_prompt_summary": "string",
  • "auto_gen_document_sample_questions_prompt": "string",
  • "default_sample_questions": [
    ],
  • "image_batch_image_prompt": "string",
  • "image_batch_final_prompt": "string",
  • "id": "string",
  • "is_default": true,
  • "user_count": 0,
  • "username": "string",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Deletes a prompt template.

Deletes a prompt template with a given unique identifier.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template to delete

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Returns a list of access permissions for a given prompt template.

The returned list of permissions denotes who has access to the prompt template.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Removes sharing of a prompt template to all other users except the original owner.

Removes sharing of a prompt template to all other users except the original owner.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Shares a prompt template to a user.

Shares a prompt template to a user.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template

username
required
string

User name that will obtain access to the prompt template

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Removes sharing of a prompt template to a user.

Removes sharing of a prompt template to a user.

Authorizations:
bearerAuth
path Parameters
prompt_template_id
required
string

Id of a prompt template

username
required
string

User name that will lose access to the prompt template

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Tags

Creates a new tag.

Creates a new tag that can be subsequently associated with a document.

Authorizations:
bearerAuth
Request Body schema: application/json
required
name
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "marvel"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "marvel",
  • "description": "Stories based on Marvel's comics.",
  • "format": "string"
}

List tags.

List all existing tags.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Finds a tag by its name.

Returns a single tag by its unique name.

Authorizations:
bearerAuth
path Parameters
tag_name
required
string

Name of a tag to return

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "marvel",
  • "description": "Stories based on Marvel's comics.",
  • "format": "string"
}

Updates attributes of a tag.

Updates attributes of an existing tag, particularly description and format.

Authorizations:
bearerAuth
path Parameters
tag_name
required
string

Name of a tag to to be updated

Request Body schema: application/json
required
description
string
format
string

Responses

Request samples

Content type
application/json
{
  • "description": "string",
  • "format": "string"
}

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426655440000",
  • "name": "My sci-fi library",
  • "description": "Collection of my favourite sci-fi books",
  • "embedding_model": "BAAI/bge-large-en-v1.5",
  • "document_count": 0,
  • "document_size": 0,
  • "updated_at": "2019-08-24T14:15:22Z",
  • "user_count": 0,
  • "is_public": true,
  • "username": "string",
  • "sessions_count": 0,
  • "prompt_template_id": "4e400991-c459-455f-995c-dc6f55ffdb90"
}

List documents associated with a tag.

List documents associated with a tag.

Authorizations:
bearerAuth
path Parameters
tag_name
required
string

Name of a tag to return documents for

query Parameters
collection_id
required
string

Id of a collection containing the documents

Responses

Response samples

Content type
application/json
[
  • {
    }
]