Skip to main content
POST
/
knowledge
/
{knowledge_base_id}
/
query
cURL
curl --request POST \
  --url https://api.opper.ai/v2/knowledge/{knowledge_base_id}/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>"
}
'
[
  {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "key": "<string>",
    "content": "<string>",
    "metadata": {},
    "score": 123
  }
]

Authorizations

Authorization
string
header
required

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

Path Parameters

knowledge_base_id
string<uuid>
required

The id of the knowledge base to query

Body

application/json
query
string
required

Query string

Minimum string length: 1
Example:

"What is the capital of France?"

prefilter_limit
integer
default:10

Number of documents to retrieve from the knowledge base before filtering

Example:

10

top_k
integer
default:3

Number of documents to return

Example:

3

filters
Filter · object[] | null

Per-field filters to apply to the query combined with AND

Example:
[
{
"field": "price",
"operation": ">",
"value": 100
},
{
"field": "category",
"operation": "in",
"value": ["product", "service"]
}
]
rerank
boolean
default:true

Whether to rerank the results

parent_span_id
string<uuid> | null

Parent span id

Response

Successful Response

id
string<uuid>
required

The id of the document

key
string
required

The key of the document

Example:

"paris_123"

content
string
required

The content of the document

Example:

"The capital of France is Paris"

metadata
Metadata · object
required

The metadata of the document

Example:
{ "category": "product", "price": 100 }
score
number
required

The score of the document

Example:

0.95