h2oGPTe REST API (v1.0.0)
Download OpenAPI specification:Download
Users can easily interact with the h2oGPTe API through its REST API, allowing HTTP requests from any programming language.
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.
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"
}'
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.
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:
Request Body schema: application/jsonrequired
name required | string |
description required | string |
embedding_model | string |
object (CollectionSettings) |
Responses
Request samples
- Payload
{- "name": "My sci-fi library",
- "description": "Collection of my favourite sci-fi books",
- "embedding_model": "BAAI/bge-large-en-v1.5",
- "collection_settings": {
- "max_tokens_per_chunk": 320,
- "chunk_overlap_tokens": 0,
- "guardrails_settings": {
- "disallowed_regex_patterns": [
- "secret_disallowed_word",
- "(?!0{3})(?!6{3})[0-8]\\d{2}-(?!0{2})\\d{2}-(?!0{4})\\d{4}"
], - "presidio_labels_to_flag": [
- "IBAN_CODE",
- "US_SSN"
], - "pii_labels_to_flag": [
- "IBAN",
- "SSN"
], - "pii_detection_parse_action": "allow",
- "pii_detection_llm_input_action": "allow",
- "pii_detection_llm_output_action": "allow",
- "prompt_guard_labels_to_flag": [
- "JAILBREAK"
], - "guardrails_labels_to_flag": [
- "Violent Crimes",
- "Non-Violent Crimes",
- "Intellectual Property",
- "Code Interpreter Abuse"
], - "guardrails_entities": {
- "Safe": "Messages that do not contain any of the following unsafe content",
- "Violent Crimes": "Messages that enable, encourage, or endorse the commission of violent crimes, including: (1) unlawful violence toward people (ex: terrorism, genocide, murder, hate-motivated violent crimes, child abuse, assault, battery, kidnapping) and (2) unlawful violence toward animals (ex: animal abuse)",
- "Non-Violent Crimes": "Messages that enable, encourage, or endorse the commission of non-violent crimes, including: (1) personal crimes (ex: labor trafficking, threats, intimidation, hate-motivated non-violent crimes), (2) financial crimes (ex: fraud, scams, money laundering), (3) property crimes (ex: theft, arson, vandalism), (4) drug crimes (ex: creating or using regulated substances), (5) weapons crimes (ex: producing unlicensed firearms), and (6) cyber crimes (ex: hacking)",
- "Defamation": "Messages that are both verifiably false and likely to injure a living person’s reputation",
- "Specialized Advice": "Messages that contain specialized financial, medical, or legal advice, or that indicate dangerous activities or objects are safe",
- "Intellectual Property": "Messages that may violate the intellectual property rights of any third party",
- "Code Interpreter Abuse": "Messages that seek to abuse code interpreters, including those that enable denial of service attacks, container escapes or privilege escalation exploits"
}
}
}
}
Response samples
- 201
- 401
- default
{- "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:
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
- 200
- 401
- default
[- {
- "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"
}
]
Get a Collection
A user can obtain a Collection by specifying its ID.
Authorizations:
path Parameters
collection_id required | string Id of collection to return |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
collection_id required | string Id of collection to delete |
query Parameters
timeout | integer Default: 300 Timeout in seconds |
Responses
Response samples
- 401
- default
{- "code": 0,
- "message": "string"
}
Updates attributes of an existing collection.
Updates of an existing collection, particularly name and description.
Authorizations:
path Parameters
collection_id required | string Id of collection to to be updated |
Request Body schema: application/jsonrequired
name | string |
description | string |
Responses
Request samples
- Payload
{- "name": "string",
- "description": "string"
}
Response samples
- 200
- 401
- default
{- "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:
path Parameters
collection_id required | string Id of the collection |
Request Body schema: application/jsonrequired
prompt_template_id | string |
Responses
Request samples
- Payload
{- "prompt_template_id": "string"
}
Response samples
- 200
- 401
- default
{- "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:
path Parameters
collection_id required | string Id of the collection |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
collection_id required | string Id of the collection associated with the settings |
Responses
Response samples
- 200
- 401
- default
{- "max_tokens_per_chunk": 320,
- "chunk_overlap_tokens": 0,
- "guardrails_settings": {
- "disallowed_regex_patterns": [
- "secret_disallowed_word",
- "(?!0{3})(?!6{3})[0-8]\\d{2}-(?!0{2})\\d{2}-(?!0{4})\\d{4}"
], - "presidio_labels_to_flag": [
- "IBAN_CODE",
- "US_SSN"
], - "pii_labels_to_flag": [
- "IBAN",
- "SSN"
], - "pii_detection_parse_action": "allow",
- "pii_detection_llm_input_action": "allow",
- "pii_detection_llm_output_action": "allow",
- "prompt_guard_labels_to_flag": [
- "JAILBREAK"
], - "guardrails_labels_to_flag": [
- "Violent Crimes",
- "Non-Violent Crimes",
- "Intellectual Property",
- "Code Interpreter Abuse"
], - "guardrails_entities": {
- "Safe": "Messages that do not contain any of the following unsafe content",
- "Violent Crimes": "Messages that enable, encourage, or endorse the commission of violent crimes, including: (1) unlawful violence toward people (ex: terrorism, genocide, murder, hate-motivated violent crimes, child abuse, assault, battery, kidnapping) and (2) unlawful violence toward animals (ex: animal abuse)",
- "Non-Violent Crimes": "Messages that enable, encourage, or endorse the commission of non-violent crimes, including: (1) personal crimes (ex: labor trafficking, threats, intimidation, hate-motivated non-violent crimes), (2) financial crimes (ex: fraud, scams, money laundering), (3) property crimes (ex: theft, arson, vandalism), (4) drug crimes (ex: creating or using regulated substances), (5) weapons crimes (ex: producing unlicensed firearms), and (6) cyber crimes (ex: hacking)",
- "Defamation": "Messages that are both verifiably false and likely to injure a living person’s reputation",
- "Specialized Advice": "Messages that contain specialized financial, medical, or legal advice, or that indicate dangerous activities or objects are safe",
- "Intellectual Property": "Messages that may violate the intellectual property rights of any third party",
- "Code Interpreter Abuse": "Messages that seek to abuse code interpreters, including those that enable denial of service attacks, container escapes or privilege escalation exploits"
}
}
}
Updates collection settings.
Recreates entire settings on the collection.
Authorizations:
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
- Payload
{- "max_tokens_per_chunk": 320,
- "chunk_overlap_tokens": 0,
- "guardrails_settings": {
- "disallowed_regex_patterns": [
- "secret_disallowed_word",
- "(?!0{3})(?!6{3})[0-8]\\d{2}-(?!0{2})\\d{2}-(?!0{4})\\d{4}"
], - "presidio_labels_to_flag": [
- "IBAN_CODE",
- "US_SSN"
], - "pii_labels_to_flag": [
- "IBAN",
- "SSN"
], - "pii_detection_parse_action": "allow",
- "pii_detection_llm_input_action": "allow",
- "pii_detection_llm_output_action": "allow",
- "prompt_guard_labels_to_flag": [
- "JAILBREAK"
], - "guardrails_labels_to_flag": [
- "Violent Crimes",
- "Non-Violent Crimes",
- "Intellectual Property",
- "Code Interpreter Abuse"
], - "guardrails_entities": {
- "Safe": "Messages that do not contain any of the following unsafe content",
- "Violent Crimes": "Messages that enable, encourage, or endorse the commission of violent crimes, including: (1) unlawful violence toward people (ex: terrorism, genocide, murder, hate-motivated violent crimes, child abuse, assault, battery, kidnapping) and (2) unlawful violence toward animals (ex: animal abuse)",
- "Non-Violent Crimes": "Messages that enable, encourage, or endorse the commission of non-violent crimes, including: (1) personal crimes (ex: labor trafficking, threats, intimidation, hate-motivated non-violent crimes), (2) financial crimes (ex: fraud, scams, money laundering), (3) property crimes (ex: theft, arson, vandalism), (4) drug crimes (ex: creating or using regulated substances), (5) weapons crimes (ex: producing unlicensed firearms), and (6) cyber crimes (ex: hacking)",
- "Defamation": "Messages that are both verifiably false and likely to injure a living person’s reputation",
- "Specialized Advice": "Messages that contain specialized financial, medical, or legal advice, or that indicate dangerous activities or objects are safe",
- "Intellectual Property": "Messages that may violate the intellectual property rights of any third party",
- "Code Interpreter Abuse": "Messages that seek to abuse code interpreters, including those that enable denial of service attacks, container escapes or privilege escalation exploits"
}
}
}
Response samples
- 401
- default
{- "code": 0,
- "message": "string"
}
List a Collection's documents
A user can list a Collection's documents.
Authorizations:
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
- 200
- 401
- default
[- {
- "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"
}
]
Import an already stored document to an existing collection.
Import an already stored document to an existing collection.
Authorizations:
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 |
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. |
handwriting_check | boolean Default: false Check pages for handwriting. Will use specialized models if handwriting is found. |
Responses
Response samples
- 401
- default
{- "code": 0,
- "message": "string"
}
Removes the document from the collection.
Removes the document from the collection.
Authorizations:
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
- 401
- default
{- "code": 0,
- "message": "string"
}
List chat sessions for a given collection.
List chat sessions for a given collection.
Authorizations:
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
- 200
- 401
- default
[- {
- "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 suggested questions for a given collection.
List suggested questions for a given collection.
Authorizations:
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
- 200
- 401
- default
[- {
- "question": "string"
}
]
Returns a list of access permissions for a given collection.
The returned list of permissions denotes who has access to the collection.
Authorizations:
path Parameters
collection_id required | string Id of the collection. |
Responses
Response samples
- 200
- 401
- default
[- {
- "username": "string"
}
]
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:
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
- 200
- 401
- default
[- {
- "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"
}
]
Finds a document by id.
Returns a single document by its unique identifier.
Authorizations:
path Parameters
document_id required | string Id of document to return |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
document_id required | string Id of document to delete |
query Parameters
timeout | integer Default: 300 Timeout in seconds |
Responses
Response samples
- 401
- default
{- "code": 0,
- "message": "string"
}
Updates attributes of an existing document.
Updates attributes of an existing document, particularly name and uri.
Authorizations:
path Parameters
document_id required | string Id of document to to be updated |
Request Body schema: application/jsonrequired
name | string |
uri | string |
Responses
Request samples
- Payload
{- "name": "string",
- "uri": "string"
}
Response samples
- 200
- 401
- default
{- "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:
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
- 200
- 401
- default
[- {
- "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"
}
]
Assigns a tag to the document.
Assigns a tag to the document.
Authorizations:
path Parameters
document_id required | string Id of the document to to be associated with a tag |
Request Body schema: application/jsonrequired
name required | string |
Responses
Request samples
- Payload
{- "name": "marvel"
}
Response samples
- 201
- 401
- default
{- "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:
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
- 401
- default
{- "code": 0,
- "message": "string"
}
List chat sessions for a given document.
List chat sessions for a given document.
Authorizations:
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
- 200
- 401
- default
[- {
- "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"
}
]
Ingest uploaded document
Ingests uploaded document identified to a given collection
Authorizations:
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
- 401
- default
{- "code": 0,
- "message": "string"
}
Creates chat session.
Creates chat session with a collection if provided. Otherwise, the session will be with a generic LLM.
Authorizations:
query Parameters
collection_id | string Id of collection |
Responses
Response samples
- 200
- 401
- default
{- "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:
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
- 200
- 401
- default
[- {
- "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"
}
]
Finds a chat session by id.
Returns a single chat session by its unique identifier.
Authorizations:
path Parameters
session_id required | string Id of the chat session |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
query Parameters
timeout | integer Default: 300 Timeout in seconds |
Responses
Response samples
- 204
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
Request Body schema: application/json
name required | string |
Responses
Request samples
- Payload
{- "name": "string"
}
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
Request Body schema: application/jsonrequired
collection_id required | string |
Responses
Request samples
- Payload
{- "collection_id": "string"
}
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
Request Body schema: application/jsonrequired
prompt_template_id | string |
Responses
Request samples
- Payload
{- "prompt_template_id": "string"
}
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of the chat session |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
session_id required | string Id of a chat session |
Request Body schema: application/jsonrequired
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.
| |
object (ChatCompletionSelfReflectionConfig) A map with self reflection settings:
| |
rag_config | object (ChatCompletionRAGConfig) A map with arguments to control RAG (retrieval-augmented-generation) types.:
|
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
- Payload
{- "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": [
- "string"
], - "stream": false
}
Response samples
- 200
- 401
- default
{- "body": "The strongest here is Superman!"
}
List suggested questions for a given chat session.
List suggested questions for a given chat session.
Authorizations:
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
- 200
- 401
- default
[- {
- "question": "string"
}
]
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:
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
- 200
- 401
- default
[- {
- "id": "123e4567-e89b-12d3-a456-426655440000",
- "content": "string",
- "votes": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "has_references": true,
- "total_references": 0,
- "username": "string",
- "reply_to": "string",
- "error": "string",
- "type_list": [
- {
- "message_type": "string",
- "content": "string"
}
]
}
]
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:
path Parameters
message_id required | string Id of the chat message |
Responses
Response samples
- 200
- 401
- default
[- {
- "collection_id": "string",
- "document_id": "string",
- "document_name": "string",
- "chunk_id": 0,
- "pages": "string",
- "content": "string",
- "were_references_deleted": true
}
]
Fetches chat message meta information.
Fetches chat message meta information.
Authorizations:
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
- 200
- 401
- default
[- {
- "message_type": "string",
- "content": "string"
}
]
Creates a new prompt template.
Creates a new prompt template that can be subsequently associated with a collection.
Authorizations:
Request Body schema: application/jsonrequired
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 |
auto_gen_document_summary_prompt_summary | string A |
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
- Payload
{- "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": [
- "string"
], - "image_batch_image_prompt": "string",
- "image_batch_final_prompt": "string"
}
Response samples
- 201
- 401
- default
{- "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": [
- "string"
], - "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:
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
- 200
- 401
- default
[- {
- "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": [
- "string"
], - "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"
}
]
Finds a prompt template by id.
Returns a single tag by its unique identifier.
Authorizations:
path Parameters
prompt_template_id required | string Id of a prompt template to return |
Responses
Response samples
- 200
- 401
- default
{- "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": [
- "string"
], - "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:
path Parameters
prompt_template_id required | string Id of a prompt template to update |
Request Body schema: application/jsonrequired
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 |
auto_gen_document_summary_prompt_summary | string A |
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
- Payload
{- "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": [
- "string"
], - "image_batch_image_prompt": "string",
- "image_batch_final_prompt": "string"
}
Response samples
- 200
- 401
- default
{- "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": [
- "string"
], - "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"
}
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:
path Parameters
prompt_template_id required | string Id of a prompt template |
Responses
Response samples
- 200
- 401
- default
[- {
- "username": "string"
}
]
Creates a new tag.
Creates a new tag that can be subsequently associated with a document.
Authorizations:
Request Body schema: application/jsonrequired
name required | string |
Responses
Request samples
- Payload
{- "name": "marvel"
}
Response samples
- 201
- 401
- default
{- "id": "123e4567-e89b-12d3-a456-426655440000",
- "name": "marvel",
- "description": "Stories based on Marvel's comics.",
- "format": "string"
}
Finds a tag by its name.
Returns a single tag by its unique name.
Authorizations:
path Parameters
tag_name required | string Name of a tag to return |
Responses
Response samples
- 200
- 401
- default
{- "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:
path Parameters
tag_name required | string Name of a tag to to be updated |
Request Body schema: application/jsonrequired
description | string |
format | string |
Responses
Request samples
- Payload
{- "description": "string",
- "format": "string"
}
Response samples
- 200
- 401
- default
{- "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:
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
- 200
- 401
- default
[- {
- "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"
}
]