Skip to main content
POST
/
store
/
knowledge-base
/
semantic-retrieval
Knowledge base semantic retrieval
curl --request POST \
  --url https://api.pawa-ai.com/v1/store/knowledge-base/semantic-retrieval \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "knowledge_base_id": "kb-f9d817f5-46c2-49b2-b07f-f3db8df0887a",
  "question_asked_by_user": "What is the purpose of this knowledge base?"
}'
{
  "finalRelevantChunk": [
    "Hello Pawa AI, I am the final relevant chunk you need"
  ],
  "filteredResults": [
    {
      "id": 63,
      "knowledgeBaseId": 7,
      "documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf",
      "chunk": "and for the whole period of staying in the Schengen area. In order to have a flexible travel schedule it is suggested to issue the Insurance for a few days longer than the planned travel time...",
      "distance": 0.7506968916261936
    },
    {
      "id": 76,
      "knowledgeBaseId": 7,
      "documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf",
      "chunk": "plan agreed with the clinic. Medical health documentation issued by the applicant’s country of residence...",
      "distance": 0.7515738980069386
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
knowledge_base_id
string
default:kb-f9d817f5-46c2-49b2-b07f-f3db8df0887a
required

The knowledge_base_reference_id of the knowledge base to perform the RAG if the question asked relates to the purpose of the knowledge_base_tool provided.

question_asked_by_user
string
default:What is the purpose of this knowledge base?
required

The question asked by the user to perform the RAG.

Response

Relevant chunks retrieved successfully

finalRelevantChunk
string[]
required

Final relevant chunk based on the user query.

Example:
[
"Hello Pawa AI, I am the final relevant chunk you need"
]
filteredResults
object[]
required

Filtered results based on the relevance of the chunks to the user query.

Example:
[
{
"id": 63,
"knowledgeBaseId": 7,
"documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf",
"chunk": "and for the whole period of staying in the Schengen area. In order to have a flexible travel schedule it is suggested to issue the Insurance for a few days longer than the planned travel time...",
"distance": 0.7506968916261936
},
{
"id": 76,
"knowledgeBaseId": 7,
"documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf",
"chunk": "plan agreed with the clinic. Medical health documentation issued by the applicant’s country of residence...",
"distance": 0.7515738980069386
}
]
I