#Is there any way to update the knowledge base of an agent via api? I can create the document via AP
1 messages · Page 1 of 1 (latest)
To update the knowledge base of an agent via API, you need to follow a specific process. First, you should delete the existing knowledge base document manually by tracking document IDs, as there isn't a direct endpoint for this. Then, use the Create Knowledge Base Document endpoint to upload the new document. After adding the new document, you need to patch your agent with the new document ID to ensure the knowledge base is current.
If you are having trouble with the patching process, ensure that you are using the correct method to detach the existing document by patching an empty array, and then re-upload and re-attach the updated document to the agent. This involves using the PATCH method with a configuration like:
{
"conversation_config": {
"agent": {
"prompt": {
"knowledge_base": []
}
}
}
}
This process will help you keep the knowledge base updated. If you need more detailed guidance, you might want to check the API documentation for further instructions.
{
"detail": {
"status": "input_invalid",
"message": "[{"type":"model_type","loc":["conversation_config","agent","prompt","knowledge_base",0],"msg":"Input should be a valid dictionary or instance of KnowledgeBaseLocator","input":"b5sOh6LxwDhTpDDkjXTq","ctx":{"class_name":"KnowledgeBaseLocator"},"url":"https://errors.pydantic.dev/2.10/v/model_type\"}]"
}
}