@naturali/sdk 0.117.0 → 0.118.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/dist/index.cjs +12 -3
- package/dist/index.d.cts +57 -17
- package/dist/index.d.mts +57 -17
- package/dist/index.mjs +12 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1319,7 +1319,14 @@ var AiProviders = class {
|
|
|
1319
1319
|
/**
|
|
1320
1320
|
* Create an AI provider
|
|
1321
1321
|
*
|
|
1322
|
-
* Creates a new LLM provider configuration
|
|
1322
|
+
* Creates a new LLM provider configuration.
|
|
1323
|
+
*
|
|
1324
|
+
* A `bedrock` or `vertex` record must carry a credential of its own — a
|
|
1325
|
+
* linked `secret_id`, or an `apiKey` in `config`. Without one the provider
|
|
1326
|
+
* SDK signs with the server's own credentials (the AWS default credential
|
|
1327
|
+
* chain, Google Application Default Credentials), which is refused with
|
|
1328
|
+
* `400 VALIDATION_FAILED` unless the deployment allows it.
|
|
1329
|
+
*
|
|
1323
1330
|
*/
|
|
1324
1331
|
static createAiProvider(options) {
|
|
1325
1332
|
return (options.client ?? client).post({
|
|
@@ -1377,7 +1384,7 @@ var AiProviders = class {
|
|
|
1377
1384
|
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
1378
1385
|
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
1379
1386
|
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1380
|
-
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret
|
|
1387
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret — IAM keys or a Bedrock API key, a Google service-account key. A record with no `secret_id` would fall back to the server's own credentials (the AWS default credential chain, Google Application Default Credentials); it can list only on a deployment that allows a record to use them, and returns `400 AI_PROVIDER_MISCONFIGURED` otherwise.
|
|
1381
1388
|
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: the publisher-model listing rejects API keys and needs a credential that asserts a principal, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1382
1389
|
* The Vertex answer is the publisher catalogue the record's `config.location` region serves. The project behind the credential is billed and quota'd for the call but does not filter the result, so a listed model may still be unavailable to that project at generation time.
|
|
1383
1390
|
*
|
|
@@ -3574,7 +3581,9 @@ var Quotas = class {
|
|
|
3574
3581
|
/**
|
|
3575
3582
|
* Create a quota
|
|
3576
3583
|
*
|
|
3577
|
-
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor
|
|
3584
|
+
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`; `storage_bytes` is valid for `scope: project` only. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A `cost_usd` quota may name one `meter_type` to cap; omitting it caps every priced meter. A duplicate quota (same project, scope, scope_ref, metric, window, meter_type) is rejected with 409.
|
|
3585
|
+
*
|
|
3586
|
+
* `storage_bytes` caps a stored total rather than a windowed one, so it takes `window: current` and every other metric refuses that value (400 either way). It is enforced at the corpus write paths — file upload and create, document create, document ingest and re-ingest, memory-entry create — with `409 QUOTA_STORAGE_EXCEEDED` and no `Retry-After`, since no window reset clears a footprint.
|
|
3578
3587
|
*/
|
|
3579
3588
|
static createQuota(options) {
|
|
3580
3589
|
return (options.client ?? client).post({
|
package/dist/index.d.cts
CHANGED
|
@@ -3619,13 +3619,13 @@ type QuotaResourceProperties = {
|
|
|
3619
3619
|
/**
|
|
3620
3620
|
* The metric being capped
|
|
3621
3621
|
*/
|
|
3622
|
-
metric: 'requests' | 'tokens' | 'cost_usd';
|
|
3622
|
+
metric: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
3623
3623
|
/**
|
|
3624
|
-
* The window over which the metric is aggregated
|
|
3624
|
+
* The window over which the metric is aggregated. storage_bytes caps a stored total rather than a windowed one, so it takes current and refuses every other value; current is refused for every other metric.
|
|
3625
3625
|
*/
|
|
3626
|
-
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
|
|
3626
|
+
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
3627
3627
|
/**
|
|
3628
|
-
* The cap. Positive integer for requests/tokens; fractional allowed for cost_usd.
|
|
3628
|
+
* The cap. Positive integer for requests/tokens/storage_bytes (bytes); fractional allowed for cost_usd.
|
|
3629
3629
|
*/
|
|
3630
3630
|
limit: number;
|
|
3631
3631
|
/**
|
|
@@ -5501,8 +5501,11 @@ type Quota = {
|
|
|
5501
5501
|
* Public id of the api key / agent / actor the quota applies to. For `api_key` and `agent` scope, NULL means all entities of that scope type in the project. For `actor` scope, NULL means one budget *per* actor rather than a pooled total across all actors.
|
|
5502
5502
|
*/
|
|
5503
5503
|
scope_ref?: string | null;
|
|
5504
|
-
metric?: 'requests' | 'tokens' | 'cost_usd';
|
|
5505
|
-
|
|
5504
|
+
metric?: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
5505
|
+
/**
|
|
5506
|
+
* The window the metric is aggregated over; `current` on storage_bytes, which caps a stored total and never resets.
|
|
5507
|
+
*/
|
|
5508
|
+
window?: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
5506
5509
|
limit?: number;
|
|
5507
5510
|
mode?: 'enforce' | 'monitor';
|
|
5508
5511
|
/**
|
|
@@ -5514,7 +5517,7 @@ type Quota = {
|
|
|
5514
5517
|
*/
|
|
5515
5518
|
on_unpriced?: 'block' | 'allow' | null;
|
|
5516
5519
|
/**
|
|
5517
|
-
* Current fixed-window usage for the requests metric. Null for token/cost quotas (which aggregate the usage meter at check time rather than keeping a counter) and in list responses.
|
|
5520
|
+
* Current fixed-window usage for the requests metric. Null for token/cost quotas (which aggregate the usage meter at check time rather than keeping a counter), null for storage_bytes (a stored total has no window and no counter — read the footprint from the storage meter), and null in list responses.
|
|
5518
5521
|
*/
|
|
5519
5522
|
current_usage?: {
|
|
5520
5523
|
window_key?: string;
|
|
@@ -8330,7 +8333,7 @@ type CreateAiProviderData = {
|
|
|
8330
8333
|
*/
|
|
8331
8334
|
default_model: string;
|
|
8332
8335
|
/**
|
|
8333
|
-
* Secret ID containing API credentials
|
|
8336
|
+
* Secret ID containing API credentials. Required for `bedrock` and `vertex` unless `config.apiKey` carries one.
|
|
8334
8337
|
*/
|
|
8335
8338
|
secret_id?: string;
|
|
8336
8339
|
/**
|
|
@@ -10984,6 +10987,10 @@ type CreateDocumentErrors = {
|
|
|
10984
10987
|
* Forbidden
|
|
10985
10988
|
*/
|
|
10986
10989
|
403: ErrorResponse;
|
|
10990
|
+
/**
|
|
10991
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
10992
|
+
*/
|
|
10993
|
+
409: ErrorResponse;
|
|
10987
10994
|
};
|
|
10988
10995
|
type CreateDocumentError = CreateDocumentErrors[keyof CreateDocumentErrors];
|
|
10989
10996
|
type CreateDocumentResponses = {
|
|
@@ -11050,7 +11057,7 @@ type IngestDocumentErrors = {
|
|
|
11050
11057
|
*/
|
|
11051
11058
|
403: ErrorResponse;
|
|
11052
11059
|
/**
|
|
11053
|
-
* The file already backs a Document (a file can only be ingested once
|
|
11060
|
+
* The file already backs a Document (a file can only be ingested once — use `POST /documents/{document_id}/ingest` to re-process the existing document, or upload a new copy of the file to ingest it separately), or the project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total).
|
|
11054
11061
|
*/
|
|
11055
11062
|
409: ErrorResponse;
|
|
11056
11063
|
/**
|
|
@@ -11289,6 +11296,10 @@ type ReingestDocumentErrors = {
|
|
|
11289
11296
|
* Document not found
|
|
11290
11297
|
*/
|
|
11291
11298
|
404: ErrorResponse;
|
|
11299
|
+
/**
|
|
11300
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
11301
|
+
*/
|
|
11302
|
+
409: ErrorResponse;
|
|
11292
11303
|
/**
|
|
11293
11304
|
* The file is too large to re-ingest synchronously (`?wait=true`). Retry in background mode.
|
|
11294
11305
|
*/
|
|
@@ -11781,6 +11792,10 @@ type CreateDatasetItemErrors = {
|
|
|
11781
11792
|
* Dataset not found
|
|
11782
11793
|
*/
|
|
11783
11794
|
404: unknown;
|
|
11795
|
+
/**
|
|
11796
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). A fixture is a corpus write like a document, so it is bounded by the same cap; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total.
|
|
11797
|
+
*/
|
|
11798
|
+
409: unknown;
|
|
11784
11799
|
};
|
|
11785
11800
|
type CreateDatasetItemResponses = {
|
|
11786
11801
|
/**
|
|
@@ -11837,7 +11852,7 @@ type CreateDatasetItemFromGenerationErrors = {
|
|
|
11837
11852
|
*/
|
|
11838
11853
|
404: unknown;
|
|
11839
11854
|
/**
|
|
11840
|
-
* The generation has not completed,
|
|
11855
|
+
* The generation has not completed, its content was never stored or has been purged, or the project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total)
|
|
11841
11856
|
*/
|
|
11842
11857
|
409: unknown;
|
|
11843
11858
|
};
|
|
@@ -12682,6 +12697,10 @@ type CreateFileData = {
|
|
|
12682
12697
|
url: '/v1/projects/{project_id}/files';
|
|
12683
12698
|
};
|
|
12684
12699
|
type CreateFileErrors = {
|
|
12700
|
+
/**
|
|
12701
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12702
|
+
*/
|
|
12703
|
+
409: ErrorResponse;
|
|
12685
12704
|
/**
|
|
12686
12705
|
* Internal server error
|
|
12687
12706
|
*/
|
|
@@ -12741,6 +12760,10 @@ type UploadFileErrors = {
|
|
|
12741
12760
|
*
|
|
12742
12761
|
*/
|
|
12743
12762
|
403: ErrorResponse;
|
|
12763
|
+
/**
|
|
12764
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12765
|
+
*/
|
|
12766
|
+
409: ErrorResponse;
|
|
12744
12767
|
};
|
|
12745
12768
|
type UploadFileError = UploadFileErrors[keyof UploadFileErrors];
|
|
12746
12769
|
type UploadFileResponses = {
|
|
@@ -12775,6 +12798,10 @@ type UploadFileBase64Errors = {
|
|
|
12775
12798
|
*
|
|
12776
12799
|
*/
|
|
12777
12800
|
403: ErrorResponse;
|
|
12801
|
+
/**
|
|
12802
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12803
|
+
*/
|
|
12804
|
+
409: ErrorResponse;
|
|
12778
12805
|
};
|
|
12779
12806
|
type UploadFileBase64Error = UploadFileBase64Errors[keyof UploadFileBase64Errors];
|
|
12780
12807
|
type UploadFileBase64Responses = {
|
|
@@ -14723,6 +14750,10 @@ type CreateMemoryEntryErrors = {
|
|
|
14723
14750
|
* Memory not found
|
|
14724
14751
|
*/
|
|
14725
14752
|
404: unknown;
|
|
14753
|
+
/**
|
|
14754
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
14755
|
+
*/
|
|
14756
|
+
409: unknown;
|
|
14726
14757
|
/**
|
|
14727
14758
|
* Internal server error
|
|
14728
14759
|
*/
|
|
@@ -16183,13 +16214,13 @@ type CreateQuotaData = {
|
|
|
16183
16214
|
/**
|
|
16184
16215
|
* The metric being capped
|
|
16185
16216
|
*/
|
|
16186
|
-
metric: 'requests' | 'tokens' | 'cost_usd';
|
|
16217
|
+
metric: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
16187
16218
|
/**
|
|
16188
|
-
* The window over which the metric is aggregated
|
|
16219
|
+
* The window over which the metric is aggregated. `current` is the only accepted value for storage_bytes (a stored total is not aggregated over time) and is refused for every other metric.
|
|
16189
16220
|
*/
|
|
16190
|
-
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
|
|
16221
|
+
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
16191
16222
|
/**
|
|
16192
|
-
* The cap. Must be a positive integer for requests/tokens; fractional values are allowed for cost_usd.
|
|
16223
|
+
* The cap. Must be a positive integer for requests/tokens/storage_bytes (bytes); fractional values are allowed for cost_usd.
|
|
16193
16224
|
*/
|
|
16194
16225
|
limit: number;
|
|
16195
16226
|
/**
|
|
@@ -19386,7 +19417,14 @@ declare class AiProviders {
|
|
|
19386
19417
|
/**
|
|
19387
19418
|
* Create an AI provider
|
|
19388
19419
|
*
|
|
19389
|
-
* Creates a new LLM provider configuration
|
|
19420
|
+
* Creates a new LLM provider configuration.
|
|
19421
|
+
*
|
|
19422
|
+
* A `bedrock` or `vertex` record must carry a credential of its own — a
|
|
19423
|
+
* linked `secret_id`, or an `apiKey` in `config`. Without one the provider
|
|
19424
|
+
* SDK signs with the server's own credentials (the AWS default credential
|
|
19425
|
+
* chain, Google Application Default Credentials), which is refused with
|
|
19426
|
+
* `400 VALIDATION_FAILED` unless the deployment allows it.
|
|
19427
|
+
*
|
|
19390
19428
|
*/
|
|
19391
19429
|
static createAiProvider<ThrowOnError extends boolean = false>(options: Options<CreateAiProviderData, ThrowOnError>): RequestResult<CreateAiProviderResponses, CreateAiProviderErrors, ThrowOnError>;
|
|
19392
19430
|
/**
|
|
@@ -19416,7 +19454,7 @@ declare class AiProviders {
|
|
|
19416
19454
|
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
19417
19455
|
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
19418
19456
|
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
19419
|
-
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret
|
|
19457
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret — IAM keys or a Bedrock API key, a Google service-account key. A record with no `secret_id` would fall back to the server's own credentials (the AWS default credential chain, Google Application Default Credentials); it can list only on a deployment that allows a record to use them, and returns `400 AI_PROVIDER_MISCONFIGURED` otherwise.
|
|
19420
19458
|
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: the publisher-model listing rejects API keys and needs a credential that asserts a principal, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
19421
19459
|
* The Vertex answer is the publisher catalogue the record's `config.location` region serves. The project behind the credential is billed and quota'd for the call but does not filter the result, so a listed model may still be unavailable to that project at generation time.
|
|
19422
19460
|
*
|
|
@@ -20563,7 +20601,9 @@ declare class Quotas {
|
|
|
20563
20601
|
/**
|
|
20564
20602
|
* Create a quota
|
|
20565
20603
|
*
|
|
20566
|
-
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor
|
|
20604
|
+
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`; `storage_bytes` is valid for `scope: project` only. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A `cost_usd` quota may name one `meter_type` to cap; omitting it caps every priced meter. A duplicate quota (same project, scope, scope_ref, metric, window, meter_type) is rejected with 409.
|
|
20605
|
+
*
|
|
20606
|
+
* `storage_bytes` caps a stored total rather than a windowed one, so it takes `window: current` and every other metric refuses that value (400 either way). It is enforced at the corpus write paths — file upload and create, document create, document ingest and re-ingest, memory-entry create — with `409 QUOTA_STORAGE_EXCEEDED` and no `Retry-After`, since no window reset clears a footprint.
|
|
20567
20607
|
*/
|
|
20568
20608
|
static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
|
|
20569
20609
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -3619,13 +3619,13 @@ type QuotaResourceProperties = {
|
|
|
3619
3619
|
/**
|
|
3620
3620
|
* The metric being capped
|
|
3621
3621
|
*/
|
|
3622
|
-
metric: 'requests' | 'tokens' | 'cost_usd';
|
|
3622
|
+
metric: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
3623
3623
|
/**
|
|
3624
|
-
* The window over which the metric is aggregated
|
|
3624
|
+
* The window over which the metric is aggregated. storage_bytes caps a stored total rather than a windowed one, so it takes current and refuses every other value; current is refused for every other metric.
|
|
3625
3625
|
*/
|
|
3626
|
-
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
|
|
3626
|
+
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
3627
3627
|
/**
|
|
3628
|
-
* The cap. Positive integer for requests/tokens; fractional allowed for cost_usd.
|
|
3628
|
+
* The cap. Positive integer for requests/tokens/storage_bytes (bytes); fractional allowed for cost_usd.
|
|
3629
3629
|
*/
|
|
3630
3630
|
limit: number;
|
|
3631
3631
|
/**
|
|
@@ -5501,8 +5501,11 @@ type Quota = {
|
|
|
5501
5501
|
* Public id of the api key / agent / actor the quota applies to. For `api_key` and `agent` scope, NULL means all entities of that scope type in the project. For `actor` scope, NULL means one budget *per* actor rather than a pooled total across all actors.
|
|
5502
5502
|
*/
|
|
5503
5503
|
scope_ref?: string | null;
|
|
5504
|
-
metric?: 'requests' | 'tokens' | 'cost_usd';
|
|
5505
|
-
|
|
5504
|
+
metric?: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
5505
|
+
/**
|
|
5506
|
+
* The window the metric is aggregated over; `current` on storage_bytes, which caps a stored total and never resets.
|
|
5507
|
+
*/
|
|
5508
|
+
window?: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
5506
5509
|
limit?: number;
|
|
5507
5510
|
mode?: 'enforce' | 'monitor';
|
|
5508
5511
|
/**
|
|
@@ -5514,7 +5517,7 @@ type Quota = {
|
|
|
5514
5517
|
*/
|
|
5515
5518
|
on_unpriced?: 'block' | 'allow' | null;
|
|
5516
5519
|
/**
|
|
5517
|
-
* Current fixed-window usage for the requests metric. Null for token/cost quotas (which aggregate the usage meter at check time rather than keeping a counter) and in list responses.
|
|
5520
|
+
* Current fixed-window usage for the requests metric. Null for token/cost quotas (which aggregate the usage meter at check time rather than keeping a counter), null for storage_bytes (a stored total has no window and no counter — read the footprint from the storage meter), and null in list responses.
|
|
5518
5521
|
*/
|
|
5519
5522
|
current_usage?: {
|
|
5520
5523
|
window_key?: string;
|
|
@@ -8330,7 +8333,7 @@ type CreateAiProviderData = {
|
|
|
8330
8333
|
*/
|
|
8331
8334
|
default_model: string;
|
|
8332
8335
|
/**
|
|
8333
|
-
* Secret ID containing API credentials
|
|
8336
|
+
* Secret ID containing API credentials. Required for `bedrock` and `vertex` unless `config.apiKey` carries one.
|
|
8334
8337
|
*/
|
|
8335
8338
|
secret_id?: string;
|
|
8336
8339
|
/**
|
|
@@ -10984,6 +10987,10 @@ type CreateDocumentErrors = {
|
|
|
10984
10987
|
* Forbidden
|
|
10985
10988
|
*/
|
|
10986
10989
|
403: ErrorResponse;
|
|
10990
|
+
/**
|
|
10991
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
10992
|
+
*/
|
|
10993
|
+
409: ErrorResponse;
|
|
10987
10994
|
};
|
|
10988
10995
|
type CreateDocumentError = CreateDocumentErrors[keyof CreateDocumentErrors];
|
|
10989
10996
|
type CreateDocumentResponses = {
|
|
@@ -11050,7 +11057,7 @@ type IngestDocumentErrors = {
|
|
|
11050
11057
|
*/
|
|
11051
11058
|
403: ErrorResponse;
|
|
11052
11059
|
/**
|
|
11053
|
-
* The file already backs a Document (a file can only be ingested once
|
|
11060
|
+
* The file already backs a Document (a file can only be ingested once — use `POST /documents/{document_id}/ingest` to re-process the existing document, or upload a new copy of the file to ingest it separately), or the project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total).
|
|
11054
11061
|
*/
|
|
11055
11062
|
409: ErrorResponse;
|
|
11056
11063
|
/**
|
|
@@ -11289,6 +11296,10 @@ type ReingestDocumentErrors = {
|
|
|
11289
11296
|
* Document not found
|
|
11290
11297
|
*/
|
|
11291
11298
|
404: ErrorResponse;
|
|
11299
|
+
/**
|
|
11300
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
11301
|
+
*/
|
|
11302
|
+
409: ErrorResponse;
|
|
11292
11303
|
/**
|
|
11293
11304
|
* The file is too large to re-ingest synchronously (`?wait=true`). Retry in background mode.
|
|
11294
11305
|
*/
|
|
@@ -11781,6 +11792,10 @@ type CreateDatasetItemErrors = {
|
|
|
11781
11792
|
* Dataset not found
|
|
11782
11793
|
*/
|
|
11783
11794
|
404: unknown;
|
|
11795
|
+
/**
|
|
11796
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). A fixture is a corpus write like a document, so it is bounded by the same cap; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total.
|
|
11797
|
+
*/
|
|
11798
|
+
409: unknown;
|
|
11784
11799
|
};
|
|
11785
11800
|
type CreateDatasetItemResponses = {
|
|
11786
11801
|
/**
|
|
@@ -11837,7 +11852,7 @@ type CreateDatasetItemFromGenerationErrors = {
|
|
|
11837
11852
|
*/
|
|
11838
11853
|
404: unknown;
|
|
11839
11854
|
/**
|
|
11840
|
-
* The generation has not completed,
|
|
11855
|
+
* The generation has not completed, its content was never stored or has been purged, or the project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`; delete stored content or raise the quota — no `Retry-After` is sent, since no window reset clears a stored total)
|
|
11841
11856
|
*/
|
|
11842
11857
|
409: unknown;
|
|
11843
11858
|
};
|
|
@@ -12682,6 +12697,10 @@ type CreateFileData = {
|
|
|
12682
12697
|
url: '/v1/projects/{project_id}/files';
|
|
12683
12698
|
};
|
|
12684
12699
|
type CreateFileErrors = {
|
|
12700
|
+
/**
|
|
12701
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12702
|
+
*/
|
|
12703
|
+
409: ErrorResponse;
|
|
12685
12704
|
/**
|
|
12686
12705
|
* Internal server error
|
|
12687
12706
|
*/
|
|
@@ -12741,6 +12760,10 @@ type UploadFileErrors = {
|
|
|
12741
12760
|
*
|
|
12742
12761
|
*/
|
|
12743
12762
|
403: ErrorResponse;
|
|
12763
|
+
/**
|
|
12764
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12765
|
+
*/
|
|
12766
|
+
409: ErrorResponse;
|
|
12744
12767
|
};
|
|
12745
12768
|
type UploadFileError = UploadFileErrors[keyof UploadFileErrors];
|
|
12746
12769
|
type UploadFileResponses = {
|
|
@@ -12775,6 +12798,10 @@ type UploadFileBase64Errors = {
|
|
|
12775
12798
|
*
|
|
12776
12799
|
*/
|
|
12777
12800
|
403: ErrorResponse;
|
|
12801
|
+
/**
|
|
12802
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
12803
|
+
*/
|
|
12804
|
+
409: ErrorResponse;
|
|
12778
12805
|
};
|
|
12779
12806
|
type UploadFileBase64Error = UploadFileBase64Errors[keyof UploadFileBase64Errors];
|
|
12780
12807
|
type UploadFileBase64Responses = {
|
|
@@ -14723,6 +14750,10 @@ type CreateMemoryEntryErrors = {
|
|
|
14723
14750
|
* Memory not found
|
|
14724
14751
|
*/
|
|
14725
14752
|
404: unknown;
|
|
14753
|
+
/**
|
|
14754
|
+
* The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
|
|
14755
|
+
*/
|
|
14756
|
+
409: unknown;
|
|
14726
14757
|
/**
|
|
14727
14758
|
* Internal server error
|
|
14728
14759
|
*/
|
|
@@ -16183,13 +16214,13 @@ type CreateQuotaData = {
|
|
|
16183
16214
|
/**
|
|
16184
16215
|
* The metric being capped
|
|
16185
16216
|
*/
|
|
16186
|
-
metric: 'requests' | 'tokens' | 'cost_usd';
|
|
16217
|
+
metric: 'requests' | 'tokens' | 'cost_usd' | 'storage_bytes';
|
|
16187
16218
|
/**
|
|
16188
|
-
* The window over which the metric is aggregated
|
|
16219
|
+
* The window over which the metric is aggregated. `current` is the only accepted value for storage_bytes (a stored total is not aggregated over time) and is refused for every other metric.
|
|
16189
16220
|
*/
|
|
16190
|
-
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
|
|
16221
|
+
window: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month' | 'current';
|
|
16191
16222
|
/**
|
|
16192
|
-
* The cap. Must be a positive integer for requests/tokens; fractional values are allowed for cost_usd.
|
|
16223
|
+
* The cap. Must be a positive integer for requests/tokens/storage_bytes (bytes); fractional values are allowed for cost_usd.
|
|
16193
16224
|
*/
|
|
16194
16225
|
limit: number;
|
|
16195
16226
|
/**
|
|
@@ -19386,7 +19417,14 @@ declare class AiProviders {
|
|
|
19386
19417
|
/**
|
|
19387
19418
|
* Create an AI provider
|
|
19388
19419
|
*
|
|
19389
|
-
* Creates a new LLM provider configuration
|
|
19420
|
+
* Creates a new LLM provider configuration.
|
|
19421
|
+
*
|
|
19422
|
+
* A `bedrock` or `vertex` record must carry a credential of its own — a
|
|
19423
|
+
* linked `secret_id`, or an `apiKey` in `config`. Without one the provider
|
|
19424
|
+
* SDK signs with the server's own credentials (the AWS default credential
|
|
19425
|
+
* chain, Google Application Default Credentials), which is refused with
|
|
19426
|
+
* `400 VALIDATION_FAILED` unless the deployment allows it.
|
|
19427
|
+
*
|
|
19390
19428
|
*/
|
|
19391
19429
|
static createAiProvider<ThrowOnError extends boolean = false>(options: Options<CreateAiProviderData, ThrowOnError>): RequestResult<CreateAiProviderResponses, CreateAiProviderErrors, ThrowOnError>;
|
|
19392
19430
|
/**
|
|
@@ -19416,7 +19454,7 @@ declare class AiProviders {
|
|
|
19416
19454
|
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
19417
19455
|
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
19418
19456
|
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
19419
|
-
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret
|
|
19457
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret — IAM keys or a Bedrock API key, a Google service-account key. A record with no `secret_id` would fall back to the server's own credentials (the AWS default credential chain, Google Application Default Credentials); it can list only on a deployment that allows a record to use them, and returns `400 AI_PROVIDER_MISCONFIGURED` otherwise.
|
|
19420
19458
|
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: the publisher-model listing rejects API keys and needs a credential that asserts a principal, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
19421
19459
|
* The Vertex answer is the publisher catalogue the record's `config.location` region serves. The project behind the credential is billed and quota'd for the call but does not filter the result, so a listed model may still be unavailable to that project at generation time.
|
|
19422
19460
|
*
|
|
@@ -20563,7 +20601,9 @@ declare class Quotas {
|
|
|
20563
20601
|
/**
|
|
20564
20602
|
* Create a quota
|
|
20565
20603
|
*
|
|
20566
|
-
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor
|
|
20604
|
+
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`; `storage_bytes` is valid for `scope: project` only. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A `cost_usd` quota may name one `meter_type` to cap; omitting it caps every priced meter. A duplicate quota (same project, scope, scope_ref, metric, window, meter_type) is rejected with 409.
|
|
20605
|
+
*
|
|
20606
|
+
* `storage_bytes` caps a stored total rather than a windowed one, so it takes `window: current` and every other metric refuses that value (400 either way). It is enforced at the corpus write paths — file upload and create, document create, document ingest and re-ingest, memory-entry create — with `409 QUOTA_STORAGE_EXCEEDED` and no `Retry-After`, since no window reset clears a footprint.
|
|
20567
20607
|
*/
|
|
20568
20608
|
static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
|
|
20569
20609
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1318,7 +1318,14 @@ var AiProviders = class {
|
|
|
1318
1318
|
/**
|
|
1319
1319
|
* Create an AI provider
|
|
1320
1320
|
*
|
|
1321
|
-
* Creates a new LLM provider configuration
|
|
1321
|
+
* Creates a new LLM provider configuration.
|
|
1322
|
+
*
|
|
1323
|
+
* A `bedrock` or `vertex` record must carry a credential of its own — a
|
|
1324
|
+
* linked `secret_id`, or an `apiKey` in `config`. Without one the provider
|
|
1325
|
+
* SDK signs with the server's own credentials (the AWS default credential
|
|
1326
|
+
* chain, Google Application Default Credentials), which is refused with
|
|
1327
|
+
* `400 VALIDATION_FAILED` unless the deployment allows it.
|
|
1328
|
+
*
|
|
1322
1329
|
*/
|
|
1323
1330
|
static createAiProvider(options) {
|
|
1324
1331
|
return (options.client ?? client).post({
|
|
@@ -1376,7 +1383,7 @@ var AiProviders = class {
|
|
|
1376
1383
|
* Asks the provider which models it can run, using this provider record's own credentials and configuration, and returns provider-native model ids — the same strings `default_model` and an agent's `model` carry.
|
|
1377
1384
|
* Which models are reachable is a property of the credential, not of the provider type: a Vertex provider sees only the publisher models its Google Cloud project and location serve, and a Bedrock provider only the foundation models enabled in its region. Reading the list is how a caller avoids pinning a model that fails at generation time.
|
|
1378
1385
|
* Not every provider type can answer. `azure` lists deployments an operator named rather than models, and `ollama` lists whatever was pulled onto that host, so both return `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1379
|
-
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret
|
|
1386
|
+
* Listing resolves credentials the same way generation does, so a record that can generate can list. The API-key types (`openai`, `groq`, `xai`, `gateway`, `custom`, `anthropic`, `google`) use the record's linked secret and cannot list without one. `bedrock` and `vertex` use the linked secret — IAM keys or a Bedrock API key, a Google service-account key. A record with no `secret_id` would fall back to the server's own credentials (the AWS default credential chain, Google Application Default Credentials); it can list only on a deployment that allows a record to use them, and returns `400 AI_PROVIDER_MISCONFIGURED` otherwise.
|
|
1380
1387
|
* A Vertex record needs no `config.project` when its secret is a service-account key, since the key file names its own project. A Vertex record in express mode (API key) cannot list at all: the publisher-model listing rejects API keys and needs a credential that asserts a principal, so it returns `400 MODEL_LISTING_UNSUPPORTED`.
|
|
1381
1388
|
* The Vertex answer is the publisher catalogue the record's `config.location` region serves. The project behind the credential is billed and quota'd for the call but does not filter the result, so a listed model may still be unavailable to that project at generation time.
|
|
1382
1389
|
*
|
|
@@ -3573,7 +3580,9 @@ var Quotas = class {
|
|
|
3573
3580
|
/**
|
|
3574
3581
|
* Create a quota
|
|
3575
3582
|
*
|
|
3576
|
-
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor
|
|
3583
|
+
* Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`; `storage_bytes` is valid for `scope: project` only. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A `cost_usd` quota may name one `meter_type` to cap; omitting it caps every priced meter. A duplicate quota (same project, scope, scope_ref, metric, window, meter_type) is rejected with 409.
|
|
3584
|
+
*
|
|
3585
|
+
* `storage_bytes` caps a stored total rather than a windowed one, so it takes `window: current` and every other metric refuses that value (400 either way). It is enforced at the corpus write paths — file upload and create, document create, document ingest and re-ingest, memory-entry create — with `409 QUOTA_STORAGE_EXCEEDED` and no `Retry-After`, since no window reset clears a footprint.
|
|
3577
3586
|
*/
|
|
3578
3587
|
static createQuota(options) {
|
|
3579
3588
|
return (options.client ?? client).post({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturali/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.118.0",
|
|
4
4
|
"description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsx": "^4.23.1",
|
|
38
38
|
"typescript": "~6.0.3",
|
|
39
39
|
"vitest": "^4.1.10",
|
|
40
|
-
"@naturali/api": "0.
|
|
40
|
+
"@naturali/api": "0.118.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"generate": "tsx scripts/generate.ts",
|