BREAGEN Logo
Document Understanding

Wisdom Search

Generate Answer Endpoint POST /v1/api/wisdom_search/generate_answer

Resource URL/v1/api/wisdom_search/generate_answer
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Description

Generate an answer to a user question based solely on the provided context.

Parameters

ParameterDescriptionRequiredTypeDefault Value
system_prompt_templateTemplate for the AI system promptNoString"You are an AI assistant that provides accurate and helpful answers to user questions based solely on the provided context. Your responses should only include information found in the context. If the answer is not available within the context, politely inform the user that the information is not provided.\n\nInstructions:\n\n- Carefully read and analyze the context before answering.\n- Provide clear and concise answers.\n- Reference specific parts of the context when relevant.\n- Do not include personal opinions or external knowledge.\n- Maintain a neutral and professional tone.\n"
user_prompt_templateTemplate for the user prompt including context and questionNoString"\nContext:\n\n{facts}\n\nQuestion:\n\n{question}\n"

Request Body

ParameterDescriptionRequiredTypeDefault Value
contextsArray of context stringsYesArray[String]N/A
questionThe question to be answeredYesStringN/A

Example Request

curl -X 'POST' \
'https://braegen.ai/v1/api/wisdom_search/generate_answer?system_prompt_template=You%20are%20an%20AI%20assistant...&user_prompt_template=%0AContext%3A%0A%0A%7Bfacts%7D%0A%0AQuestion%3A%0A%0A%7Bquestion%7D%0A' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'contexts=Revenue%20is%20%24500k&contexts=Target%20client%20is%20ABC%20Corp&question=What%20is%20the%20revenue%20potential%3F'

Example Request

{
    "is_error": false,
    "message": "Answer generated successfully",
    "results": {
        "answer": "The revenue potential is $500k, as stated in the provided context."
    }
}

HTTP Response

HTTP CodeMessage
200Successful Response
422Validation Error

On this page