nenavi 0.0.0 → 0.1.0-alpha.2
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/LICENSE +191 -0
- package/README.md +72 -1
- package/dist/cjs/client.d.ts +328 -0
- package/dist/cjs/client.js +918 -0
- package/dist/cjs/core.d.ts +80 -0
- package/dist/cjs/core.js +426 -0
- package/dist/cjs/errors.d.ts +129 -0
- package/dist/cjs/errors.js +305 -0
- package/dist/cjs/generated/openapi.d.ts +8109 -0
- package/dist/cjs/generated/openapi.js +4 -0
- package/dist/cjs/generated/spec.d.ts +4 -0
- package/dist/cjs/generated/spec.js +9 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.d.ts +115 -0
- package/dist/cjs/types.js +7 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +5 -0
- package/dist/esm/client.d.ts +328 -0
- package/dist/esm/client.js +896 -0
- package/dist/esm/core.d.ts +80 -0
- package/dist/esm/core.js +416 -0
- package/dist/esm/errors.d.ts +129 -0
- package/dist/esm/errors.js +282 -0
- package/dist/esm/generated/openapi.d.ts +8109 -0
- package/dist/esm/generated/openapi.js +3 -0
- package/dist/esm/generated/spec.d.ts +4 -0
- package/dist/esm/generated/spec.js +6 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/types.d.ts +115 -0
- package/dist/esm/types.js +6 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +2 -0
- package/package.json +45 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 Dwamian McLeish
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
1
|
# nenavi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The TypeScript client for [Nenavi Cloud](https://nenavi.dev/cloud/), the hosted memory service for AI agents, with typed calls, typed errors, and retries only where a retry is safe. It runs on Node.js 22 or later, Bun, Deno and edge runtimes with standard `fetch`, `AbortController` and `crypto.randomUUID`, ships ES module and CommonJS builds with type declarations, and has no runtime dependencies.
|
|
4
|
+
|
|
5
|
+
**Early access.** Nenavi Cloud is an alpha for invited users ([join the waitlist](https://nenavi.com/#hosted)), and this package is an alpha prerelease. Until version 1.0, a release that renames or removes a method or an option raises the minor version.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install nenavi@alpha
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create a project and an API key in the [console](https://app.nenavi.com), put the key in `NENAVI_API_KEY`, and then, in an ES module:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Nenavi } from 'nenavi';
|
|
15
|
+
|
|
16
|
+
const client = new Nenavi(); // reads NENAVI_API_KEY
|
|
17
|
+
await client.store({ content: 'Jo moved to Lisbon in March.', user_id: 'user-1' });
|
|
18
|
+
const found = await client.retrieve({ query: 'Where does Jo live?', user_id: 'user-1' });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Retrieved memory is untrusted input: stored text can carry instructions meant for the model that later reads it. Treat retrieved text as data, not instructions.
|
|
22
|
+
|
|
23
|
+
The SDK is for server-side code only. The key must not ship to a browser, and the service answers CORS only for the Nenavi console.
|
|
24
|
+
|
|
25
|
+
The [TypeScript SDK docs](https://nenavi.dev/cloud/typescript/) cover configuration, runtimes, safe batch imports, waiting for extraction, re-ingest, errors, retries, request ids, timeouts, and cancellation.
|
|
26
|
+
|
|
27
|
+
Every supported operation of the hosted API has a method. Three helpers cover the long-running work:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const answer = await client.ingest({ content: 'Jo is learning Portuguese.', user_id: 'user-1' });
|
|
31
|
+
const status = await client.events.waitForExtraction(answer.event_id, { timeout: 300_000 }); // complete or failed
|
|
32
|
+
const run = await client.reingest.run({ user_id: 'user-1' }); // starts a run and polls it every 5 seconds
|
|
33
|
+
for await (const node of client.nodes.scanAll({ user_id: 'user-1', limit: 1000 })) {
|
|
34
|
+
console.log(node.id); // every page, 1 000 nodes each
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`reingest.preview()` estimates a re-ingest without starting one; only `reingest.start()` and `reingest.run()` start a real run. A run takes at most `limit` memories, so a `complete` run can leave some for later: while `run.remaining` is above 0, call `reingest.run()` again with the same parameters to continue it.
|
|
39
|
+
|
|
40
|
+
The helpers' `timeout` and `interval` are in milliseconds, and aborting their `signal` stops them and any pending poll. A helper that runs out of time throws `WaitTimeoutError` with the last status as `lastStatus`, and a poll that fails inside `reingest.run()` throws its own error with `lastStatus` set the same way, so the run's `run_id` is not lost; `timeout: 0` polls once, and `reingest.run()` still starts the run. Every poll and every scan page counts against the key's request rate limit (60 a minute by default) like any other call, and `store()`, `ingest()` and `retrieve()` are never retried on a `429`. So for a large scan pass a larger `limit` (up to 1 000 nodes a page), and run background jobs with a longer `interval` or their own key. The helpers are on the client only, not on `withRawResponse`.
|
|
41
|
+
|
|
42
|
+
## Options
|
|
43
|
+
|
|
44
|
+
`new Nenavi({ apiKey, baseURL, timeout, maxRetries, fetch })`:
|
|
45
|
+
|
|
46
|
+
- `apiKey` defaults to `NENAVI_API_KEY`, and `baseURL` to `NENAVI_BASE_URL`, else `https://api.prismemory.com`. Both variables are read from `process.env` where it exists. A client without a key can call only `health()`; every other method throws `ConfigurationError` before it sends anything.
|
|
47
|
+
- `timeout` is in milliseconds per attempt (30 000 by default), and `maxRetries` bounds the automatic retries (2 by default).
|
|
48
|
+
- `fetch` replaces the runtime's `fetch`, for tests and unusual runtimes.
|
|
49
|
+
|
|
50
|
+
Every method takes a final options argument `{ signal, timeout, maxRetries }`. Aborting `signal` stops the request and any pending retry, and the call rejects with the signal's reason, as `fetch` does. `ingestFast()` and the node `PUT` methods also take `idempotencyKey`. That reason carries no `Idempotency-Key`, so when you pass a `signal` to `ingestFast()`, pass your own `idempotencyKey` too and reuse it to retry an aborted call; a new key is a new batch, stored and metered again.
|
|
51
|
+
|
|
52
|
+
On Deno, reading the two variables needs `--allow-env=NENAVI_API_KEY,NENAVI_BASE_URL`. Without it, an interactive Deno asks for the permission, and a non-interactive one treats both as unset.
|
|
53
|
+
|
|
54
|
+
Request and response fields keep the API's snake_case names (`user_id`, `event_id`), and the types are generated from `sdks/openapi.json`. `client.withRawResponse` has the same methods and returns `{ status, headers, requestId, data }`.
|
|
55
|
+
|
|
56
|
+
## Errors and retries
|
|
57
|
+
|
|
58
|
+
Every error the SDK throws is a `NenaviError`, and every class works with `instanceof`: `APIError` and its subclasses (`AuthenticationError`, `NotFoundError`, `RateLimitError`, `QuotaExceededError`, `ServiceUnavailableError` and the others) carry `status`, `reasonCode`, `detail` and `requestId`. `APIConnectionError` and `APITimeoutError` mean no response arrived. `ResponseValidationError` means a `2xx` answer had a body the SDK could not read as the operation's type: the call may have taken effect, so read its `body` (for example the `event_id` of a `store()`) and `requestId` before calling again. `body` can hold stored memory text, and `console.error(error)` or `JSON.stringify(error)` prints it: log the message and `requestId` instead.
|
|
59
|
+
|
|
60
|
+
Only `GET` methods and `ingestFast()` retry by themselves, on a `429 rate_limited` (after `Retry-After`), a `503 database_unavailable` or `lease_unavailable`, or a connection error. `store()`, `ingest()` and `retrieve()` never retry: a retried store stores the text again and counts twice against the monthly limits. `ingestFast()` sends one `Idempotency-Key` on every retry of a call. A timeout is never retried, so to retry it by hand, pass the error's `idempotencyKey`. If you wrap `ingestFast()` in your own retry loop, make one key before the first attempt and pass it on every attempt: a call without a key gets a new one, and the service stores and meters the batch again.
|
|
61
|
+
|
|
62
|
+
## Development
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
pnpm --filter nenavi test # builds dist/, then runs the tests
|
|
66
|
+
pnpm --filter nenavi lint
|
|
67
|
+
pnpm --filter nenavi type-check
|
|
68
|
+
pnpm --filter nenavi build
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- `src/generated/` holds the types generated from `sdks/openapi.json` by `openapi-typescript`, with `SPEC_VERSION` and `SPEC_SHA256`. After the snapshot changes, run `pnpm --filter nenavi generate`; `test/generated.test.ts` fails until you do.
|
|
72
|
+
- `test/conformance.test.ts` runs every scenario in `sdks/conformance/` with a mock `fetch`.
|
|
73
|
+
- `test/package.test.ts` loads the built package with `import` and with `require`.
|
|
74
|
+
- `examples/quickstart.ts` stores and retrieves one memory with the key from `NENAVI_API_KEY` (and `NENAVI_BASE_URL` for a local service): `pnpm exec tsx examples/quickstart.ts`.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { Core, type Call, type ClientOptions, type IdempotentRequestOptions, type RawResponse, type RequestOptions } from './core.js';
|
|
2
|
+
import type { AliasProposalReviewResponse, AliasProposalsListParams, AliasProposalsListResponse, AliasProposalsReviewParams, AnswerCitationResponse, AnswerCitationsGetParams, AnswerCitationsListParams, AnswerCitationsListResponse, AnswerCitationsRecordParams, AssertionAggregationResponse, AssertionStateResponse, AssertionsAggregateParams, AssertionsStateParams, ClaimsMarkContradictionParams, ClaimsResolveContradictionParams, ClaimsResponse, ClaimsSupersedeParams, EventNodesResponse, EventRecord, EventsRetryExtractionParams, ExtractionResponse, ExtractionStatusResponse, ExtractionsProcessParams, ExtractionsProcessResponse, FullRetrievalEvaluationResponse, GraphParams, GraphResponse, HealthResponse, IngestFastParams, IngestFastResponse, IngestParams, IngestResponse, LearningEvaluateFullRetrievalParams, LearningEvaluateParams, LearningEvaluationResponse, LearningProfilesActivateParams, LearningProfilesActiveParams, LearningProfilesCreateParams, LearningProfilesDeactivateParams, LearningProfilesGetParams, LearningProfilesHistoryParams, LearningProfilesListParams, LearningProfilesRollbackParams, MaterializationsProcessParams, MaterializationsProcessResponse, NodeChainResponse, NodeListResponse, NodeNeighborhoodResponse, NodePageResponse, NodeResponse, NodesChainParams, NodesEvaluateConditionParams, NodesListParams, NodesNeighborhoodParams, NodesProvenanceParams, NodesReinforceParams, NodesScanParams, OrganizeParams, OrganizeResponse, PlannedQuantityAggregationResponse, ProcessingStatusResponse, ProvenanceResponse, QuantitiesAggregateParams, QuantitiesAggregateTextParams, QuantityAggregationResponse, RankingProfileActiveResponse, RankingProfileDeactivateResponse, RankingProfileHistoryResponse, RankingProfileListResponse, RankingProfileResponse, RankingProfileStateResponse, RankingProfileStatusResponse, ReingestParams, ReingestPreview, ReingestRunStatus, RelevanceGetParams, RelevanceListParams, RelevanceListResponse, RelevanceRecordParams, RelevanceRecordResponse, RetrievalReceiptResponse, RetrievalsGetParams, RetrieveParams, RetrieveResponse, StatsParams, StatsResponse, StoreParams, StoreResponse, UsageResponse } from './types.js';
|
|
3
|
+
/** What a method returns: the parsed body, or in the raw view its RawResponse. */
|
|
4
|
+
export type APIPromise<Raw extends boolean, T> = Promise<Raw extends true ? RawResponse<T> : T>;
|
|
5
|
+
declare class Resource<Raw extends boolean> {
|
|
6
|
+
protected readonly _core: Core;
|
|
7
|
+
protected readonly _raw: Raw;
|
|
8
|
+
constructor(core: Core, raw: Raw);
|
|
9
|
+
/** Build the call and send it; an error while building it rejects the promise too. */
|
|
10
|
+
protected _request<T>(build: () => Call): APIPromise<Raw, T>;
|
|
11
|
+
}
|
|
12
|
+
/** A helper's options (sdks/CONTRACT.md, Helpers). */
|
|
13
|
+
export interface HelperOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Milliseconds after which the helper stops: a deadline. Each poll's attempt gets no
|
|
16
|
+
* more than the time left (at least 1 000 milliseconds), and a retry that would wait
|
|
17
|
+
* past it is not made; a poll the deadline stops this way throws `WaitTimeoutError`
|
|
18
|
+
* too, with the poll's error as its `cause`. 0 polls once (`run()` still starts the
|
|
19
|
+
* run, with the client's own timeout); `Infinity` waits without a limit.
|
|
20
|
+
*/
|
|
21
|
+
timeout?: number;
|
|
22
|
+
/** Milliseconds between polls. */
|
|
23
|
+
interval?: number;
|
|
24
|
+
/** Aborting it stops the helper and any pending poll or retry. */
|
|
25
|
+
signal?: AbortSignal | null;
|
|
26
|
+
}
|
|
27
|
+
/** The `/v1/events` routes. */
|
|
28
|
+
export declare class Events<Raw extends boolean = false> extends Resource<Raw> {
|
|
29
|
+
/** `GET /v1/events/{event_id}`: the stored event, as the JSON object it is. */
|
|
30
|
+
get(eventId: string, options?: RequestOptions): APIPromise<Raw, EventRecord>;
|
|
31
|
+
/** `GET /v1/events/{event_id}/nodes`: the nodes derived from the event. */
|
|
32
|
+
nodes(eventId: string, options?: RequestOptions): APIPromise<Raw, EventNodesResponse>;
|
|
33
|
+
/** `GET /v1/events/{event_id}/processing-status`. */
|
|
34
|
+
processingStatus(eventId: string, options?: RequestOptions): APIPromise<Raw, ProcessingStatusResponse>;
|
|
35
|
+
/** `GET /v1/events/{event_id}/extraction`: the record, or its protected view. */
|
|
36
|
+
extraction(eventId: string, options?: RequestOptions): APIPromise<Raw, ExtractionResponse>;
|
|
37
|
+
/** `GET /v1/events/{event_id}/extraction-status`. */
|
|
38
|
+
extractionStatus(eventId: string, options?: RequestOptions): APIPromise<Raw, ExtractionStatusResponse>;
|
|
39
|
+
/** `POST /v1/events/{event_id}/retry-extraction`. Not retried automatically. */
|
|
40
|
+
retryExtraction(eventId: string, params?: EventsRetryExtractionParams, options?: RequestOptions): APIPromise<Raw, ExtractionStatusResponse>;
|
|
41
|
+
}
|
|
42
|
+
/** The `/v1/nodes` routes. */
|
|
43
|
+
export declare class Nodes<Raw extends boolean = false> extends Resource<Raw> {
|
|
44
|
+
/** `GET /v1/nodes/{node_id}`. */
|
|
45
|
+
get(nodeId: string, options?: RequestOptions): APIPromise<Raw, NodeResponse>;
|
|
46
|
+
/** `GET /v1/nodes`: list nodes. */
|
|
47
|
+
list(params?: NodesListParams, options?: RequestOptions): APIPromise<Raw, NodeListResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* `GET /v1/nodes/scan`: one page of nodes, in id order.
|
|
50
|
+
*
|
|
51
|
+
* While the page's `has_more` is true, pass its `next_cursor` as `after_id` to read the
|
|
52
|
+
* next page.
|
|
53
|
+
*/
|
|
54
|
+
scan(params?: NodesScanParams, options?: RequestOptions): APIPromise<Raw, NodePageResponse>;
|
|
55
|
+
/** `GET /v1/nodes/{node_id}/provenance`: the provenance, or its protected view. */
|
|
56
|
+
provenance(nodeId: string, params?: NodesProvenanceParams, options?: RequestOptions): APIPromise<Raw, ProvenanceResponse>;
|
|
57
|
+
/** `PUT /v1/nodes/{node_id}/promote`. Not retried automatically. */
|
|
58
|
+
promote(nodeId: string, options?: IdempotentRequestOptions): APIPromise<Raw, NodeResponse>;
|
|
59
|
+
/** `PUT /v1/nodes/{node_id}/archive`. Not retried automatically. */
|
|
60
|
+
archive(nodeId: string, options?: IdempotentRequestOptions): APIPromise<Raw, NodeResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* `PUT /v1/nodes/{node_id}/reinforce`. Not retried automatically.
|
|
63
|
+
*
|
|
64
|
+
* Sends a body only when `params` has a field.
|
|
65
|
+
*/
|
|
66
|
+
reinforce(nodeId: string, params?: NodesReinforceParams, options?: IdempotentRequestOptions): APIPromise<Raw, NodeResponse>;
|
|
67
|
+
/** `PUT /v1/nodes/{node_id}/condition`: record a conditional claim's state. Not retried automatically. */
|
|
68
|
+
evaluateCondition(nodeId: string, params: NodesEvaluateConditionParams, options?: IdempotentRequestOptions): APIPromise<Raw, NodeResponse>;
|
|
69
|
+
/** `GET /v1/nodes/{node_id}/neighborhood`: the nodes within `max_hops` edges. */
|
|
70
|
+
neighborhood(nodeId: string, params?: NodesNeighborhoodParams, options?: RequestOptions): APIPromise<Raw, NodeNeighborhoodResponse>;
|
|
71
|
+
/** `GET /v1/nodes/{node_id}/chain`: the node's supersedence chain. */
|
|
72
|
+
chain(nodeId: string, params?: NodesChainParams, options?: RequestOptions): APIPromise<Raw, NodeChainResponse>;
|
|
73
|
+
}
|
|
74
|
+
/** The `/v1/reingest` routes: re-derive one end user's stored memories. */
|
|
75
|
+
export declare class Reingest<Raw extends boolean = false> extends Resource<Raw> {
|
|
76
|
+
/**
|
|
77
|
+
* `POST /v1/reingest` with `dry_run: true`: count and estimate a run.
|
|
78
|
+
*
|
|
79
|
+
* Always sends `dry_run: true`, so a preview never starts a run. Not retried
|
|
80
|
+
* automatically.
|
|
81
|
+
*/
|
|
82
|
+
preview(params: ReingestParams, options?: RequestOptions): APIPromise<Raw, ReingestPreview>;
|
|
83
|
+
/**
|
|
84
|
+
* `POST /v1/reingest` with `dry_run: false`: start a background run.
|
|
85
|
+
*
|
|
86
|
+
* The service answers `202` with the run's `run_id`, or `200` with `run_id: null` when
|
|
87
|
+
* nothing needs re-deriving. Each memory the run takes counts as one ingest call. A run
|
|
88
|
+
* takes at most `limit` memories, so a `complete` run can leave some for later
|
|
89
|
+
* (`remaining` above 0): sending the same request again continues it. Not retried
|
|
90
|
+
* automatically; a `409` `reingest_running` throws `ConflictError`.
|
|
91
|
+
*/
|
|
92
|
+
start(params: ReingestParams, options?: RequestOptions): APIPromise<Raw, ReingestRunStatus>;
|
|
93
|
+
/** `GET /v1/reingest/{run_id}`: the run's state, counts and usage. */
|
|
94
|
+
get(runId: string, options?: RequestOptions): APIPromise<Raw, ReingestRunStatus>;
|
|
95
|
+
}
|
|
96
|
+
/** The claim routes: supersedences and contradictions. Not retried automatically. */
|
|
97
|
+
export declare class Claims<Raw extends boolean = false> extends Resource<Raw> {
|
|
98
|
+
/** `POST /v1/supersedences`: record that one claim replaces another. */
|
|
99
|
+
supersede(params: ClaimsSupersedeParams, options?: RequestOptions): APIPromise<Raw, ClaimsResponse>;
|
|
100
|
+
/** `POST /v1/contradictions`: mark two claims as contradicting each other. */
|
|
101
|
+
markContradiction(params: ClaimsMarkContradictionParams, options?: RequestOptions): APIPromise<Raw, ClaimsResponse>;
|
|
102
|
+
/** `POST /v1/contradictions/resolve`: resolve a contradiction in favor of one claim. */
|
|
103
|
+
resolveContradiction(params: ClaimsResolveContradictionParams, options?: RequestOptions): APIPromise<Raw, ClaimsResponse>;
|
|
104
|
+
}
|
|
105
|
+
/** The `/v1/alias-proposals` routes: identity review. */
|
|
106
|
+
export declare class AliasProposals<Raw extends boolean = false> extends Resource<Raw> {
|
|
107
|
+
/** `GET /v1/alias-proposals`: the alias proposals waiting for review. */
|
|
108
|
+
list(params?: AliasProposalsListParams, options?: RequestOptions): APIPromise<Raw, AliasProposalsListResponse>;
|
|
109
|
+
/** `POST /v1/alias-proposals/{proposal_operation_id}/review`. Not retried automatically. */
|
|
110
|
+
review(proposalOperationId: string, params: AliasProposalsReviewParams, options?: RequestOptions): APIPromise<Raw, AliasProposalReviewResponse>;
|
|
111
|
+
}
|
|
112
|
+
/** The `/v1/materializations` routes. */
|
|
113
|
+
export declare class Materializations<Raw extends boolean = false> extends Resource<Raw> {
|
|
114
|
+
/** `POST /v1/materializations/process`: run the due materializations. Not retried automatically. */
|
|
115
|
+
process(params: MaterializationsProcessParams, options?: RequestOptions): APIPromise<Raw, MaterializationsProcessResponse>;
|
|
116
|
+
}
|
|
117
|
+
/** The `/v1/extractions` routes. */
|
|
118
|
+
export declare class Extractions<Raw extends boolean = false> extends Resource<Raw> {
|
|
119
|
+
/** `POST /v1/extractions/process`: run the due extraction jobs. Not retried automatically. */
|
|
120
|
+
process(params: ExtractionsProcessParams, options?: RequestOptions): APIPromise<Raw, ExtractionsProcessResponse>;
|
|
121
|
+
}
|
|
122
|
+
/** The `/v1/assertions` routes: exact queries over assertions. Not retried automatically. */
|
|
123
|
+
export declare class Assertions<Raw extends boolean = false> extends Resource<Raw> {
|
|
124
|
+
/** `POST /v1/assertions/aggregate`. */
|
|
125
|
+
aggregate(params: AssertionsAggregateParams, options?: RequestOptions): APIPromise<Raw, AssertionAggregationResponse>;
|
|
126
|
+
/** `POST /v1/assertions/state`. */
|
|
127
|
+
state(params: AssertionsStateParams, options?: RequestOptions): APIPromise<Raw, AssertionStateResponse>;
|
|
128
|
+
}
|
|
129
|
+
/** The `/v1/quantities` routes: exact queries over quantities. Not retried automatically. */
|
|
130
|
+
export declare class Quantities<Raw extends boolean = false> extends Resource<Raw> {
|
|
131
|
+
/** `POST /v1/quantities/aggregate`. */
|
|
132
|
+
aggregate(params: QuantitiesAggregateParams, options?: RequestOptions): APIPromise<Raw, QuantityAggregationResponse>;
|
|
133
|
+
/** `POST /v1/quantities/aggregate-text`: plan and run an aggregation from a question. */
|
|
134
|
+
aggregateText(params: QuantitiesAggregateTextParams, options?: RequestOptions): APIPromise<Raw, PlannedQuantityAggregationResponse>;
|
|
135
|
+
}
|
|
136
|
+
/** The `/v1/retrievals` routes: retrieval receipts. */
|
|
137
|
+
export declare class Retrievals<Raw extends boolean = false> extends Resource<Raw> {
|
|
138
|
+
/** `GET /v1/retrievals/{request_id}`: the receipt, or one of its protected views. */
|
|
139
|
+
get(requestId: string, params?: RetrievalsGetParams, options?: RequestOptions): APIPromise<Raw, RetrievalReceiptResponse>;
|
|
140
|
+
}
|
|
141
|
+
/** The `/v1/relevance` routes: relevance feedback. */
|
|
142
|
+
export declare class Relevance<Raw extends boolean = false> extends Resource<Raw> {
|
|
143
|
+
/** `POST /v1/relevance`: record feedback on a retrieved memory. Not retried automatically. */
|
|
144
|
+
record(params: RelevanceRecordParams, options?: RequestOptions): APIPromise<Raw, RelevanceRecordResponse>;
|
|
145
|
+
/** `GET /v1/relevance`: the recorded feedback. */
|
|
146
|
+
list(params?: RelevanceListParams, options?: RequestOptions): APIPromise<Raw, RelevanceListResponse>;
|
|
147
|
+
/** `GET /v1/relevance/{feedback_id}`. */
|
|
148
|
+
get(feedbackId: string, params?: RelevanceGetParams, options?: RequestOptions): APIPromise<Raw, RelevanceRecordResponse>;
|
|
149
|
+
}
|
|
150
|
+
/** The `/v1/answer-citations` routes: which memories an answer cited. */
|
|
151
|
+
export declare class AnswerCitations<Raw extends boolean = false> extends Resource<Raw> {
|
|
152
|
+
/** `POST /v1/answer-citations`: record an answer's citations. Not retried automatically. */
|
|
153
|
+
record(params: AnswerCitationsRecordParams, options?: RequestOptions): APIPromise<Raw, AnswerCitationResponse>;
|
|
154
|
+
/** `GET /v1/answer-citations`: the recorded citations, each a record or its protected view. */
|
|
155
|
+
list(params?: AnswerCitationsListParams, options?: RequestOptions): APIPromise<Raw, AnswerCitationsListResponse>;
|
|
156
|
+
/** `GET /v1/answer-citations/{citation_id}`: the record, or its protected view. */
|
|
157
|
+
get(citationId: string, params?: AnswerCitationsGetParams, options?: RequestOptions): APIPromise<Raw, AnswerCitationResponse>;
|
|
158
|
+
}
|
|
159
|
+
/** The `/v1/learning/profiles` routes: ranking profiles. */
|
|
160
|
+
export declare class LearningProfiles<Raw extends boolean = false> extends Resource<Raw> {
|
|
161
|
+
/** `GET /v1/learning/profiles`. */
|
|
162
|
+
list(params?: LearningProfilesListParams, options?: RequestOptions): APIPromise<Raw, RankingProfileListResponse>;
|
|
163
|
+
/** `POST /v1/learning/profiles`: create a profile. Not retried automatically. */
|
|
164
|
+
create(params: LearningProfilesCreateParams, options?: RequestOptions): APIPromise<Raw, RankingProfileResponse>;
|
|
165
|
+
/** `GET /v1/learning/profiles/{profile_id}`: the profile and its status. */
|
|
166
|
+
get(profileId: string, params?: LearningProfilesGetParams, options?: RequestOptions): APIPromise<Raw, RankingProfileStatusResponse>;
|
|
167
|
+
/** `GET /v1/learning/profiles/active`: the active profile, or null when none is. */
|
|
168
|
+
active(params?: LearningProfilesActiveParams, options?: RequestOptions): APIPromise<Raw, RankingProfileActiveResponse>;
|
|
169
|
+
/** `GET /v1/learning/profiles/history`: the activation history. */
|
|
170
|
+
history(params?: LearningProfilesHistoryParams, options?: RequestOptions): APIPromise<Raw, RankingProfileHistoryResponse>;
|
|
171
|
+
/** `POST /v1/learning/profiles/{profile_id}/activate`. Not retried automatically. */
|
|
172
|
+
activate(profileId: string, params: LearningProfilesActivateParams, options?: RequestOptions): APIPromise<Raw, RankingProfileStateResponse>;
|
|
173
|
+
/** `POST /v1/learning/profiles/deactivate`: null when no profile was active. Not retried automatically. */
|
|
174
|
+
deactivate(params: LearningProfilesDeactivateParams, options?: RequestOptions): APIPromise<Raw, RankingProfileDeactivateResponse>;
|
|
175
|
+
/** `POST /v1/learning/profiles/rollback`. Not retried automatically. */
|
|
176
|
+
rollback(params: LearningProfilesRollbackParams, options?: RequestOptions): APIPromise<Raw, RankingProfileStateResponse>;
|
|
177
|
+
}
|
|
178
|
+
/** The `/v1/learning` routes: offline evaluation and ranking profiles. */
|
|
179
|
+
export declare class Learning<Raw extends boolean = false> extends Resource<Raw> {
|
|
180
|
+
readonly profiles: LearningProfiles<Raw>;
|
|
181
|
+
constructor(core: Core, raw: Raw);
|
|
182
|
+
/** `POST /v1/learning/evaluate`. Not retried automatically. */
|
|
183
|
+
evaluate(params: LearningEvaluateParams, options?: RequestOptions): APIPromise<Raw, LearningEvaluationResponse>;
|
|
184
|
+
/** `POST /v1/learning/evaluate-full-retrieval`. Not retried automatically. */
|
|
185
|
+
evaluateFullRetrieval(params: LearningEvaluateFullRetrievalParams, options?: RequestOptions): APIPromise<Raw, FullRetrievalEvaluationResponse>;
|
|
186
|
+
}
|
|
187
|
+
/** `client.events`: the event routes and `waitForExtraction()`. */
|
|
188
|
+
export declare class EventsWithHelpers extends Events<false> {
|
|
189
|
+
/**
|
|
190
|
+
* Poll the event's extraction status until it is no longer `pending` or `running`.
|
|
191
|
+
*
|
|
192
|
+
* Polls `GET /v1/events/{event_id}/extraction-status` at once and then every
|
|
193
|
+
* `interval` milliseconds (2 000), and returns the first status that is not `pending`
|
|
194
|
+
* or `running`: `complete`, `failed` (returned, not thrown), or a status this SDK does
|
|
195
|
+
* not know yet. When `timeout` milliseconds (300 000) run out first, throws
|
|
196
|
+
* `WaitTimeoutError` with the last status as `lastStatus`; `timeout` is a deadline that
|
|
197
|
+
* also bounds each poll and its retries (see `HelperOptions`). Aborting `signal` stops
|
|
198
|
+
* the helper and any pending poll or retry. Each poll is an ordinary call, with the
|
|
199
|
+
* client's retries and errors, and counts against the key's request rate limit like any
|
|
200
|
+
* other call, so many waits at once can slow the key's other calls. A job can stay
|
|
201
|
+
* `pending` until the next batch flush; `extractions.process()` runs the due jobs.
|
|
202
|
+
*/
|
|
203
|
+
waitForExtraction(eventId: string, options?: HelperOptions): Promise<ExtractionStatusResponse>;
|
|
204
|
+
}
|
|
205
|
+
/** `client.nodes`: the node routes and `scanAll()`. */
|
|
206
|
+
export declare class NodesWithHelpers extends Nodes<false> {
|
|
207
|
+
/**
|
|
208
|
+
* Yield every node `scan()` reaches, one page after another.
|
|
209
|
+
*
|
|
210
|
+
* While a page's `has_more` is true, sends its `next_cursor` as the next `after_id`,
|
|
211
|
+
* with the other parameters unchanged; `limit` is the page size. Each page is an
|
|
212
|
+
* ordinary `scan()` call with `options`, sent as soon as the previous page is read, and
|
|
213
|
+
* counts against the key's request rate limit: a large `limit` (up to 1 000) needs fewer
|
|
214
|
+
* pages. A page whose `has_more` is true without a new `next_cursor` throws
|
|
215
|
+
* `NenaviError`, so a scan never ends early without saying so.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* for await (const node of client.nodes.scanAll({ user_id: 'user-1', limit: 1000 })) {
|
|
219
|
+
* console.log(node.id);
|
|
220
|
+
* }
|
|
221
|
+
*/
|
|
222
|
+
scanAll(params?: NodesScanParams, options?: RequestOptions): AsyncGenerator<NodeResponse, void, undefined>;
|
|
223
|
+
}
|
|
224
|
+
/** `client.reingest`: the re-ingest routes and `run()`. */
|
|
225
|
+
export declare class ReingestWithHelpers extends Reingest<false> {
|
|
226
|
+
/**
|
|
227
|
+
* Start a re-ingest run and poll it until its `state` is final.
|
|
228
|
+
*
|
|
229
|
+
* Sends `start()` (`dry_run: false`), then polls `get()` every `interval` milliseconds
|
|
230
|
+
* (5 000) and returns the first status whose `state` is not `pending` or `running`:
|
|
231
|
+
* `complete`, `failed` (returned, not thrown), or a state this SDK does not know yet.
|
|
232
|
+
* When nothing needs re-deriving, the service's `200` answer is returned as it is. A
|
|
233
|
+
* `409` `reingest_running` throws `ConflictError`. When `timeout` milliseconds
|
|
234
|
+
* (3 600 000) run out first, throws `WaitTimeoutError` with the last status as
|
|
235
|
+
* `lastStatus`; the run itself goes on. `timeout` is a deadline that also bounds each
|
|
236
|
+
* poll and its retries (see `HelperOptions`); it never prevents or cuts short the start,
|
|
237
|
+
* which has the client's own timeout. Aborting `signal` stops the helper and any pending
|
|
238
|
+
* poll, not the run. A poll that fails throws that call's error while the run goes on,
|
|
239
|
+
* with the last status read before it as `lastStatus`: its `run_id` lets the caller go
|
|
240
|
+
* on polling with `get()` instead of calling `run()` again, which throws `ConflictError`
|
|
241
|
+
* (`reingest_running`) until the run ends.
|
|
242
|
+
*
|
|
243
|
+
* A run takes at most `limit` memories, so a `complete` run can leave some for later
|
|
244
|
+
* (`remaining` above 0): calling `run()` again with the same parameters continues it.
|
|
245
|
+
*/
|
|
246
|
+
run(params: ReingestParams, options?: HelperOptions): Promise<ReingestRunStatus>;
|
|
247
|
+
}
|
|
248
|
+
/** The operations, in the parsed form (`Nenavi`) or the raw form (`withRawResponse`). */
|
|
249
|
+
export declare class NenaviMethods<Raw extends boolean = false> extends Resource<Raw> {
|
|
250
|
+
readonly events: Events<Raw>;
|
|
251
|
+
readonly nodes: Nodes<Raw>;
|
|
252
|
+
readonly reingest: Reingest<Raw>;
|
|
253
|
+
readonly claims: Claims<Raw>;
|
|
254
|
+
readonly aliasProposals: AliasProposals<Raw>;
|
|
255
|
+
readonly materializations: Materializations<Raw>;
|
|
256
|
+
readonly extractions: Extractions<Raw>;
|
|
257
|
+
readonly assertions: Assertions<Raw>;
|
|
258
|
+
readonly quantities: Quantities<Raw>;
|
|
259
|
+
readonly retrievals: Retrievals<Raw>;
|
|
260
|
+
readonly relevance: Relevance<Raw>;
|
|
261
|
+
readonly answerCitations: AnswerCitations<Raw>;
|
|
262
|
+
readonly learning: Learning<Raw>;
|
|
263
|
+
constructor(core: Core, raw: Raw);
|
|
264
|
+
/** `GET /v1/health`. Sends no key, and works on a client built without one. */
|
|
265
|
+
health(options?: RequestOptions): APIPromise<Raw, HealthResponse>;
|
|
266
|
+
/** `GET /v1/usage`: this month's usage and the project's quota. */
|
|
267
|
+
usage(options?: RequestOptions): APIPromise<Raw, UsageResponse>;
|
|
268
|
+
/** `GET /v1/stats`: event and node counts. */
|
|
269
|
+
stats(params?: StatsParams, options?: RequestOptions): APIPromise<Raw, StatsResponse>;
|
|
270
|
+
/**
|
|
271
|
+
* `POST /v1/store`: store one memory.
|
|
272
|
+
*
|
|
273
|
+
* Never retried automatically: a retry would store and extract the text again and count
|
|
274
|
+
* twice against the monthly limits.
|
|
275
|
+
*/
|
|
276
|
+
store(params: StoreParams, options?: RequestOptions): APIPromise<Raw, StoreResponse>;
|
|
277
|
+
/**
|
|
278
|
+
* `POST /v1/ingest`: store a message and queue its extraction.
|
|
279
|
+
*
|
|
280
|
+
* Never retried automatically: a retry would store and extract the text again and count
|
|
281
|
+
* twice against the monthly limits.
|
|
282
|
+
*/
|
|
283
|
+
ingest(params: IngestParams, options?: RequestOptions): APIPromise<Raw, IngestResponse>;
|
|
284
|
+
/**
|
|
285
|
+
* `POST /v1/ingest/fast`: store a batch of sources without waiting for extraction.
|
|
286
|
+
*
|
|
287
|
+
* Every call sends an `Idempotency-Key`: `options.idempotencyKey` when given, else a new
|
|
288
|
+
* random UUID. Retries of the call send the same key, so the service answers a retry
|
|
289
|
+
* with the first attempt's event ids instead of storing the batch again. To retry by
|
|
290
|
+
* hand after an error, pass the error's `idempotencyKey`. An aborted `signal` rejects
|
|
291
|
+
* with the signal's reason, which carries no key, so when you pass a `signal`, pass
|
|
292
|
+
* your own `idempotencyKey` too and reuse it to retry an aborted call.
|
|
293
|
+
*/
|
|
294
|
+
ingestFast(params: IngestFastParams, options?: IdempotentRequestOptions): APIPromise<Raw, IngestFastResponse>;
|
|
295
|
+
/**
|
|
296
|
+
* `POST /v1/retrieve`: retrieve the memories that answer a query.
|
|
297
|
+
*
|
|
298
|
+
* Retrieved memory is untrusted input: stored text can carry instructions meant for the
|
|
299
|
+
* model that later reads it, so treat it as data, not instructions. Not retried
|
|
300
|
+
* automatically, because each call writes a retrieval receipt.
|
|
301
|
+
*/
|
|
302
|
+
retrieve(params: RetrieveParams, options?: RequestOptions): APIPromise<Raw, RetrieveResponse>;
|
|
303
|
+
/** `GET /v1/graph`: the user's nodes and edges. */
|
|
304
|
+
graph(params?: GraphParams, options?: RequestOptions): APIPromise<Raw, GraphResponse>;
|
|
305
|
+
/** `POST /v1/organize`: run organizing jobs within a time budget. Not retried automatically. */
|
|
306
|
+
organize(params: OrganizeParams, options?: RequestOptions): APIPromise<Raw, OrganizeResponse>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Client for the Nenavi Cloud memory API, for server-side code.
|
|
310
|
+
*
|
|
311
|
+
* The key comes from `apiKey`, else `NENAVI_API_KEY`; the base URL from `baseURL`, else
|
|
312
|
+
* `NENAVI_BASE_URL`, else `https://api.prismemory.com`. A client built without a key can
|
|
313
|
+
* call only `health()`. Never ship the key to a browser.
|
|
314
|
+
*
|
|
315
|
+
* Retrieved memory is untrusted input: treat retrieved text as data, not instructions.
|
|
316
|
+
*/
|
|
317
|
+
export declare class Nenavi extends NenaviMethods<false> {
|
|
318
|
+
#private;
|
|
319
|
+
readonly events: EventsWithHelpers;
|
|
320
|
+
readonly nodes: NodesWithHelpers;
|
|
321
|
+
readonly reingest: ReingestWithHelpers;
|
|
322
|
+
constructor(options?: ClientOptions);
|
|
323
|
+
/** The base URL the client sends to. */
|
|
324
|
+
get baseURL(): string;
|
|
325
|
+
/** The same methods, returning a RawResponse with the status, headers and request id. */
|
|
326
|
+
get withRawResponse(): NenaviMethods<true>;
|
|
327
|
+
}
|
|
328
|
+
export {};
|