@hydradb/sdk 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +494 -554
- package/dist/Client.d.ts +4 -7
- package/dist/Client.js +6 -10
- package/dist/api/client/requests/SearchQueryRequest.d.ts +26 -15
- package/dist/api/errors/index.d.ts +0 -1
- package/dist/api/errors/index.js +0 -1
- package/dist/api/resources/context/client/Client.d.ts +18 -1
- package/dist/api/resources/context/client/Client.js +90 -1
- package/dist/api/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +15 -0
- package/dist/api/resources/context/client/requests/ListV2ListContentRequest.d.ts +9 -0
- package/dist/api/resources/context/client/requests/SourcesV2SourceDeleteRequest.d.ts +9 -0
- package/dist/api/resources/context/client/requests/index.d.ts +1 -0
- package/dist/api/resources/databases/client/Client.d.ts +109 -0
- package/dist/api/resources/{tenants → databases}/client/Client.js +61 -61
- package/dist/api/resources/databases/client/requests/CollectionsDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/DeleteDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/StatsDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/databases/client/requests/StatusDatabasesRequest.d.ts +10 -0
- package/dist/api/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.d.ts +7 -0
- package/dist/api/resources/databases/client/requests/index.d.ts +5 -0
- package/dist/api/resources/databases/exports.d.ts +2 -0
- package/dist/api/resources/{tenants → databases}/exports.js +2 -2
- package/dist/api/resources/index.d.ts +2 -4
- package/dist/api/resources/index.js +3 -5
- package/dist/api/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +13 -0
- package/dist/api/types/HandlerDeprecationNotice.d.ts +7 -0
- package/dist/api/types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +7 -0
- package/dist/api/types/{HandlerEnvelopeEmbeddingsDeleteResult.d.ts → HandlerEnvelopeSourcesMemoryDeleteResponse.d.ts} +2 -2
- package/dist/api/types/HandlerErrorDetail.d.ts +3 -0
- package/dist/api/types/HandlerResponseMeta.d.ts +14 -0
- package/dist/api/types/ListContentFilter.d.ts +8 -2
- package/dist/api/types/SearchGraphContext.d.ts +5 -0
- package/dist/api/types/SearchMetadataFilters.d.ts +4 -0
- package/dist/api/types/SearchQueryRequestCollections.d.ts +4 -0
- package/dist/api/types/SearchQueryRequestSubTenantIds.d.ts +4 -0
- package/dist/api/types/SearchRecallMode.d.ts +1 -0
- package/dist/api/types/SearchRecallMode.js +1 -0
- package/dist/api/types/SearchSourceInfo.d.ts +1 -0
- package/dist/api/types/SearchV2Chunk.d.ts +1 -0
- package/dist/api/types/{SourcesSourceDeleteResponse.d.ts → SourcesMemoryDeleteResponse.d.ts} +2 -1
- package/dist/api/types/TenantsFailedTenant.d.ts +1 -0
- package/dist/api/types/TenantsInfraStatusResponseV2.d.ts +1 -0
- package/dist/api/types/TenantsSubTenantIdsResponse.d.ts +1 -0
- package/dist/api/types/TenantsTenantCreateAcceptedResponse.d.ts +1 -0
- package/dist/api/types/TenantsTenantDeleteResponse.d.ts +1 -0
- package/dist/api/types/TenantsTenantIdsResponse.d.ts +2 -0
- package/dist/api/types/TenantsTenantStatsResponse.d.ts +1 -0
- package/dist/api/types/index.d.ts +8 -10
- package/dist/api/types/index.js +8 -10
- package/dist/serialization/client/requests/SearchQueryRequest.d.ts +9 -3
- package/dist/serialization/client/requests/SearchQueryRequest.js +9 -3
- package/dist/serialization/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +13 -0
- package/dist/serialization/resources/{embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.js → context/client/requests/HandlerContextMetadataUpdateRequest.js} +6 -6
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.d.ts +2 -0
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.js +2 -0
- package/dist/serialization/resources/context/client/requests/SourcesV2SourceDeleteRequest.d.ts +2 -0
- package/dist/serialization/resources/context/client/requests/SourcesV2SourceDeleteRequest.js +2 -0
- package/dist/serialization/resources/context/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/context/client/requests/index.js +3 -1
- package/dist/serialization/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.d.ts +1 -0
- package/dist/serialization/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.js +1 -0
- package/dist/serialization/resources/index.d.ts +2 -4
- package/dist/serialization/resources/index.js +3 -5
- package/dist/serialization/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +19 -0
- package/dist/serialization/types/{EmbeddingsRawEmbeddingDocument.js → GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js} +11 -6
- package/dist/serialization/types/HandlerDeprecationNotice.d.ts +13 -0
- package/dist/serialization/types/HandlerDeprecationNotice.js +45 -0
- package/dist/serialization/types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +15 -0
- package/dist/serialization/types/{HandlerEnvelopeEmbeddingsInsertResult.js → HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js} +4 -4
- package/dist/serialization/types/{HandlerEnvelopeSourcesSourceDeleteResponse.d.ts → HandlerEnvelopeSourcesMemoryDeleteResponse.d.ts} +4 -4
- package/dist/serialization/types/{HandlerEnvelopeSourcesSourceDeleteResponse.js → HandlerEnvelopeSourcesMemoryDeleteResponse.js} +4 -4
- package/dist/serialization/types/HandlerErrorDetail.d.ts +3 -0
- package/dist/serialization/types/HandlerErrorDetail.js +3 -0
- package/dist/serialization/types/HandlerResponseMeta.d.ts +7 -0
- package/dist/serialization/types/HandlerResponseMeta.js +7 -0
- package/dist/serialization/types/ListContentFilter.d.ts +2 -2
- package/dist/serialization/types/ListContentFilter.js +2 -2
- package/dist/serialization/types/SearchMetadataFilters.d.ts +7 -0
- package/dist/serialization/types/{EmbeddingsRawEmbeddingVector.js → SearchMetadataFilters.js} +2 -5
- package/dist/serialization/types/SearchQueryRequestCollections.d.ts +7 -0
- package/dist/serialization/types/{EmbeddingsDeleteResult.js → SearchQueryRequestCollections.js} +5 -6
- package/dist/serialization/types/SearchQueryRequestSubTenantIds.d.ts +7 -0
- package/dist/serialization/types/{EmbeddingsInsertResult.js → SearchQueryRequestSubTenantIds.js} +5 -7
- package/dist/serialization/types/SearchRecallMode.d.ts +1 -1
- package/dist/serialization/types/SearchRecallMode.js +1 -1
- package/dist/serialization/types/SearchSourceInfo.d.ts +1 -0
- package/dist/serialization/types/SearchSourceInfo.js +1 -0
- package/dist/serialization/types/SearchV2Chunk.d.ts +1 -0
- package/dist/serialization/types/SearchV2Chunk.js +1 -0
- package/dist/serialization/types/{SourcesSourceDeleteResponse.d.ts → SourcesMemoryDeleteResponse.d.ts} +3 -2
- package/dist/serialization/types/{SourcesSourceDeleteResponse.js → SourcesMemoryDeleteResponse.js} +3 -2
- package/dist/serialization/types/TenantsFailedTenant.d.ts +1 -0
- package/dist/serialization/types/TenantsFailedTenant.js +1 -0
- package/dist/serialization/types/TenantsInfraStatusResponseV2.d.ts +1 -0
- package/dist/serialization/types/TenantsInfraStatusResponseV2.js +1 -0
- package/dist/serialization/types/TenantsSubTenantIdsResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsSubTenantIdsResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantCreateAcceptedResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantCreateAcceptedResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantDeleteResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantDeleteResponse.js +1 -0
- package/dist/serialization/types/TenantsTenantIdsResponse.d.ts +2 -0
- package/dist/serialization/types/TenantsTenantIdsResponse.js +2 -0
- package/dist/serialization/types/TenantsTenantStatsResponse.d.ts +1 -0
- package/dist/serialization/types/TenantsTenantStatsResponse.js +1 -0
- package/dist/serialization/types/index.d.ts +8 -10
- package/dist/serialization/types/index.js +8 -10
- package/package.json +1 -1
- package/dist/api/errors/TooManyRequestsError.d.ts +0 -6
- package/dist/api/errors/TooManyRequestsError.js +0 -54
- package/dist/api/resources/embeddings/client/Client.d.ts +0 -80
- package/dist/api/resources/embeddings/client/Client.js +0 -351
- package/dist/api/resources/embeddings/client/requests/DeleteEmbeddingsRequest.d.ts +0 -18
- package/dist/api/resources/embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.d.ts +0 -15
- package/dist/api/resources/embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.d.ts +0 -14
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.d.ts +0 -16
- package/dist/api/resources/embeddings/client/requests/index.d.ts +0 -4
- package/dist/api/resources/embeddings/exports.d.ts +0 -2
- package/dist/api/resources/embeddings/exports.js +0 -21
- package/dist/api/resources/tenants/client/Client.d.ts +0 -109
- package/dist/api/resources/tenants/client/requests/DeleteTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/StatsTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/StatusTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/SubTenantsTenantsRequest.d.ts +0 -10
- package/dist/api/resources/tenants/client/requests/index.d.ts +0 -5
- package/dist/api/resources/tenants/client/requests/index.js +0 -2
- package/dist/api/resources/tenants/exports.d.ts +0 -2
- package/dist/api/types/EmbeddingsDeleteResult.d.ts +0 -5
- package/dist/api/types/EmbeddingsInsertResult.d.ts +0 -6
- package/dist/api/types/EmbeddingsRawEmbeddingDocument.d.ts +0 -8
- package/dist/api/types/EmbeddingsRawEmbeddingSearchResult.d.ts +0 -8
- package/dist/api/types/EmbeddingsRawEmbeddingVector.d.ts +0 -5
- package/dist/api/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.js +0 -3
- package/dist/api/types/HandlerEnvelopeEmbeddingsDeleteResult.js +0 -3
- package/dist/api/types/HandlerEnvelopeEmbeddingsInsertResult.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeEmbeddingsInsertResult.js +0 -3
- package/dist/api/types/HandlerEnvelopeSourcesSourceDeleteResponse.d.ts +0 -7
- package/dist/api/types/HandlerEnvelopeSourcesSourceDeleteResponse.js +0 -3
- package/dist/api/types/SourcesSourceDeleteResponse.js +0 -3
- package/dist/serialization/resources/embeddings/client/index.d.ts +0 -1
- package/dist/serialization/resources/embeddings/client/index.js +0 -17
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.d.ts +0 -14
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.js +0 -46
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.d.ts +0 -13
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.d.ts +0 -14
- package/dist/serialization/resources/embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.js +0 -46
- package/dist/serialization/resources/embeddings/client/requests/index.d.ts +0 -3
- package/dist/serialization/resources/embeddings/client/requests/index.js +0 -9
- package/dist/serialization/resources/embeddings/index.d.ts +0 -1
- package/dist/serialization/resources/embeddings/index.js +0 -17
- package/dist/serialization/resources/tenants/client/index.d.ts +0 -1
- package/dist/serialization/resources/tenants/client/index.js +0 -17
- package/dist/serialization/resources/tenants/index.d.ts +0 -1
- package/dist/serialization/resources/tenants/index.js +0 -17
- package/dist/serialization/types/EmbeddingsDeleteResult.d.ts +0 -11
- package/dist/serialization/types/EmbeddingsInsertResult.d.ts +0 -12
- package/dist/serialization/types/EmbeddingsRawEmbeddingDocument.d.ts +0 -14
- package/dist/serialization/types/EmbeddingsRawEmbeddingSearchResult.d.ts +0 -14
- package/dist/serialization/types/EmbeddingsRawEmbeddingSearchResult.js +0 -46
- package/dist/serialization/types/EmbeddingsRawEmbeddingVector.d.ts +0 -10
- package/dist/serialization/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.d.ts +0 -15
- package/dist/serialization/types/HandlerEnvelopeArrayEmbeddingsRawEmbeddingSearchResult.js +0 -47
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsDeleteResult.d.ts +0 -15
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsDeleteResult.js +0 -47
- package/dist/serialization/types/HandlerEnvelopeEmbeddingsInsertResult.d.ts +0 -15
- /package/dist/api/resources/{embeddings/client/requests/DeleteEmbeddingsRequest.js → context/client/requests/HandlerContextMetadataUpdateRequest.js} +0 -0
- /package/dist/api/resources/{embeddings → databases}/client/index.d.ts +0 -0
- /package/dist/api/resources/{embeddings → databases}/client/index.js +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsFilterRawEmbeddingsRequest.js → databases/client/requests/CollectionsDatabasesRequest.js} +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsInsertRawEmbeddingsRequest.js → databases/client/requests/DeleteDatabasesRequest.js} +0 -0
- /package/dist/api/resources/{embeddings/client/requests/EmbeddingsSearchRawEmbeddingsRequest.js → databases/client/requests/StatsDatabasesRequest.js} +0 -0
- /package/dist/api/resources/{tenants/client/requests/DeleteTenantsRequest.js → databases/client/requests/StatusDatabasesRequest.js} +0 -0
- /package/dist/api/resources/{tenants → databases}/client/requests/TenantsTenantCreateRequest.js +0 -0
- /package/dist/api/resources/{embeddings → databases}/client/requests/index.js +0 -0
- /package/dist/api/resources/{embeddings → databases}/index.d.ts +0 -0
- /package/dist/api/resources/{embeddings → databases}/index.js +0 -0
- /package/dist/api/{resources/tenants/client/requests/StatsTenantsRequest.js → types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js} +0 -0
- /package/dist/api/{resources/tenants/client/requests/StatusTenantsRequest.js → types/HandlerDeprecationNotice.js} +0 -0
- /package/dist/api/{resources/tenants/client/requests/SubTenantsTenantsRequest.js → types/HandlerEnvelopeGithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js} +0 -0
- /package/dist/api/types/{EmbeddingsDeleteResult.js → HandlerEnvelopeSourcesMemoryDeleteResponse.js} +0 -0
- /package/dist/api/types/{EmbeddingsInsertResult.js → SearchMetadataFilters.js} +0 -0
- /package/dist/api/types/{EmbeddingsRawEmbeddingDocument.js → SearchQueryRequestCollections.js} +0 -0
- /package/dist/api/types/{EmbeddingsRawEmbeddingSearchResult.js → SearchQueryRequestSubTenantIds.js} +0 -0
- /package/dist/api/types/{EmbeddingsRawEmbeddingVector.js → SourcesMemoryDeleteResponse.js} +0 -0
- /package/dist/{api/resources/tenants → serialization/resources/databases}/client/index.d.ts +0 -0
- /package/dist/{api/resources/tenants → serialization/resources/databases}/client/index.js +0 -0
- /package/dist/serialization/resources/{tenants → databases}/client/requests/index.d.ts +0 -0
- /package/dist/serialization/resources/{tenants → databases}/client/requests/index.js +0 -0
- /package/dist/{api/resources/tenants → serialization/resources/databases}/index.d.ts +0 -0
- /package/dist/{api/resources/tenants → serialization/resources/databases}/index.js +0 -0
package/README.md
CHANGED
|
@@ -1,750 +1,690 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
The official TypeScript SDK for
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
1
|
+
# HydraDB TypeScript SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript/JavaScript SDK for [HydraDB](https://hydradb.com) — a managed retrieval
|
|
4
|
+
engine that combines vector search, full‑text search, and a knowledge graph behind a single API.
|
|
5
|
+
|
|
6
|
+
- **Package:** `@hydradb/sdk`
|
|
7
|
+
- **Client class:** `HydraDBClient`
|
|
8
|
+
- **Version:** `2.1.0` (API version `2`)
|
|
9
|
+
- **Docs:** https://docs.hydradb.com
|
|
10
|
+
- **Runtime:** Node.js 18+ (works with any `fetch`-capable runtime)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Table of contents
|
|
15
|
+
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Quick start](#quick-start)
|
|
18
|
+
- [Client configuration](#client-configuration)
|
|
19
|
+
- [Core concepts](#core-concepts)
|
|
20
|
+
- [Responses & raw access](#responses--raw-access)
|
|
21
|
+
- [Endpoints](#endpoints)
|
|
22
|
+
- [`query` — unified retrieval](#query--unified-retrieval)
|
|
23
|
+
- [Context (`client.context`)](#context-clientcontext)
|
|
24
|
+
- [`ingest`](#contextingest)
|
|
25
|
+
- [`list`](#contextlist)
|
|
26
|
+
- [`inspect`](#contextinspect)
|
|
27
|
+
- [`status`](#contextstatus)
|
|
28
|
+
- [`relations`](#contextrelations)
|
|
29
|
+
- [`updateSourceMetadata`](#contextupdatesourcemetadata)
|
|
30
|
+
- [`delete`](#contextdelete)
|
|
31
|
+
- [Databases (`client.databases`)](#databases-clientdatabases)
|
|
32
|
+
- [`create`](#databasescreate)
|
|
33
|
+
- [`list`](#databaseslist)
|
|
34
|
+
- [`collections`](#databasescollections)
|
|
35
|
+
- [`stats`](#databasesstats)
|
|
36
|
+
- [`status`](#databasesstatus)
|
|
37
|
+
- [`delete`](#databasesdelete)
|
|
38
|
+
- [Webhooks (`client.webhooks`)](#webhooks-clientwebhooks)
|
|
39
|
+
- [`register`](#webhooksregister)
|
|
40
|
+
- [`get`](#webhooksget)
|
|
41
|
+
- [`test`](#webhookstest)
|
|
42
|
+
- [`delete`](#webhooksdelete)
|
|
43
|
+
- [`listDeliveries`](#webhookslistdeliveries)
|
|
44
|
+
- [`getDelivery`](#webhooksgetdelivery)
|
|
45
|
+
- [`retryDelivery`](#webhooksretrydelivery)
|
|
46
|
+
- [Error handling](#error-handling)
|
|
47
|
+
- [Advanced](#advanced)
|
|
48
|
+
- [Per-request options (timeouts, retries, abort)](#per-request-options-timeouts-retries-abort)
|
|
49
|
+
- [Passthrough `fetch`](#passthrough-fetch)
|
|
50
|
+
- [Custom fetch & logging](#custom-fetch--logging)
|
|
51
|
+
|
|
52
|
+
---
|
|
19
53
|
|
|
20
54
|
## Installation
|
|
21
55
|
|
|
22
56
|
```bash
|
|
23
57
|
npm install @hydradb/sdk
|
|
24
|
-
# or
|
|
25
|
-
yarn add @hydradb/sdk
|
|
26
|
-
# or
|
|
27
|
-
pnpm add @hydradb/sdk
|
|
58
|
+
# or: pnpm add @hydradb/sdk / yarn add @hydradb/sdk
|
|
28
59
|
```
|
|
29
60
|
|
|
30
|
-
##
|
|
61
|
+
## Quick start
|
|
31
62
|
|
|
32
|
-
```
|
|
63
|
+
```typescript
|
|
33
64
|
import { HydraDBClient } from "@hydradb/sdk";
|
|
34
65
|
|
|
35
66
|
const client = new HydraDBClient({
|
|
36
|
-
token:
|
|
67
|
+
token: "YOUR_API_KEY", // bearer token
|
|
37
68
|
});
|
|
38
69
|
|
|
39
|
-
|
|
40
|
-
const
|
|
70
|
+
// Run a hybrid search over a database ("tenant")
|
|
71
|
+
const result = await client.query({
|
|
72
|
+
query: "What is our refund policy?",
|
|
73
|
+
database: "acme-corp",
|
|
74
|
+
type: "knowledge",
|
|
75
|
+
maxResults: 5,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(result.data);
|
|
41
79
|
```
|
|
42
80
|
|
|
43
|
-
|
|
81
|
+
Every method returns an awaitable `HttpResponsePromise`. `await`-ing it resolves to the parsed
|
|
82
|
+
response body (a `HandlerEnvelope…` object whose payload is on `.data`). See
|
|
83
|
+
[Responses & raw access](#responses--raw-access).
|
|
44
84
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Client configuration
|
|
48
88
|
|
|
49
|
-
|
|
89
|
+
```typescript
|
|
90
|
+
import { HydraDBClient, HydraDBEnvironment } from "@hydradb/sdk";
|
|
50
91
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
const client = new HydraDBClient({
|
|
93
|
+
token: "YOUR_API_KEY",
|
|
94
|
+
apiVersion: "2", // optional, defaults to "2"
|
|
95
|
+
environment: HydraDBEnvironment.Default, // https://api.hydradb.com
|
|
96
|
+
// baseUrl: "https://api.hydradb.com", // override for self-hosted / staging
|
|
97
|
+
timeoutInSeconds: 60, // default 60
|
|
98
|
+
maxRetries: 2, // default 2
|
|
99
|
+
headers: { "X-Custom-Header": "value" }, // sent on every request
|
|
55
100
|
});
|
|
56
101
|
```
|
|
57
102
|
|
|
58
|
-
|
|
103
|
+
| Option | Type | Default | Notes |
|
|
104
|
+
| ------------------ | ------------------------------------- | ------------------------ | ----- |
|
|
105
|
+
| `token` | `string \| () => string \| Promise` | – | Bearer token. Accepts a supplier for dynamic/refreshing tokens. |
|
|
106
|
+
| `apiVersion` | `string` | `"2"` | Sets the `API-Version` header. |
|
|
107
|
+
| `environment` | `HydraDBEnvironment \| string` | `Default` | `Default` → `https://api.hydradb.com`. |
|
|
108
|
+
| `baseUrl` | `string` | – | Explicit URL; overrides `environment`. |
|
|
109
|
+
| `timeoutInSeconds` | `number` | `60` | Per‑request timeout. |
|
|
110
|
+
| `maxRetries` | `number` | `2` | Automatic retries on transient failures. |
|
|
111
|
+
| `headers` | `Record<string, string>` | – | Extra headers on every request. |
|
|
112
|
+
| `fetch` | `typeof fetch` | runtime default | Custom fetch implementation. |
|
|
113
|
+
| `logging` | `LogConfig \| Logger` | silent | SDK logging. |
|
|
59
114
|
|
|
60
|
-
> Note
|
|
115
|
+
> **Note:** all request fields use **camelCase** in TypeScript (e.g. `subTenantId`,
|
|
116
|
+
> `maxResults`); the SDK maps them to the API's snake_case wire format for you.
|
|
61
117
|
|
|
62
|
-
|
|
118
|
+
---
|
|
63
119
|
|
|
64
|
-
|
|
120
|
+
## Core concepts
|
|
65
121
|
|
|
66
|
-
|
|
67
|
-
|---|---|
|
|
68
|
-
| `client.query(...)` | Retrieve knowledge and/or memory in a single call. |
|
|
69
|
-
| `client.context` | Ingest, inspect, list, delete sources, and fetch graph relations. |
|
|
70
|
-
| `client.tenants` | Create, list, delete, and inspect tenants. |
|
|
71
|
-
| `client.webhooks` | Register and manage webhooks and inspect deliveries. |
|
|
122
|
+
**Database vs. Collection (tenant vs. sub‑tenant).** HydraDB v2 renamed the isolation scopes:
|
|
72
123
|
|
|
73
|
-
|
|
124
|
+
| v2 name (canonical) | v1 alias (deprecated, still accepted) | Meaning |
|
|
125
|
+
| ------------------- | ------------------------------------- | ------- |
|
|
126
|
+
| `database` | `tenantId` | Top‑level isolation boundary. |
|
|
127
|
+
| `collection` | `subTenantId` | A namespace within a database. |
|
|
74
128
|
|
|
75
|
-
|
|
129
|
+
The server’s `TenantAliases` middleware reconciles the two, so you can pass either — but new
|
|
130
|
+
code should use `database` / `collection`. The legacy aliases will be removed in a future release.
|
|
76
131
|
|
|
77
|
-
|
|
132
|
+
**Corpora (`type`).** Data is split into two corpora you can target independently:
|
|
133
|
+
`"knowledge"` (documents), `"memory"` (agent memories), or `"all"`.
|
|
78
134
|
|
|
79
|
-
|
|
135
|
+
---
|
|
80
136
|
|
|
81
|
-
|
|
137
|
+
## Responses & raw access
|
|
82
138
|
|
|
83
|
-
|
|
139
|
+
`await`-ing any call gives you the parsed body:
|
|
84
140
|
|
|
85
|
-
```
|
|
86
|
-
await client.
|
|
87
|
-
|
|
88
|
-
|
|
141
|
+
```typescript
|
|
142
|
+
const res = await client.databases.list();
|
|
143
|
+
console.log(res.data); // the payload
|
|
144
|
+
console.log(res.meta); // request metadata
|
|
89
145
|
```
|
|
90
146
|
|
|
91
|
-
|
|
147
|
+
To also get the HTTP status and headers, call `.withRawResponse()`:
|
|
92
148
|
|
|
93
|
-
|
|
149
|
+
```typescript
|
|
150
|
+
const { data, rawResponse } = await client.query({ query: "hi", database: "acme-corp" })
|
|
151
|
+
.withRawResponse();
|
|
94
152
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
isEmbeddingsTenant: true,
|
|
99
|
-
embeddingsDimension: 1536,
|
|
100
|
-
});
|
|
153
|
+
console.log(rawResponse.status);
|
|
154
|
+
console.log(rawResponse.headers.get("x-request-id"));
|
|
155
|
+
console.log(data);
|
|
101
156
|
```
|
|
102
157
|
|
|
103
|
-
|
|
158
|
+
---
|
|
104
159
|
|
|
105
|
-
|
|
160
|
+
## Endpoints
|
|
106
161
|
|
|
107
|
-
|
|
108
|
-
await client.tenants.create({
|
|
109
|
-
tenantId: TENANT_ID,
|
|
110
|
-
tenantMetadataSchema: [
|
|
111
|
-
{
|
|
112
|
-
name: "department",
|
|
113
|
-
dataType: "string",
|
|
114
|
-
enableMatch: true,
|
|
115
|
-
enableDenseEmbedding: false,
|
|
116
|
-
enableSparseEmbedding: false,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### List tenants
|
|
162
|
+
### `query` — unified retrieval
|
|
123
163
|
|
|
124
|
-
|
|
125
|
-
const tenants = await client.tenants.list();
|
|
126
|
-
console.log(tenants);
|
|
127
|
-
```
|
|
164
|
+
`POST /query` → `HandlerEnvelopeSearchV2RetrievalResult`
|
|
128
165
|
|
|
129
|
-
|
|
166
|
+
The single retrieval endpoint. Dispatches across corpus (`type`) and retrieval method
|
|
167
|
+
(`queryBy`), optionally enriching results with knowledge‑graph context.
|
|
130
168
|
|
|
131
|
-
```
|
|
132
|
-
const
|
|
133
|
-
|
|
169
|
+
```typescript
|
|
170
|
+
const result = await client.query({
|
|
171
|
+
query: "How do I rotate API keys?",
|
|
172
|
+
database: "acme-corp", // v2 name for the tenant scope
|
|
173
|
+
type: "knowledge", // "knowledge" | "memory" | "all"
|
|
174
|
+
queryBy: "hybrid", // "hybrid" | "text"
|
|
175
|
+
mode: "auto", // "fast" | "thinking" | "auto"
|
|
176
|
+
operator: "or", // "or" | "and" | "phrase"
|
|
177
|
+
maxResults: 10,
|
|
178
|
+
numRelatedChunks: 3,
|
|
179
|
+
graphContext: true, // include KG context (default true)
|
|
180
|
+
recencyBias: 0.2,
|
|
181
|
+
metadataFilters: { // exact-match on tenant/document metadata
|
|
182
|
+
department: "security",
|
|
183
|
+
additional_metadata: { author: "ada" },
|
|
184
|
+
},
|
|
134
185
|
});
|
|
135
186
|
|
|
136
|
-
console.log(
|
|
187
|
+
console.log(result.data);
|
|
137
188
|
```
|
|
138
189
|
|
|
139
|
-
|
|
190
|
+
**Scoping to specific collections** (preferred over the deprecated `subTenantIds`):
|
|
140
191
|
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
192
|
+
```typescript
|
|
193
|
+
// Equal weighting across collections
|
|
194
|
+
await client.query({ query: "pricing", database: "acme-corp", collections: ["eu", "us"] });
|
|
145
195
|
|
|
146
|
-
|
|
196
|
+
// Weighted ranking (one decimal place max)
|
|
197
|
+
await client.query({ query: "pricing", database: "acme-corp", collections: { eu: 1.0, us: 0.5 } });
|
|
147
198
|
```
|
|
148
199
|
|
|
149
|
-
|
|
200
|
+
**Scoping to specific source IDs** — `ids` applies a hard `source_id in [...]` pre‑filter; if
|
|
201
|
+
nothing matches it returns empty rather than widening to the whole corpus:
|
|
150
202
|
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
tenantId: TENANT_ID,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
console.log(stats);
|
|
203
|
+
```typescript
|
|
204
|
+
await client.query({ query: "onboarding", database: "acme-corp", ids: ["doc_123", "doc_456"] });
|
|
157
205
|
```
|
|
158
206
|
|
|
159
|
-
|
|
207
|
+
Key fields (`SearchQueryRequest`):
|
|
160
208
|
|
|
161
|
-
|
|
209
|
+
| Field | Type | Notes |
|
|
210
|
+
| ------------------------- | ----------------------------------- | ----- |
|
|
211
|
+
| `query` | `string` | The search text. |
|
|
212
|
+
| `database` | `string` | Tenant scope (v2). Alias: `tenantId`. |
|
|
213
|
+
| `collection` / `collections` | `string` / `string[] \| Record<string, number>` | Sub‑tenant scope. Prefer over `subTenantId(s)`. |
|
|
214
|
+
| `type` | `"knowledge" \| "memory" \| "all"` | Corpus to query. |
|
|
215
|
+
| `queryBy` | `"hybrid" \| "text"` | Retrieval method. |
|
|
216
|
+
| `mode` | `"fast" \| "thinking" \| "auto"` | Recall mode. |
|
|
217
|
+
| `operator` | `"or" \| "and" \| "phrase"` | Text‑match operator. |
|
|
218
|
+
| `maxResults` | `number` | Result cap. |
|
|
219
|
+
| `numRelatedChunks` | `number` | Neighboring chunks to attach. |
|
|
220
|
+
| `graphContext` | `boolean` | Include KG context. Default `true`. |
|
|
221
|
+
| `queryApps` | `boolean` | App‑aware knowledge retrieval. |
|
|
222
|
+
| `queryForcefulRelations` | `boolean` | Force relation expansion. Default `true`. |
|
|
223
|
+
| `metadataFilters` | `Record<string, unknown>` | Exact‑match (nest doc metadata under `additional_metadata`). |
|
|
224
|
+
| `recencyBias` | `number` | Boost newer sources. |
|
|
225
|
+
| `ids` | `string[]` | Restrict to specific source IDs. |
|
|
162
226
|
|
|
163
|
-
|
|
164
|
-
await client.tenants.delete({
|
|
165
|
-
tenantId: TENANT_ID,
|
|
166
|
-
});
|
|
167
|
-
```
|
|
227
|
+
---
|
|
168
228
|
|
|
169
|
-
|
|
229
|
+
### Context (`client.context`)
|
|
170
230
|
|
|
171
|
-
|
|
231
|
+
Everything about the data *inside* a database: ingesting, listing, inspecting, updating
|
|
232
|
+
metadata, checking processing status, reading graph relations, and deleting.
|
|
172
233
|
|
|
173
|
-
|
|
234
|
+
#### `context.ingest`
|
|
174
235
|
|
|
175
|
-
`
|
|
236
|
+
`POST /context/ingest` (multipart) → `HandlerEnvelopeIngestionV2SourceUploadResponse`
|
|
176
237
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
tenantId: TENANT_ID,
|
|
180
|
-
subTenantId: SUB_TENANT_ID,
|
|
181
|
-
type: "knowledge",
|
|
182
|
-
documents: [
|
|
183
|
-
{
|
|
184
|
-
path: "./report.pdf",
|
|
185
|
-
filename: "report.pdf",
|
|
186
|
-
contentType: "application/pdf",
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
upsert: true,
|
|
190
|
-
});
|
|
238
|
+
Ingest knowledge documents or memories. `documents` is a file upload; the other structured
|
|
239
|
+
fields are JSON strings.
|
|
191
240
|
|
|
192
|
-
|
|
193
|
-
|
|
241
|
+
```typescript
|
|
242
|
+
import { createReadStream } from "fs";
|
|
194
243
|
|
|
195
|
-
|
|
244
|
+
// Ingest a document file
|
|
245
|
+
const res = await client.context.ingest({
|
|
246
|
+
tenantId: "acme-corp", // required
|
|
247
|
+
documents: createReadStream("handbook.pdf"),
|
|
248
|
+
subTenantId: "hr",
|
|
249
|
+
type: "knowledge",
|
|
250
|
+
// documentMetadata is a JSON *array* — one object per uploaded file.
|
|
251
|
+
documentMetadata: JSON.stringify([{ title: "Employee Handbook", author: "HR" }]),
|
|
252
|
+
upsert: "true", // form field is a string
|
|
253
|
+
});
|
|
196
254
|
|
|
197
|
-
|
|
255
|
+
console.log(res.data);
|
|
198
256
|
|
|
199
|
-
|
|
257
|
+
// Ingest memories (no file). Each item needs "text" (or "user_assistant_pairs").
|
|
200
258
|
await client.context.ingest({
|
|
201
|
-
tenantId:
|
|
202
|
-
|
|
203
|
-
type: "
|
|
204
|
-
documents: [
|
|
205
|
-
{ path: "./a.pdf", filename: "a.pdf", contentType: "application/pdf" },
|
|
206
|
-
{ path: "./notes.txt", filename: "notes.txt", contentType: "text/plain" },
|
|
207
|
-
],
|
|
208
|
-
upsert: true,
|
|
259
|
+
tenantId: "acme-corp",
|
|
260
|
+
memories: JSON.stringify([{ text: "User prefers dark mode" }]),
|
|
261
|
+
type: "memory",
|
|
209
262
|
});
|
|
210
263
|
```
|
|
211
264
|
|
|
212
|
-
|
|
265
|
+
| Field | Type | Notes |
|
|
266
|
+
| ------------------ | ------------------------ | ----- |
|
|
267
|
+
| `tenantId` | `string` (required) | Database. |
|
|
268
|
+
| `documents` | `Uploadable` | File upload (stream, `Blob`, `Buffer`, etc.). |
|
|
269
|
+
| `memories` | `string` | JSON **array** string; each item needs `text` (or `user_assistant_pairs`). |
|
|
270
|
+
| `documentMetadata` | `string` | JSON **array** string of per‑document metadata — one object per uploaded file (count must match). |
|
|
271
|
+
| `appKnowledge` | `string` | App‑knowledge payload. |
|
|
272
|
+
| `graphPayload` | `string` | Pre‑computed graph payload. |
|
|
273
|
+
| `subTenantId` | `string` | Collection. |
|
|
274
|
+
| `type` | `string` | `"knowledge"` or `"memory"`. |
|
|
275
|
+
| `upsert` | `string` | `"true"` to upsert on existing IDs. |
|
|
213
276
|
|
|
214
|
-
|
|
215
|
-
import { readFileSync } from "node:fs";
|
|
277
|
+
#### `context.list`
|
|
216
278
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
279
|
+
`POST /context/list` → `HandlerEnvelopeListV2SourceListResponse`
|
|
280
|
+
|
|
281
|
+
List sources or memories (IDs + metadata) for a database, with filtering and pagination.
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
const res = await client.context.list({
|
|
285
|
+
database: "acme-corp",
|
|
286
|
+
collection: "hr",
|
|
220
287
|
type: "knowledge",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
288
|
+
page: 1,
|
|
289
|
+
pageSize: 50,
|
|
290
|
+
includeFields: ["title", "type", "timestamp"],
|
|
291
|
+
filters: {
|
|
292
|
+
metadata: { department: "finance" }, // tenant/source metadata
|
|
293
|
+
additionalMetadata: { author: "ada" }, // document metadata
|
|
294
|
+
sourceFields: { type: "pdf" }, // well-known source fields
|
|
295
|
+
},
|
|
228
296
|
});
|
|
297
|
+
|
|
298
|
+
for (const source of res.data.sources ?? []) {
|
|
299
|
+
console.log(source);
|
|
300
|
+
}
|
|
229
301
|
```
|
|
230
302
|
|
|
231
|
-
|
|
303
|
+
#### `context.inspect`
|
|
232
304
|
|
|
233
|
-
`
|
|
305
|
+
`GET /context/inspect` → `HandlerEnvelopeFetchV2SourceFetchResponse`
|
|
234
306
|
|
|
235
|
-
|
|
236
|
-
const documentMetadata = [
|
|
237
|
-
{
|
|
238
|
-
id: "doc_a",
|
|
239
|
-
metadata: { department: "sales" },
|
|
240
|
-
additional_metadata: { author: "Alice" },
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
id: "doc_b",
|
|
244
|
-
metadata: { department: "marketing" },
|
|
245
|
-
additional_metadata: { author: "Bob" },
|
|
246
|
-
relations: {
|
|
247
|
-
cortex_source_ids: ["doc_a"],
|
|
248
|
-
properties: { relation: "same_upload_batch" },
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
];
|
|
307
|
+
Fetch a single ingested source: its content, inferred content, and a presigned download URL.
|
|
252
308
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
],
|
|
261
|
-
documentMetadata: JSON.stringify(documentMetadata),
|
|
262
|
-
upsert: true,
|
|
309
|
+
```typescript
|
|
310
|
+
const res = await client.context.inspect({
|
|
311
|
+
id: "doc_1234", // required — source ID
|
|
312
|
+
tenantId: "acme-corp", // required
|
|
313
|
+
subTenantId: "hr",
|
|
314
|
+
expirySeconds: 3600, // presigned URL lifetime
|
|
315
|
+
mode: "both", // fetch mode: "content", "url", or "both"
|
|
263
316
|
});
|
|
317
|
+
console.log(res.data);
|
|
264
318
|
```
|
|
265
319
|
|
|
266
|
-
|
|
320
|
+
#### `context.status`
|
|
267
321
|
|
|
268
|
-
`
|
|
322
|
+
`GET /context/status` → `HandlerEnvelopeIngestionV2BatchProcessingStatus`
|
|
269
323
|
|
|
270
|
-
|
|
271
|
-
const appKnowledge = [
|
|
272
|
-
{
|
|
273
|
-
id: "app_source_1",
|
|
274
|
-
title: "CRM Account Note",
|
|
275
|
-
content: { text: "Acme is interested in the enterprise plan." },
|
|
276
|
-
type: "document",
|
|
277
|
-
tenant_metadata: { department: "sales" },
|
|
278
|
-
document_metadata: { source: "crm" },
|
|
279
|
-
},
|
|
280
|
-
];
|
|
324
|
+
Check processing status for one or more source IDs.
|
|
281
325
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
326
|
+
```typescript
|
|
327
|
+
// Single source
|
|
328
|
+
await client.context.status({ tenantId: "acme-corp", id: "doc_1234", subTenantId: "hr" });
|
|
329
|
+
|
|
330
|
+
// Batch
|
|
331
|
+
const res = await client.context.status({
|
|
332
|
+
tenantId: "acme-corp",
|
|
333
|
+
ids: ["doc_1", "doc_2", "doc_3"],
|
|
288
334
|
});
|
|
335
|
+
console.log(res.data);
|
|
289
336
|
```
|
|
290
337
|
|
|
291
|
-
|
|
338
|
+
#### `context.relations`
|
|
292
339
|
|
|
293
|
-
`
|
|
340
|
+
`GET /context/relations` → `HandlerEnvelopeGraphGraphRelationsResponse`
|
|
294
341
|
|
|
295
|
-
|
|
296
|
-
const memories = [
|
|
297
|
-
{
|
|
298
|
-
source_id: "memory_001",
|
|
299
|
-
text: "User prefers detailed technical explanations.",
|
|
300
|
-
title: "User preference",
|
|
301
|
-
infer: true,
|
|
302
|
-
metadata: { category: "preference" },
|
|
303
|
-
},
|
|
304
|
-
];
|
|
342
|
+
Return knowledge‑graph relations for a whole database or a single source.
|
|
305
343
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
344
|
+
```typescript
|
|
345
|
+
const res = await client.context.relations({
|
|
346
|
+
tenantId: "acme-corp", // required
|
|
347
|
+
subTenantId: "hr",
|
|
348
|
+
id: "doc_1234", // omit for database-wide relations
|
|
349
|
+
type: "knowledge", // "knowledge" | "memory"
|
|
350
|
+
limit: 100,
|
|
351
|
+
cursor: 0, // pagination cursor
|
|
312
352
|
});
|
|
353
|
+
console.log(res.data);
|
|
313
354
|
```
|
|
314
355
|
|
|
315
|
-
|
|
356
|
+
#### `context.updateSourceMetadata`
|
|
316
357
|
|
|
317
|
-
`
|
|
358
|
+
`PATCH /context/sources/{sourceId}/metadata` → `HandlerEnvelope…MetadataEditResult`
|
|
318
359
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
tenantId: TENANT_ID,
|
|
322
|
-
subTenantId: SUB_TENANT_ID,
|
|
323
|
-
ids: ["source-id-1", "source-id-2"],
|
|
324
|
-
});
|
|
360
|
+
Merge/upsert `tenantMetadata` and `additionalMetadata` for one source. `subTenantId` is
|
|
361
|
+
required by the server.
|
|
325
362
|
|
|
326
|
-
|
|
363
|
+
```typescript
|
|
364
|
+
const res = await client.context.updateSourceMetadata({
|
|
365
|
+
sourceId: "doc_1234", // required — path param
|
|
366
|
+
tenantId: "acme-corp",
|
|
367
|
+
subTenantId: "hr",
|
|
368
|
+
// tenantMetadata keys must be declared in the database's tenant_metadata_schema
|
|
369
|
+
// (and match the declared type). Use additionalMetadata for free-form fields.
|
|
370
|
+
tenantMetadata: { department: "finance" },
|
|
371
|
+
additionalMetadata: { author: "ada", tags: ["policy", "2026"], reviewed: true },
|
|
372
|
+
});
|
|
373
|
+
console.log(res.data);
|
|
327
374
|
```
|
|
328
375
|
|
|
329
|
-
|
|
376
|
+
> **Note:** although the SDK exposes a `documentMetadata` parameter here, this endpoint
|
|
377
|
+
> **rejects** it (HTTP 400 "document_metadata is not accepted; use additional_metadata").
|
|
378
|
+
> Put per-document fields in `additionalMetadata` instead.
|
|
330
379
|
|
|
331
|
-
|
|
332
|
-
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
380
|
+
#### `context.delete`
|
|
333
381
|
|
|
334
|
-
|
|
335
|
-
while (true) {
|
|
336
|
-
const status = await client.context.status({
|
|
337
|
-
tenantId: TENANT_ID,
|
|
338
|
-
subTenantId: SUB_TENANT_ID,
|
|
339
|
-
ids,
|
|
340
|
-
});
|
|
382
|
+
`DELETE /context` → `HandlerEnvelopeSourcesMemoryDeleteResponse`
|
|
341
383
|
|
|
342
|
-
|
|
343
|
-
// schema) and break once everything has completed or errored.
|
|
344
|
-
console.log(status);
|
|
384
|
+
Delete one or more sources or memories by ID.
|
|
345
385
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
386
|
+
```typescript
|
|
387
|
+
const res = await client.context.delete({
|
|
388
|
+
database: "acme-corp",
|
|
389
|
+
collection: "hr",
|
|
390
|
+
ids: ["doc_1234", "doc_5678"],
|
|
391
|
+
type: "knowledge",
|
|
392
|
+
});
|
|
393
|
+
console.log(res.data);
|
|
349
394
|
```
|
|
350
395
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
`client.query()` is the single retrieval entry point. It searches knowledge, memory, or both, with optional graph context. It returns a promise resolving to a `QueryApiResponse`; the retrieval payload is on `.data`.
|
|
354
|
-
|
|
355
|
-
```ts
|
|
356
|
-
const response = await client.query({
|
|
357
|
-
tenantId: TENANT_ID,
|
|
358
|
-
subTenantId: SUB_TENANT_ID,
|
|
359
|
-
query: "What did the account notes say about Acme?",
|
|
360
|
-
maxResults: 10,
|
|
361
|
-
mode: "fast",
|
|
362
|
-
alpha: 0.8,
|
|
363
|
-
recencyBias: 0,
|
|
364
|
-
graphContext: true,
|
|
365
|
-
});
|
|
396
|
+
---
|
|
366
397
|
|
|
367
|
-
|
|
368
|
-
console.log(response.data?.sources);
|
|
369
|
-
```
|
|
398
|
+
### Databases (`client.databases`)
|
|
370
399
|
|
|
371
|
-
|
|
400
|
+
Manage databases (tenants) and inspect their collections, stats, and provisioning status.
|
|
372
401
|
|
|
373
|
-
|
|
402
|
+
#### `databases.create`
|
|
374
403
|
|
|
375
|
-
|
|
376
|
-
// Knowledge only
|
|
377
|
-
await client.query({ tenantId: TENANT_ID, query: "quarterly revenue", type: "knowledge" });
|
|
404
|
+
`POST /databases` → `HandlerEnvelopeTenantsTenantCreateAcceptedResponse`
|
|
378
405
|
|
|
379
|
-
|
|
380
|
-
await client.query({ tenantId: TENANT_ID, query: "user preferences", type: "memory" });
|
|
406
|
+
Create a new database, optionally with a custom metadata schema for its collections.
|
|
381
407
|
|
|
382
|
-
|
|
383
|
-
await client.
|
|
408
|
+
```typescript
|
|
409
|
+
const res = await client.databases.create({
|
|
410
|
+
database: "acme-corp",
|
|
411
|
+
embeddingsDimension: 1536,
|
|
412
|
+
isEmbeddingsTenant: true,
|
|
413
|
+
tenantMetadataSchema: [
|
|
414
|
+
{
|
|
415
|
+
name: "department",
|
|
416
|
+
dataType: "VARCHAR", // BOOL | INT8..INT64 | FLOAT | DOUBLE | VARCHAR | JSON | ARRAY
|
|
417
|
+
maxLength: 128,
|
|
418
|
+
enableMatch: true,
|
|
419
|
+
},
|
|
420
|
+
{ name: "priority", dataType: "INT32" },
|
|
421
|
+
],
|
|
422
|
+
});
|
|
423
|
+
console.log(res.data);
|
|
384
424
|
```
|
|
385
425
|
|
|
386
|
-
|
|
426
|
+
> Creation is asynchronous — poll [`databases.status`](#databasesstatus) until infrastructure
|
|
427
|
+
> is provisioned before ingesting.
|
|
387
428
|
|
|
388
|
-
|
|
429
|
+
#### `databases.list`
|
|
389
430
|
|
|
390
|
-
|
|
391
|
-
- `0.0`: more keyword/BM25 weighted
|
|
392
|
-
- `"auto"`: backend chooses the balance
|
|
431
|
+
`GET /databases` → `HandlerEnvelopeTenantsTenantIdsResponse`
|
|
393
432
|
|
|
394
|
-
|
|
433
|
+
List all databases for the authenticated user. Takes no request body.
|
|
395
434
|
|
|
396
|
-
```
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
subTenantId: SUB_TENANT_ID,
|
|
400
|
-
query: "enterprise plan",
|
|
401
|
-
queryBy: "text",
|
|
402
|
-
operator: "phrase", // "or" | "and" | "phrase"
|
|
403
|
-
type: "knowledge",
|
|
404
|
-
});
|
|
435
|
+
```typescript
|
|
436
|
+
const res = await client.databases.list();
|
|
437
|
+
console.log(res.data);
|
|
405
438
|
```
|
|
406
439
|
|
|
407
|
-
|
|
440
|
+
#### `databases.collections`
|
|
408
441
|
|
|
409
|
-
|
|
442
|
+
`GET /databases/collections` → `HandlerEnvelopeTenantsSubTenantIdsResponse`
|
|
410
443
|
|
|
411
|
-
|
|
444
|
+
List all collections within a database.
|
|
412
445
|
|
|
413
|
-
```
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
subTenantId: SUB_TENANT_ID,
|
|
417
|
-
query: "revenue forecast",
|
|
418
|
-
maxResults: 10,
|
|
419
|
-
metadataFilters: {
|
|
420
|
-
department: "sales",
|
|
421
|
-
additional_metadata: { author: "Alice" },
|
|
422
|
-
},
|
|
423
|
-
});
|
|
446
|
+
```typescript
|
|
447
|
+
const res = await client.databases.collections({ database: "acme-corp" });
|
|
448
|
+
console.log(res.data);
|
|
424
449
|
```
|
|
425
450
|
|
|
426
|
-
|
|
451
|
+
#### `databases.stats`
|
|
427
452
|
|
|
428
|
-
|
|
429
|
-
|---|---|---|
|
|
430
|
-
| `tenantId` | `string` | Tenant identifier (required). |
|
|
431
|
-
| `query` | `string` | Search terms (required). |
|
|
432
|
-
| `subTenantId` | `string` | Optional sub-tenant identifier. |
|
|
433
|
-
| `maxResults` | `number` | Maximum number of results. |
|
|
434
|
-
| `mode` | `string` | `"fast"` or `"thinking"`. |
|
|
435
|
-
| `alpha` | `string \| number` | Hybrid balance (`0.0`–`1.0` or `"auto"`). |
|
|
436
|
-
| `recencyBias` | `number` | Preference for newer content (`0.0`–`1.0`). |
|
|
437
|
-
| `graphContext` | `boolean` | Enable graph context (on by default in v2; set `false` to omit). |
|
|
438
|
-
| `queryForcefulRelations` | `boolean` | Search forceful relations in thinking mode. |
|
|
439
|
-
| `additionalContext` | `string` | Extra context to guide retrieval. |
|
|
440
|
-
| `queryApps` | `boolean` | Run a parallel app-aware retrieval lane and fuse results. |
|
|
441
|
-
| `metadataFilters` | `object` | Key-value metadata filters. |
|
|
442
|
-
| `type` | `string` | `"knowledge"`, `"memory"`, or `"all"`. |
|
|
443
|
-
| `queryBy` | `string` | `"hybrid"` or `"text"`. |
|
|
444
|
-
| `operator` | `string` | `"or"`, `"and"`, or `"phrase"` (only with `queryBy: "text"`). |
|
|
453
|
+
`GET /databases/stats` → `HandlerEnvelopeTenantsTenantStatsResponse`
|
|
445
454
|
|
|
446
|
-
|
|
455
|
+
Get collection statistics for a database.
|
|
447
456
|
|
|
448
|
-
|
|
457
|
+
```typescript
|
|
458
|
+
const res = await client.databases.stats({ database: "acme-corp" });
|
|
459
|
+
console.log(res.data);
|
|
460
|
+
```
|
|
449
461
|
|
|
450
|
-
|
|
451
|
-
import { HydraDBClient, buildString } from "@hydradb/sdk";
|
|
462
|
+
#### `databases.status`
|
|
452
463
|
|
|
453
|
-
|
|
464
|
+
`GET /databases/status` → `HandlerEnvelopeTenantsInfraStatusResponseV2`
|
|
454
465
|
|
|
455
|
-
|
|
456
|
-
tenantId: TENANT_ID,
|
|
457
|
-
query: "What does the user prefer?",
|
|
458
|
-
});
|
|
466
|
+
Check infrastructure provisioning status for a database.
|
|
459
467
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
console.log(
|
|
468
|
+
```typescript
|
|
469
|
+
const res = await client.databases.status({ database: "acme-corp" });
|
|
470
|
+
console.log(res.data);
|
|
463
471
|
```
|
|
464
472
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
## Inspect, list, and delete sources
|
|
473
|
+
#### `databases.delete`
|
|
468
474
|
|
|
469
|
-
|
|
475
|
+
`DELETE /databases` → `HandlerEnvelopeTenantsTenantDeleteResponse`
|
|
470
476
|
|
|
471
|
-
|
|
472
|
-
const sources = await client.context.list({
|
|
473
|
-
tenantId: TENANT_ID,
|
|
474
|
-
subTenantId: SUB_TENANT_ID,
|
|
475
|
-
type: "knowledge",
|
|
476
|
-
page: 1,
|
|
477
|
-
pageSize: 50,
|
|
478
|
-
});
|
|
477
|
+
Delete a database and **all** associated data.
|
|
479
478
|
|
|
480
|
-
|
|
479
|
+
```typescript
|
|
480
|
+
const res = await client.databases.delete({ database: "acme-corp" });
|
|
481
|
+
console.log(res.data);
|
|
481
482
|
```
|
|
482
483
|
|
|
483
|
-
|
|
484
|
+
---
|
|
484
485
|
|
|
485
|
-
###
|
|
486
|
+
### Webhooks (`client.webhooks`)
|
|
486
487
|
|
|
487
|
-
|
|
488
|
-
const sources = await client.context.list({
|
|
489
|
-
tenantId: TENANT_ID,
|
|
490
|
-
subTenantId: SUB_TENANT_ID,
|
|
491
|
-
type: "knowledge",
|
|
492
|
-
ids: ["doc_a", "doc_b"],
|
|
493
|
-
});
|
|
494
|
-
```
|
|
488
|
+
Register a single indexing webhook per org and inspect/replay its deliveries.
|
|
495
489
|
|
|
496
|
-
|
|
490
|
+
#### `webhooks.register`
|
|
497
491
|
|
|
498
|
-
|
|
499
|
-
const filtered = await client.context.list({
|
|
500
|
-
tenantId: TENANT_ID,
|
|
501
|
-
subTenantId: SUB_TENANT_ID,
|
|
502
|
-
type: "knowledge",
|
|
503
|
-
filters: {
|
|
504
|
-
tenant_metadata: { department: "sales" },
|
|
505
|
-
document_metadata: { author: "Alice" },
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
```
|
|
492
|
+
`POST /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookRegisterResponse`
|
|
509
493
|
|
|
510
|
-
|
|
494
|
+
Register (or update) the indexing webhook for this API key’s org.
|
|
511
495
|
|
|
512
|
-
```
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
includeFields: ["title", "document_metadata", "tenant_metadata"],
|
|
496
|
+
```typescript
|
|
497
|
+
const res = await client.webhooks.register({
|
|
498
|
+
url: "https://example.com/hooks/hydradb",
|
|
499
|
+
eventTypes: ["indexing.status_changed"], // the only supported event type
|
|
500
|
+
signingSecret: "whsec_at_least_16_chars", // must be >= 16 characters
|
|
518
501
|
});
|
|
502
|
+
console.log(res.data);
|
|
519
503
|
```
|
|
520
504
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
```text
|
|
524
|
-
attachments, content, description, document_metadata, note, relations,
|
|
525
|
-
tenant_metadata, timestamp, title, type, url
|
|
526
|
-
```
|
|
505
|
+
#### `webhooks.get`
|
|
527
506
|
|
|
528
|
-
|
|
507
|
+
`GET /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookGetResponse`
|
|
529
508
|
|
|
530
|
-
|
|
531
|
-
const source = await client.context.inspect({
|
|
532
|
-
tenantId: TENANT_ID,
|
|
533
|
-
subTenantId: SUB_TENANT_ID,
|
|
534
|
-
id: "source-id-1",
|
|
535
|
-
mode: "content",
|
|
536
|
-
});
|
|
509
|
+
Fetch the currently registered webhook. Takes no request body.
|
|
537
510
|
|
|
538
|
-
|
|
511
|
+
```typescript
|
|
512
|
+
const res = await client.webhooks.get();
|
|
513
|
+
console.log(res.data);
|
|
539
514
|
```
|
|
540
515
|
|
|
541
|
-
|
|
516
|
+
#### `webhooks.test`
|
|
542
517
|
|
|
543
|
-
|
|
544
|
-
const source = await client.context.inspect({
|
|
545
|
-
tenantId: TENANT_ID,
|
|
546
|
-
subTenantId: SUB_TENANT_ID,
|
|
547
|
-
id: "source-id-1",
|
|
548
|
-
mode: "url",
|
|
549
|
-
expirySeconds: 3600,
|
|
550
|
-
});
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
### Fetch graph relations
|
|
518
|
+
`POST /webhooks/indexing/test` → `HandlerEnvelopeWebhooksWebhookTestResponse`
|
|
554
519
|
|
|
555
|
-
|
|
556
|
-
const relations = await client.context.relations({
|
|
557
|
-
tenantId: TENANT_ID,
|
|
558
|
-
subTenantId: SUB_TENANT_ID,
|
|
559
|
-
id: "source-id-1",
|
|
560
|
-
type: "knowledge",
|
|
561
|
-
limit: 10,
|
|
562
|
-
});
|
|
520
|
+
Send a test delivery to the registered endpoint.
|
|
563
521
|
|
|
564
|
-
|
|
522
|
+
```typescript
|
|
523
|
+
const res = await client.webhooks.test();
|
|
524
|
+
console.log(res.data);
|
|
565
525
|
```
|
|
566
526
|
|
|
567
|
-
|
|
527
|
+
#### `webhooks.delete`
|
|
568
528
|
|
|
569
|
-
|
|
529
|
+
`DELETE /webhooks/indexing` → `HandlerEnvelopeWebhooksWebhookDeleteResponse`
|
|
570
530
|
|
|
571
|
-
|
|
531
|
+
Remove the registered webhook.
|
|
572
532
|
|
|
573
|
-
```
|
|
574
|
-
await client.
|
|
575
|
-
|
|
576
|
-
subTenantId: SUB_TENANT_ID,
|
|
577
|
-
ids: ["source-id-1", "source-id-2"],
|
|
578
|
-
type: "knowledge",
|
|
579
|
-
});
|
|
533
|
+
```typescript
|
|
534
|
+
const res = await client.webhooks.delete();
|
|
535
|
+
console.log(res.data);
|
|
580
536
|
```
|
|
581
537
|
|
|
582
|
-
|
|
538
|
+
#### `webhooks.listDeliveries`
|
|
583
539
|
|
|
584
|
-
|
|
540
|
+
`GET /webhooks/indexing/deliveries` → `HandlerEnvelopeWebhooksDeliveryListResponse`
|
|
585
541
|
|
|
586
|
-
|
|
542
|
+
List recent webhook deliveries, with filtering and cursor pagination.
|
|
587
543
|
|
|
588
|
-
```
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
544
|
+
```typescript
|
|
545
|
+
const res = await client.webhooks.listDeliveries({
|
|
546
|
+
limit: 50,
|
|
547
|
+
cursor: undefined, // pass the previous page's cursor to continue
|
|
548
|
+
status: "failed", // filter by delivery status
|
|
593
549
|
});
|
|
594
|
-
|
|
595
|
-
console.log(hook);
|
|
550
|
+
console.log(res.data);
|
|
596
551
|
```
|
|
597
552
|
|
|
598
|
-
|
|
553
|
+
#### `webhooks.getDelivery`
|
|
599
554
|
|
|
600
|
-
|
|
555
|
+
`GET` → `HandlerEnvelopeWebhooksDeliveryItem`
|
|
601
556
|
|
|
602
|
-
|
|
603
|
-
|
|
557
|
+
Fetch a single delivery by ID.
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
const res = await client.webhooks.getDelivery({ deliveryId: "dlv_1234" });
|
|
561
|
+
console.log(res.data);
|
|
604
562
|
```
|
|
605
563
|
|
|
606
|
-
|
|
564
|
+
#### `webhooks.retryDelivery`
|
|
607
565
|
|
|
608
|
-
|
|
609
|
-
await client.webhooks.delete();
|
|
610
|
-
```
|
|
566
|
+
`POST` → `HandlerEnvelopeWebhooksRetryResponse`
|
|
611
567
|
|
|
612
|
-
|
|
568
|
+
Re‑attempt a failed delivery.
|
|
613
569
|
|
|
614
|
-
```
|
|
615
|
-
await client.webhooks.
|
|
570
|
+
```typescript
|
|
571
|
+
const res = await client.webhooks.retryDelivery({ deliveryId: "dlv_1234" });
|
|
572
|
+
console.log(res.data);
|
|
616
573
|
```
|
|
617
574
|
|
|
618
|
-
|
|
575
|
+
---
|
|
619
576
|
|
|
620
|
-
|
|
621
|
-
const deliveries = await client.webhooks.listDeliveries({
|
|
622
|
-
limit: 20,
|
|
623
|
-
status: "failed", // pending | failed | delivered | permanently_failed
|
|
624
|
-
});
|
|
625
|
-
console.log(deliveries);
|
|
577
|
+
## Error handling
|
|
626
578
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
```
|
|
579
|
+
Non‑2xx responses throw typed errors. Each carries `statusCode`, the parsed `body`, and the
|
|
580
|
+
`rawResponse`. All extend `HydraDBError`.
|
|
630
581
|
|
|
631
|
-
|
|
582
|
+
```typescript
|
|
583
|
+
import {
|
|
584
|
+
HydraDBClient,
|
|
585
|
+
HydraDB, // namespace with the typed error classes
|
|
586
|
+
HydraDBError,
|
|
587
|
+
} from "@hydradb/sdk";
|
|
632
588
|
|
|
633
|
-
|
|
589
|
+
const client = new HydraDBClient({ token: "YOUR_API_KEY" });
|
|
634
590
|
|
|
635
|
-
|
|
636
|
-
await client.
|
|
591
|
+
try {
|
|
592
|
+
await client.databases.status({ database: "does-not-exist" });
|
|
593
|
+
} catch (err) {
|
|
594
|
+
if (err instanceof HydraDB.NotFoundError) {
|
|
595
|
+
console.error("not found:", err.body);
|
|
596
|
+
} else if (err instanceof HydraDBError) {
|
|
597
|
+
console.error(`API error ${err.statusCode}:`, err.body);
|
|
598
|
+
} else {
|
|
599
|
+
throw err;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
637
602
|
```
|
|
638
603
|
|
|
639
|
-
|
|
604
|
+
Typed error classes (under the `HydraDB` namespace): `BadRequestError` (400),
|
|
605
|
+
`ForbiddenError` (403), `NotFoundError` (404), `ConflictError` (409),
|
|
606
|
+
`UnprocessableEntityError` (422), `InternalServerError` (500). Network/timeout failures throw
|
|
607
|
+
`HydraDBTimeoutError` / `HydraDBError`.
|
|
640
608
|
|
|
641
|
-
|
|
609
|
+
---
|
|
642
610
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
611
|
+
## Advanced
|
|
612
|
+
|
|
613
|
+
### Per-request options (timeouts, retries, abort)
|
|
614
|
+
|
|
615
|
+
Every method accepts a second `requestOptions` argument that overrides client defaults for
|
|
616
|
+
that call.
|
|
617
|
+
|
|
618
|
+
```typescript
|
|
619
|
+
const controller = new AbortController();
|
|
647
620
|
|
|
648
|
-
|
|
621
|
+
await client.query(
|
|
622
|
+
{ query: "hello", database: "acme-corp" },
|
|
623
|
+
{
|
|
624
|
+
timeoutInSeconds: 30,
|
|
625
|
+
maxRetries: 3,
|
|
626
|
+
apiVersion: "2",
|
|
627
|
+
headers: { "X-Trace-Id": "abc123" },
|
|
628
|
+
abortSignal: controller.signal,
|
|
629
|
+
},
|
|
630
|
+
);
|
|
649
631
|
```
|
|
650
632
|
|
|
651
|
-
|
|
633
|
+
### Passthrough `fetch`
|
|
652
634
|
|
|
653
|
-
|
|
635
|
+
For endpoints not yet wrapped by the SDK, `client.fetch` issues a request using the SDK's
|
|
636
|
+
configured auth, retries, and logging. Relative paths resolve against the configured base URL.
|
|
654
637
|
|
|
655
|
-
```
|
|
656
|
-
const response = await client.fetch("/
|
|
657
|
-
|
|
638
|
+
```typescript
|
|
639
|
+
const response = await client.fetch("/some/new/endpoint", {
|
|
640
|
+
method: "POST",
|
|
641
|
+
body: JSON.stringify({ hello: "world" }),
|
|
642
|
+
});
|
|
643
|
+
console.log(await response.json());
|
|
658
644
|
```
|
|
659
645
|
|
|
660
|
-
|
|
646
|
+
### Custom fetch & logging
|
|
661
647
|
|
|
662
|
-
```
|
|
663
|
-
import {
|
|
664
|
-
|
|
665
|
-
HydraDBTimeoutError,
|
|
666
|
-
HydraDB,
|
|
667
|
-
} from "@hydradb/sdk";
|
|
648
|
+
```typescript
|
|
649
|
+
import { HydraDBClient } from "@hydradb/sdk";
|
|
650
|
+
import nodeFetch from "node-fetch";
|
|
668
651
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
documents: [{ path: "./missing.pdf" }],
|
|
675
|
-
});
|
|
676
|
-
} catch (error) {
|
|
677
|
-
if (error instanceof HydraDBTimeoutError) {
|
|
678
|
-
console.error("Request timed out", error);
|
|
679
|
-
} else if (error instanceof HydraDB.UnauthorizedError) {
|
|
680
|
-
console.error("Invalid or missing API key");
|
|
681
|
-
} else if (error instanceof HydraDBError) {
|
|
682
|
-
console.error("Hydra DB API error", error.statusCode, error.body);
|
|
683
|
-
} else {
|
|
684
|
-
console.error("Unexpected error", error);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
652
|
+
const client = new HydraDBClient({
|
|
653
|
+
token: "YOUR_API_KEY",
|
|
654
|
+
fetch: nodeFetch as unknown as typeof fetch,
|
|
655
|
+
logging: { level: "debug" },
|
|
656
|
+
});
|
|
687
657
|
```
|
|
688
658
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
|
707
|
-
|
|
708
|
-
| `
|
|
709
|
-
| `
|
|
710
|
-
| `
|
|
711
|
-
| `
|
|
712
|
-
| `
|
|
713
|
-
| `
|
|
714
|
-
| `
|
|
715
|
-
| `
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
| `client.webhooks.register()` | Register a webhook. |
|
|
722
|
-
| `client.webhooks.get()` | Get the current webhook. |
|
|
723
|
-
| `client.webhooks.delete()` | Delete the webhook. |
|
|
724
|
-
| `client.webhooks.test()` | Send a test event. |
|
|
725
|
-
| `client.webhooks.listDeliveries()` | List webhook deliveries. |
|
|
726
|
-
| `client.webhooks.getDelivery()` | Get a single delivery. |
|
|
727
|
-
| `client.webhooks.retryDelivery()` | Retry a delivery. |
|
|
728
|
-
| `client.fetch()` | Authenticated passthrough request. |
|
|
729
|
-
| `buildString()` | Format a query result into an LLM-ready string. |
|
|
730
|
-
|
|
731
|
-
## Notes for contributors
|
|
732
|
-
|
|
733
|
-
This SDK is generated from the Hydra DB API definition with Fern. The generated clients live in `Client.ts` and under `api/resources/{context,tenants,webhooks}/client/Client.ts`. If method signatures change in the generated code, update this README to match.
|
|
734
|
-
|
|
735
|
-
Before publishing, verify these stay consistent:
|
|
736
|
-
|
|
737
|
-
- Package name and version in `package.json` (`@hydradb/sdk`)
|
|
738
|
-
- Installation command in this README
|
|
739
|
-
- Request fields use camelCase
|
|
740
|
-
- The ingest payload shapes (`documentMetadata`, `appKnowledge`, and `memories` are JSON strings)
|
|
741
|
-
|
|
742
|
-
## Links
|
|
743
|
-
|
|
744
|
-
- **Homepage:** [hydradb.com](https://www.hydradb.com/)
|
|
745
|
-
- **Documentation:** [docs.hydradb.com](https://docs.hydradb.com/)
|
|
746
|
-
- **API Reference:** [docs.hydradb.com/api-reference/introduction](https://docs.hydradb.com/api-reference/introduction)
|
|
747
|
-
|
|
748
|
-
## Support
|
|
749
|
-
|
|
750
|
-
If you have any questions or need help, reach out at [founders@hydradb.com](mailto:founders@hydradb.com).
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
## Endpoint reference
|
|
662
|
+
|
|
663
|
+
| Group | Method | HTTP | Description |
|
|
664
|
+
| --------- | ----------------------- | ------------------------------------------ | ----------- |
|
|
665
|
+
| — | `query` | `POST /query` | Unified hybrid/text retrieval with optional graph context. |
|
|
666
|
+
| context | `ingest` | `POST /context/ingest` | Ingest documents or memories (multipart). |
|
|
667
|
+
| context | `list` | `POST /context/list` | List sources/memories with filters + pagination. |
|
|
668
|
+
| context | `inspect` | `GET /context/inspect` | Fetch a source’s content + presigned URL. |
|
|
669
|
+
| context | `status` | `GET /context/status` | Processing status for one or many source IDs. |
|
|
670
|
+
| context | `relations` | `GET /context/relations` | KG relations for a database or source. |
|
|
671
|
+
| context | `updateSourceMetadata` | `PATCH /context/sources/{id}/metadata` | Merge/upsert metadata for a source. |
|
|
672
|
+
| context | `delete` | `DELETE /context` | Delete sources/memories by ID. |
|
|
673
|
+
| databases | `create` | `POST /databases` | Create a database with optional schema. |
|
|
674
|
+
| databases | `list` | `GET /databases` | List all databases. |
|
|
675
|
+
| databases | `collections` | `GET /databases/collections` | List collections in a database. |
|
|
676
|
+
| databases | `stats` | `GET /databases/stats` | Collection statistics. |
|
|
677
|
+
| databases | `status` | `GET /databases/status` | Infra provisioning status. |
|
|
678
|
+
| databases | `delete` | `DELETE /databases` | Delete a database and its data. |
|
|
679
|
+
| webhooks | `register` | `POST /webhooks/indexing` | Register/update the org indexing webhook. |
|
|
680
|
+
| webhooks | `get` | `GET /webhooks/indexing` | Get the registered webhook. |
|
|
681
|
+
| webhooks | `test` | `POST /webhooks/indexing/test` | Send a test delivery. |
|
|
682
|
+
| webhooks | `delete` | `DELETE /webhooks/indexing` | Remove the webhook. |
|
|
683
|
+
| webhooks | `listDeliveries` | `GET /webhooks/indexing/deliveries` | List recent deliveries. |
|
|
684
|
+
| webhooks | `getDelivery` | `GET` | Fetch one delivery by ID. |
|
|
685
|
+
| webhooks | `retryDelivery` | `POST` | Retry a failed delivery. |
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
_This SDK is generated from the HydraDB API definition. For the full type reference see the
|
|
690
|
+
`api/` directory or https://docs.hydradb.com._
|