Skip to main content
POST
/
agents
/
{agentId}
/
kb
/
search
Search Agent Knowledge Base
curl --request POST \
  --url https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/kb/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "vector": [
    123
  ],
  "searchQuery": "<string>",
  "vectorDb": "postgres",
  "defaultDimension": 1536,
  "max_chunks": 5,
  "similarity_threshold": 0,
  "with_payload": true,
  "with_vector": false
}
'
{
  "success": true,
  "message": "<string>",
  "data": [
    {
      "id": "<string>",
      "namespace": "<string>",
      "payload": {
        "text": "<string>",
        "chunk_index": 123,
        "doc_id": "<string>",
        "doc_name": "<string>",
        "url": "<string>",
        "urlDescription": "<string>"
      },
      "vector": [
        123
      ],
      "tags": [
        "<string>"
      ],
      "similarity": 123
    }
  ]
}

Example: Search with Text

{
  "searchQuery": "refund policy for annual subscriptions",
  "max_chunks": 3,
  "with_payload": true
}

Example: Search with a Vector

{
  "vector": [0.12, -0.03, 0.91],
  "vectorDb": "postgres",
  "max_chunks": 5,
  "similarity_threshold": 0.2
}
Use searchQuery for most requests. The API will create the embedding for you and search the agent KB automatically.
Results are chunk-level matches, so a single source document may appear multiple times if several chunks are relevant.

Authorizations

Authorization
string
header
required

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

Path Parameters

agentId
string
required

Body

application/json
vector
number[]
searchQuery
string
Minimum string length: 1
vectorDb
enum<string>
default:postgres
Available options:
firebase,
postgres
defaultDimension
integer
default:1536
Required range: x > 0
max_chunks
integer
default:5
Required range: 1 <= x <= 100
similarity_threshold
number
default:0
Required range: 0 <= x <= 1
with_payload
boolean
default:true
with_vector
boolean
default:false

Response

Successful response

success
boolean
required
message
string
required
data
object[]
required