POST
/api/v1/chat/templates
Create a new chat template.
Templates store reusable chat configurations including persona,
system prompts, RAG settings, and LLM parameters.
Args:
template: Template configuration (id optional, will be generated)
conn: Database connection (injected)
Returns:
Created template with generated ID
Raises:
HTTPException: 400 if validation fails, 500 on database error
ChatTemplateA reusable chat template with persona and configuration defaults.
object
Namestring
>= 1 characters <= 100 characters
is_public
Is PublicWhether template is publicly visible
boolean
instructions
InstructionsArray<string>
RoleConfigRole configuration with system prompt
object
System PromptThe system prompt defining the role’s behavior
string
default_context_mode
ContextModeHow to provide context to the LLM.
string
default: rag
Allowed values: rag attachment hybrid document none
default_rag_config
Any of:
RAGConfigComplete RAG configuration for a chat query.
object
SourcesArray<object>
>= 1 items <= 10 items
DataSourceConfigConfiguration for a single data source in RAG.
object
metadata_filters
Any of:
object
key additional properties
limit
Limitinteger
default: 5 >= 1 <= 50
similarity_threshold
Similarity Thresholdnumber
default: 0.5 <= 1
weight
Weightnumber
default: 1 <= 10
retrieval_strategy
RetrievalStrategyHow to combine results from multiple sources.
string
default: merge
Allowed values: merge sequential ensemble
max_total_results
Max Total Resultsinteger
default: 10 >= 1 <= 50
include_content
Include Contentboolean
default: true
default_attachment_config
Any of:
AttachmentConfigConfiguration for attachment-based context retrieval.
object
attachments
AttachmentsExplicit document attachments
Array<object>
<= 20 items
AttachmentA document attachment for explicit context selection.
object
Storage KeyStorage path to the document
string
include_full_content
Include Full ContentInclude full document content (vs summary/excerpts)
boolean
default: true
llm_model
Llm Modelstring
default: gpt-4o-mini
temperature
Temperaturenumber
default: 0.7 <= 2
max_tokens
Max Tokensinteger
default: 2048 >= 100 <= 8000
ChatTemplateA reusable chat template with persona and configuration defaults.
object
Namestring
>= 1 characters <= 100 characters
is_public
Is PublicWhether template is publicly visible
boolean
instructions
InstructionsArray<string>
RoleConfigRole configuration with system prompt
object
System PromptThe system prompt defining the role’s behavior
string
default_context_mode
ContextModeHow to provide context to the LLM.
string
default: rag
Allowed values: rag attachment hybrid document none
default_rag_config
Any of:
RAGConfigComplete RAG configuration for a chat query.
object
SourcesArray<object>
>= 1 items <= 10 items
DataSourceConfigConfiguration for a single data source in RAG.
object
metadata_filters
Any of:
object
key additional properties
limit
Limitinteger
default: 5 >= 1 <= 50
similarity_threshold
Similarity Thresholdnumber
default: 0.5 <= 1
weight
Weightnumber
default: 1 <= 10
retrieval_strategy
RetrievalStrategyHow to combine results from multiple sources.
string
default: merge
Allowed values: merge sequential ensemble
max_total_results
Max Total Resultsinteger
default: 10 >= 1 <= 50
include_content
Include Contentboolean
default: true
default_attachment_config
Any of:
AttachmentConfigConfiguration for attachment-based context retrieval.
object
attachments
AttachmentsExplicit document attachments
Array<object>
<= 20 items
AttachmentA document attachment for explicit context selection.
object
Storage KeyStorage path to the document
string
include_full_content
Include Full ContentInclude full document content (vs summary/excerpts)
boolean
default: true
llm_model
Llm Modelstring
default: gpt-4o-mini
temperature
Temperaturenumber
default: 0.7 <= 2
max_tokens
Max Tokensinteger
default: 2048 >= 100 <= 8000
HTTPValidationError object
detail
DetailArray<object>
ValidationError object