v2
OpenAPI 3.0.02026-08-051996591.2 MBChats
Create a new turn in the chat
Creates a new turn in the chat. Each chat has a series of turn objects. Each turn is a message and response pair in the dialog.
post/v2/chats/{chat_id}/turns
Path parameters
chat_idstring required
The ID of the chat.
Headers
Request-Timeoutinteger
The platform makes a best effort to complete the request in the specified seconds, or it times out.
Request-Timeout-Millisinteger
The platform makes a best effort to complete the request in the specified milliseconds, or it times out.
Request body
Example request
{
"query": "What are the carbon reduction efforts by EU banks in 2023?",
"search": {
"limit": 50
},
"generation": {
"generation_preset_name": "mockingbird-2.0",
"prompt_name": "mockingbird-2.0",
"prompt_template": "[\n {\"role\": \"system\", \"content\": \"You are a helpful search assistant.\"},\n #foreach ($qResult in $vectaraQueryResults)\n {\"role\": \"user\", \"content\": \"Given the $vectaraIdxWord[$foreach.index] search result.\"},\n {\"role\": \"assistant\", \"content\": \"${qResult.getText()}\" },\n #end\n {\"role\": \"user\", \"content\": \"Generate a summary for the query '${vectaraQuery}' based on the above results.\"}\n]\n",
"prompt_text": "[\n {\"role\": \"system\", \"content\": \"You are a helpful search assistant.\"},\n #foreach ($qResult in $vectaraQueryResults)\n {\"role\": \"user\", \"content\": \"Given the $vectaraIdxWord[$foreach.index] search result.\"},\n {\"role\": \"assistant\", \"content\": \"${qResult.getText()}\" },\n #end\n {\"role\": \"user\", \"content\": \"Generate a summary for the query '${vectaraQuery}' based on the above results.\"}\n]\n",
"max_response_characters": 300,
"model_parameters": {
"llm_name": "gpt4"
},
"citations": {
"url_pattern": "https://vectara.com/documents/{doc.id}",
"text_pattern": "{doc.title}"
}
}
}Response
A response to a chat request.
Example response
{
"chat_id": "cht_123456789",
"turn_id": "trn_987654321",
"answer": "EU banks in 2023 have increased carbon reduction initiatives by 20%, driven by new EU regulations mandating annual emissions reporting.",
"search_results": [
{
"score": 0.92,
"document_metadata": {
"industry": "banking",
"year": 2023,
"doc_type": "annual_report"
},
"document_id": "financial-report-2023",
"corpus_key": "fin_docs",
"part_metadata": {
"section": "executive_summary"
},
"text": "EU banks reported a 20% increase in carbon reduction initiatives in 2023, driven by regulatory pressure.",
"table": {
"id": "billing_table_111",
"title": "Carbon Reduction Metrics",
"data": {
"headers": [
[
{
"text_value": "Bank A",
"colspan": 1,
"rowspan": 1
}
]
],
"rows": [
[
{
"text_value": "Bank A",
"colspan": 1,
"rowspan": 1
}
]
]
},
"description": "Summary of carbon reduction efforts by EU banks in 2023."
},
"image": {
"id": "chart_1",
"title": "Quarterly Sales Performance",
"caption": "Sales growth trends for Q1 to Q4 of 2024",
"description": "A bar chart showing quarterly sales growth, with Q4 outperforming all previous quarters by 15%",
"mime_type": "image/jpeg"
}
}
],
"rendered_prompt": "[{\"role\": \"system\", \"content\": \"You are an ESG analyst.\"}, {\"role\": \"user\", \"content\": \"What are the carbon reduction initiatives by EU banks in 2023?\"}, {\"role\": \"assistant\", \"content\": \"${vectaraQueryResults[0].getText()}\"}]",
"rephrased_query": "Carbon reduction efforts by EU banks in 2023?",
"rewritten_queries": [
{
"corpus_key": "fin_docs",
"filter_extraction": {
"query": "ESG compliance trends in EU",
"metadata_filter": "doc.industry = 'banking' AND doc.year = 2023"
}
},
{
"corpus_key": "legal_docs",
"filter_extraction": {
"query": "ESG regulations for EU banks 2023",
"metadata_filter": "doc.jurisdiction = 'EU' AND doc.year = 2023"
}
}
]
}