Create Assistant

Create Assistant

This method allows you to create a new agent. The agent requires an LLM to be used for generating completions, so you need to make sure the corresponding Model Endpoint has been deployed in the same namespace as this PAIS instance. You can use the List Models method to view all available LLMs.

An agent can also be configured to use an index to enhance the context that is sent to the LLM. You can use the List indexes across all knowledge bases method to view all available knowledge base indexes that you can use.

Request
URI
POST
https://{api_host}/api/v1/compatibility/openai/v1/assistants
COPY
Request Body
AgentCreateRequest of type(s) application/json
Required

Show optional properties

{
    "session_max_length": 0,
    "session_summarization_strategy": "string",
    "model": "string"
}
{
    "name": "string",
    "description": "string",
    "instructions": "string",
    "session_max_ttl": 0,
    "completion_role": "string",
    "index_id": "string",
    "index_top_n": 0,
    "index_similarity_cutoff": "number",
    "index_reference_format": "string",
    "index_reference_delimiter": "string",
    "session_max_length": 0,
    "session_summarization_strategy": "string",
    "metadata": {
        "metadata": "string"
    },
    "model": "string",
    "chat_system_instruction_mode": "string"
}
string
name
Optional
Constraints: maxLength: 256

Name of the agent.

string
description
Optional
Constraints: maxLength: 512

Description of the agent.

string
instructions
Optional
Constraints: maxLength: 32768

System instructions used by the agent.

integer
session_max_ttl
Optional
Constraints: exclusiveMinimum: 0

Agent sessions that have not been written to within this many seconds are subject to deletion.

string
completion_role
Optional
Constraints: default: assistant

Response role for completions created by the agent.

string As uuid As uuid
index_id
Optional

Data Indexing and Retrieval index to be used by the agent.

integer
index_top_n
Optional
Constraints: exclusiveMinimum: 0

Top N chunks the agent should request from Data Indexing and Retrieval when fetching context from the index.

number
index_similarity_cutoff
Optional

Chunk similarity the agent should request from Data Indexing and Retrieval when fetching context from the index.

string
index_reference_format
Optional

Format in which index text references are returned by the agent.

Possible values are : structured, markdown,
string
index_reference_delimiter
Optional

Delimiter string to separate the agent completions response from the index references.

integer
session_max_length
Required
Constraints: exclusiveMinimum: 0

Sessions that exceed this length (in characters) will get summarized before new data is added. This value must be small enough to fit into the context window of the LLM used by this assistant (including any additional prompts sent to the LLM).

string
session_summarization_strategy
Required

Strategy for summarizing an agent session once it exceeds the configured maximum session length.

object
metadata
Optional
Constraints: default: [object Object]

Set of up to 16 key-value pairs attached to this agent.

string
model
Required
Constraints: maxLength: 128

ID of the model to be used by the agent for generating completions.

string
chat_system_instruction_mode
Optional
Constraints: default: system-message

Agent setting that decides how system instructions are sent to the LLM when generating completions. For LLMs supporting "system messages", this is the most robust choice, but not all LLMs support this type of instructions.

Possible values are : system-message, prompt-prefix,
Authentication
This operation uses the following authentication methods.
Responses
201

Successful Response

Returns Agent of type(s) application/json
"Agent Object"
string
name
Optional
Constraints: maxLength: 256

Name of the agent.

string
description
Optional
Constraints: maxLength: 512

Description of the agent.

string
instructions
Optional
Constraints: maxLength: 32768

System instructions used by the agent.

integer
session_max_ttl
Optional
Constraints: exclusiveMinimum: 0

Agent sessions that have not been written to within this many seconds are subject to deletion.

string
completion_role
Optional
Constraints: default: assistant

Response role for completions created by the agent.

string As uuid As uuid
index_id
Optional

Data Indexing and Retrieval index to be used by the agent.

integer
index_top_n
Optional
Constraints: exclusiveMinimum: 0

Top N chunks the agent should request from Data Indexing and Retrieval when fetching context from the index.

number
index_similarity_cutoff
Optional

Chunk similarity the agent should request from Data Indexing and Retrieval when fetching context from the index.

string
index_reference_format
Optional

Format in which index text references are returned by the agent.

Possible values are : structured, markdown,
string
index_reference_delimiter
Optional

Delimiter string to separate the agent completions response from the index references.

integer
session_max_length
Required
Constraints: exclusiveMinimum: 0

Sessions that exceed this length (in characters) will get summarized before new data is added. This value must be small enough to fit into the context window of the LLM used by this assistant (including any additional prompts sent to the LLM).

string
session_summarization_strategy
Required

Strategy for summarizing an agent session once it exceeds the configured maximum session length.

object
metadata
Optional
Constraints: default: [object Object]

Set of up to 16 key-value pairs attached to this agent.

string As uuid As uuid
id
Required

ID of the agent.

string
object
Optional
Constraints: default: agent

Object type, which is always agent.

integer
created_at
Required

Unix timestamp (in seconds) when the agent was created.

string
model
Required
Constraints: maxLength: 128

ID of the model to be used by the agent for generating completions.

string
status
Required

Availability status of an agent.

Possible values are : AVAILABLE, ERROR,
array of string
status_errors
Optional

Details of the agent error status, if the agent is not available.

Possible values are : AGENT_ID_NOT_FOUND, FAILED_TO_PAGINATE_LIST, AGENT_SESSION_ID_NOT_FOUND, INDEX_NOT_FOUND, INDEX_NOT_REACHABLE, ROUTE_TO_MODEL_NOT_FOUND, INVALID_MODEL_TYPE_FOR_AGENT, AGENT_SESSION_EXPIRED, UNEXPECTED_MODEL, INVALID_RESPONSE_FROM_MODEL_ENDPOINT, INVALID_INFERENCE_REQUEST_FOR_MODEL_TYPE, DISALLOWED_ROLE, VALIDATION_ERROR, MAX_LENGTH_METADATA_REACHED, INVALID_AGENT_ATTRIBUTE, KNOWLEDGE_BASE_INVALID_STATE, DATA_SOURCE_NOT_FOUND, DATA_SOURCE_STILL_LINKED_TO_KNOWLEDGE_BASE, KNOWLEDGE_BASE_NOT_FOUND, DOCUMENT_NOT_FOUND, EMPTY_DOCUMENT_FILE, DOCUMENT_EXCEEDS_MAX_UPLOAD_SIZE, INDEXING_NOT_FOUND, NO_ACTIVE_INDEXING, ERROR_NOT_FOUND, INDEX_FOR_KNOWLEDGE_BASE_ALREADY_EXISTS, UNSUPPORTED_CONFIGURATION, PENDING_INDEXING_ALREADY_EXISTS_FOR_KB, CREATING_INDEXING_FOR_LOCAL_FILES_KB_NOT_ALLOWED, KNOWLEDGE_BASE_DATA_SOURCE_NOT_UNLINKING, KNOWLEDGE_BASE_DATA_SOURCE_NOT_FOUND, KNOWLEDGE_BASE_DATA_SOURCE_ALREADY_EXISTS, KNOWLEDGE_BASE_LINK_DATA_SOURCE_NOT_SUPPORTED, KNOWLEDGE_BASE_UPLOAD_NOT_SUPPORTED_FOR_DATA_SOURCE, KNOWLEDGE_BASE_DELETE_NOT_SUPPORTED_FOR_DATA_SOURCE, KNOWLEDGE_BASE_DELETE_NOT_SUPPORTED_WHILE_AGENT_IS_LINKED, KNOWLEDGE_BASE_DELETE_CONFLICT, DOCUMENT_NOT_IN_DELETABLE_STATE, COMPLETION_MODEL_ENDPOINT_UNAVAILABLE, EMBEDDING_MODEL_ENDPOINT_UNAVAILABLE, EMBEDDING_MODEL_ENDPOINT_BAD_TYPE,
string
chat_system_instruction_mode
Optional
Constraints: default: system-message

Agent setting that decides how system instructions are sent to the LLM when generating completions. For LLMs supporting "system messages", this is the most robust choice, but not all LLMs support this type of instructions.

Possible values are : system-message, prompt-prefix,

404

Endpoint with requested model does not exist

Operation doesn't return any data structure

422

Validation Error

Returns HTTPValidationError of type(s) application/json
"HTTPValidationError Object"
array of object
detail
Optional

detail


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"session_max_length:"integer","session_summarization_strategy:"string","model:"string"}' https://{api_host}/api/v1/compatibility/openai/v1/assistants