Search Passages
client.passages.search(PassageSearchParams { query, agent_id, archive_id, 5 more } body, RequestOptionsoptions?): PassageSearchResponse { passage, score, metadata }
/v1/passages/search
Search passages across the organization with optional agent and archive filtering. Returns passages with relevance scores.
This endpoint supports semantic search through passages:
- If neither agent_id nor archive_id is provided, searches ALL passages in the organization
- If agent_id is provided, searches passages across all archives attached to that agent
- If archive_id is provided, searches passages within that specific archive
- If both are provided, agent_id takes precedence
Parameters
Returns
Search Passages
import Letta from '@letta-ai/letta-client';
const client = new Letta({
apiKey: 'My API Key',
});
const response = await client.passages.search({ query: 'query' });
console.log(response);
[
{
"passage": {
"embedding": [
0
],
"embedding_config": {
"embedding_dim": 0,
"embedding_endpoint_type": "openai",
"embedding_model": "embedding_model",
"azure_deployment": "azure_deployment",
"azure_endpoint": "azure_endpoint",
"azure_version": "azure_version",
"batch_size": 0,
"embedding_chunk_size": 0,
"embedding_endpoint": "embedding_endpoint",
"handle": "handle"
},
"text": "text",
"id": "passage-123e4567-e89b-12d3-a456-426614174000",
"archive_id": "archive_id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by_id": "created_by_id",
"file_id": "file_id",
"file_name": "file_name",
"is_deleted": true,
"last_updated_by_id": "last_updated_by_id",
"metadata": {
"foo": "bar"
},
"source_id": "source_id",
"tags": [
"string"
],
"updated_at": "2019-12-27T18:11:19.117Z"
},
"score": 0,
"metadata": {
"foo": "bar"
}
}
]Returns Examples
[
{
"passage": {
"embedding": [
0
],
"embedding_config": {
"embedding_dim": 0,
"embedding_endpoint_type": "openai",
"embedding_model": "embedding_model",
"azure_deployment": "azure_deployment",
"azure_endpoint": "azure_endpoint",
"azure_version": "azure_version",
"batch_size": 0,
"embedding_chunk_size": 0,
"embedding_endpoint": "embedding_endpoint",
"handle": "handle"
},
"text": "text",
"id": "passage-123e4567-e89b-12d3-a456-426614174000",
"archive_id": "archive_id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by_id": "created_by_id",
"file_id": "file_id",
"file_name": "file_name",
"is_deleted": true,
"last_updated_by_id": "last_updated_by_id",
"metadata": {
"foo": "bar"
},
"source_id": "source_id",
"tags": [
"string"
],
"updated_at": "2019-12-27T18:11:19.117Z"
},
"score": 0,
"metadata": {
"foo": "bar"
}
}
]