Search context and generate an LLM-powered answer
Changed onThis endpoint performs a context search using the context processor, joins all matching context chunks into a single string, then sends that joined context along with the user's query to an LLM to produce a natural-language answer grounded in the retrieved context.
By default the response only includes the generated answer. Pass ?context=true to also receive the joined context string that was used to ground the answer.
Request
- Base URLhttps://platform-backend.getalchemystai.com
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
Controls the search mode:
- mode=fast -> prioritizes speed over completeness.
- mode=standard -> performs a comprehensive search (default if omitted).
When set to true, the response includes the joined context string used to ground the answer. Defaults to false (only answer,and usage are returned).
Request body
Example request
{
"user_id": "user123",
"steeringPrompt": "Return only the basic details of the person in a structured JSON schema with the fields \"name\", \"status\", \"location\"",
"query": "What did the customer ask about pricing for the Scale plan?",
"similarity_threshold": 0.8,
"minimum_similarity_threshold": 0.5,
"body_metadata": {
"fileName": "support_thread_TCK-1234.txt",
"lastModifiedAt": "2025-01-10T12:34:56.000Z"
},
"magic_key": "sk_context_share_nC0KUEF9T6UGDHYVUiMU"
}Response
Successfully retrieved context and generated an answer.
Changes
- breaking
removed the required property
from the response with the status - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
/ - info
added the new optional request property
- breaking
- info
added the required property
to the response with the status
- info