Generate an AI response grounded in your documents. Retrieves relevant chunks from the specified vector stores and uses them as context for the LLM (Retrieval-Augmented Generation).
curl Python
curl -X POST https://api.upstage.ai/v2/responses \
-H "Authorization: Bearer $UPSTAGE_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "solar-pro4",
"input": "What are the key features?",
"tools": [
{
"type": "file_search",
"vector_store_ids": ["vs_abc123def456"],
"max_num_results": 5
}
]
}'
{
"id" : "resp_abc123" ,
"object" : "response" ,
"created_at" : 1711645000 ,
"model" : "solar-pro4" ,
"output" : [
{
"type" : "file_search_call" ,
"id" : "fs_call_001" ,
"status" : "completed" ,
"queries" : [ "What are the key features?" ],
"results" : [
{
"file_id" : "file_xyz789" ,
"filename" : "features.pdf" ,
"text" : "The key features include..." ,
"score" : 0.95 ,
"attributes" : {}
}
]
},
{
"type" : "message" ,
"id" : "msg_001" ,
"role" : "assistant" ,
"content" : [
{
"type" : "output_text" ,
"text" : "Based on the documents, the key features are..." ,
"annotations" : []
}
]
}
]
}
Set stream=True to receive Server-Sent Events (SSE) in real-time.
curl Python
curl -X POST https://api.upstage.ai/v2/responses \
-H "Authorization: Bearer $UPSTAGE_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "solar-pro4",
"input": "Summarize the document.",
"tools": [
{
"type": "file_search",
"vector_store_ids": ["vs_abc123def456"]
}
],
"stream": true
}'
Event Description response.createdResponse object created. file_search_call.searchingFile search is in progress. file_search_call.completedFile search completed with results. output_text.deltaIncremental text chunk from the LLM. output_text.doneLLM text generation completed. response.completedFull response completed. [DONE]Final signal indicating the stream has ended.