Skip to main content

Knowledge

Knowledge tools (type: "file_search") let the agent search your documents. You can add one in two ways.

  • Existing vector stores. Send their IDs in a JSON body to the tool creation endpoint.
  • Uploaded files. Send a multipart request to the upload endpoint. Predictable Dialogs creates the vector store and Knowledge tool for you.

From existing vector stores​

Supply one to twenty distinct Predictable Dialogs vector store IDs from your organization.

{
"type": "file_search",
"label": "Returns policy",
"assistantUseDescription": "Search the policy when a visitor asks about returns.",
"vectorStoreIds": ["cmp0ss8n40005wlwnh9wi6u99"]
}

From uploaded files​

POST /v1/agents/{agentId}/skills/{skillId}/tools/knowledge/uploads

Send a multipart request with a name of up to 128 characters, a assistantUseDescription, and one to twenty files of up to 20 MiB each. The name labels the store and the tool. The upload uses the agent's bound organization-owned OpenAI key when available. Agents using platform credentials, a non-OpenAI resource, or no AI resource use the platform OpenAI key.

curl -X POST "https://app.predictabledialogs.com/v1/agents/${AGENT_ID}/skills/${SKILL_ID}/tools/knowledge/uploads" \
-H "Authorization: Bearer $PD_ACCESS_TOKEN" \
-H "Idempotency-Key: returns-policy-upload-001" \
-F "name=Returns policy" \
-F "files=@returns-policy.txt"

Use a distinct Idempotency-Key for each upload. Keys can contain letters, digits, periods, underscores, and hyphens and be up to 128 characters long. Retry the same upload with the same key within five minutes of a successful request to receive the original response. Uploaded files can still be indexing when the API returns.

Tool creation response​

Tool creation returns 201 Created with data.id, data.agentId, data.skillId, data.type, data.label, and data.toolName. Knowledge tools also return data.vectorStoreIds.

StatusMeaning
400Invalid input, an unavailable vector store or connection, or the Skill has reached its tool limit.
401The PD access token or delegated OAuth token is missing or invalid.
403The delegated OAuth token lacks pd:write.
404The Skill is unavailable on the specified agent in the token's organization.
409For Knowledge uploads, a request with the same idempotency key is still processing.
413For Knowledge uploads, a file exceeds 20 MiB.
429The request exceeded the rate limit.