Setting the Q&A Prompt for Knowledge Base Search
Function
This API is used to set the knowledge base search Q&A prompt. The prompt contains the reference document placeholder {0} and search query placeholder {1}. Different prompts can be configured based on different application scenarios. For example, you can add manual settings, restrictions, and answer format requirements to help the model generate better answers.
URI
POST /v1/koosearch/repos/{repo_id}/search-prompt
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repo_id |
Yes |
String |
Knowledge base ID. The value is a string of 1 to 64 characters and can contain only digits, letters, hyphens (-), and underscores (_). How to obtain: Log in to the KooSearch experience platform. In the navigation tree on the left, choose Knowledge Bases to view knowledge base IDs. Each knowledge base has a unique ID stored in the vector database. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Parameter description: Token used for API authentication. For how to obtain the token, see section 3.2 "Authentication." Constraints: N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
prompt |
Yes |
String |
Prompt content. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
repo_id |
String |
Knowledge base ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
|
error_msg |
String |
Error description |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
|
error_msg |
String |
Error description |
Example Requests
Example Value
POST https://{endpoint}/v1/koosearch/repos/acd90739-2e22-4870-b2db-35018699b623/search-prompt { "prompt" : "You are a Q&A assistant. Please answer the question based on the documents below. Before answering the question, please carefully evaluate whether the documents provided can answer the question. If the given documents are irrelevant to the question, answer \"Sorry, I can't answer this question\"; if they are relevant, answer the question based on these documents.\nDocuments provided:\n{0}\nQuestion: {1}\nPlease provide your answer after carefully consideration based on the requirements given.}" }
Example Responses
Status code: 200
Knowledge base ID of the RAG prompt.
{ "repo_id" : "919e8b10-b0c4-4bcd-9d5a-8ebb69594514" }
Status Codes
Status Code |
Description |
---|---|
200 |
Knowledge base ID of the RAG prompt. |
400 |
Incorrect request body parameter |
500 |
Internal error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot