@naturali/cli 0.41.0 → 0.42.1
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.mjs +356 -6
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region package.json
|
|
17
|
-
var version = "0.
|
|
17
|
+
var version = "0.42.1";
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region ../sdk/src/generated/core/bodySerializer.gen.ts
|
|
20
20
|
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
@@ -1361,7 +1361,11 @@ var Knowledge = class {
|
|
|
1361
1361
|
/**
|
|
1362
1362
|
* Create a document
|
|
1363
1363
|
*
|
|
1364
|
-
* Add
|
|
1364
|
+
* Add a document to the collection, from **inline text** (`content`) or from an **uploaded file** (`file`, base64, plus `content_type` and `filename`) — exactly one of the two.
|
|
1365
|
+
*
|
|
1366
|
+
* `application/pdf`, `text/plain` and `text/markdown` are extracted natively. Any other media type needs a converter (`POST /v1/projects/{project_id}/knowledge/converters`) registered for it in the project; without one the request is rejected with `unsupported_content_type` and no document is created.
|
|
1367
|
+
*
|
|
1368
|
+
* Ingestion (extract → chunk → embed) runs in the background: the document comes back `pending` and becomes `indexed` or `failed`, which is announced by the `knowledge.document_ingested` / `knowledge.ingest_failed` webhook events.
|
|
1365
1369
|
*
|
|
1366
1370
|
*/
|
|
1367
1371
|
static createKnowledgeDocument(options) {
|
|
@@ -1406,6 +1410,86 @@ var Knowledge = class {
|
|
|
1406
1410
|
...options
|
|
1407
1411
|
});
|
|
1408
1412
|
}
|
|
1413
|
+
/**
|
|
1414
|
+
* List converters
|
|
1415
|
+
*
|
|
1416
|
+
* Lists the media converters registered in the project.
|
|
1417
|
+
*/
|
|
1418
|
+
static listKnowledgeConverters(options) {
|
|
1419
|
+
return (options.client ?? client).get({
|
|
1420
|
+
url: "/v1/projects/{project_id}/knowledge/converters",
|
|
1421
|
+
...options
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Create a converter
|
|
1426
|
+
*
|
|
1427
|
+
* Register a converter for a media type the platform cannot extract natively, so files of that type become ingestable documents like any other. A converter maps a `content_type` glob (`image*`, `audio/mpeg`, …) onto one of two workers:
|
|
1428
|
+
*
|
|
1429
|
+
* - an **agent** (`agent_id`) — the file is handed to a
|
|
1430
|
+
* multimodal model with a fixed "extract all the text" instruction and
|
|
1431
|
+
* its answer becomes the document text. The shortest path for images
|
|
1432
|
+
* and scanned PDFs; nothing to map.
|
|
1433
|
+
*
|
|
1434
|
+
* - a **tool** (`tool_id`) — the file is passed to an
|
|
1435
|
+
* `http` tool as `{ content_type, filename, data_base64 }`, and
|
|
1436
|
+
* whatever string the tool returns becomes the document text. The path
|
|
1437
|
+
* for dedicated non-chat APIs (speech-to-text, a specialist OCR
|
|
1438
|
+
* engine); use the tool's `execute.body_mode: multipart` for
|
|
1439
|
+
* form-data endpoints and its `output_mapping` to reduce a JSON
|
|
1440
|
+
* response to the bare string.
|
|
1441
|
+
*
|
|
1442
|
+
*
|
|
1443
|
+
* Exactly one of `agent_id` / `tool_id`, and one converter per `content_type` in a project.
|
|
1444
|
+
*
|
|
1445
|
+
*/
|
|
1446
|
+
static createKnowledgeConverter(options) {
|
|
1447
|
+
return (options.client ?? client).post({
|
|
1448
|
+
url: "/v1/projects/{project_id}/knowledge/converters",
|
|
1449
|
+
...options,
|
|
1450
|
+
headers: {
|
|
1451
|
+
"Content-Type": "application/json",
|
|
1452
|
+
...options.headers
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Delete a converter
|
|
1458
|
+
*
|
|
1459
|
+
* Removes the converter. Documents already ingested through it are untouched; new files of that media type stop being ingestable until another converter covers them.
|
|
1460
|
+
*
|
|
1461
|
+
*/
|
|
1462
|
+
static deleteKnowledgeConverter(options) {
|
|
1463
|
+
return (options.client ?? client).delete({
|
|
1464
|
+
url: "/v1/projects/{project_id}/knowledge/converters/{converter_id}",
|
|
1465
|
+
...options
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Get a converter
|
|
1470
|
+
*/
|
|
1471
|
+
static getKnowledgeConverter(options) {
|
|
1472
|
+
return (options.client ?? client).get({
|
|
1473
|
+
url: "/v1/projects/{project_id}/knowledge/converters/{converter_id}",
|
|
1474
|
+
...options
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Update a converter
|
|
1479
|
+
*
|
|
1480
|
+
* Change the worker or the chunking defaults. At least one field is required; `agent_id` and `tool_id` stay mutually exclusive, so setting one clears the other.
|
|
1481
|
+
*
|
|
1482
|
+
*/
|
|
1483
|
+
static updateKnowledgeConverter(options) {
|
|
1484
|
+
return (options.client ?? client).patch({
|
|
1485
|
+
url: "/v1/projects/{project_id}/knowledge/converters/{converter_id}",
|
|
1486
|
+
...options,
|
|
1487
|
+
headers: {
|
|
1488
|
+
"Content-Type": "application/json",
|
|
1489
|
+
...options.headers
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1409
1493
|
};
|
|
1410
1494
|
var Models = class {
|
|
1411
1495
|
/**
|
|
@@ -4389,7 +4473,7 @@ const routes = {
|
|
|
4389
4473
|
"create-knowledge-document": {
|
|
4390
4474
|
serviceClass: "Knowledge",
|
|
4391
4475
|
operationId: "createKnowledgeDocument",
|
|
4392
|
-
description: "Add
|
|
4476
|
+
description: "Add a document to the collection, from **inline text** (`content`) or from an **uploaded file** (`file`, base64, plus `content_type` and `filename`) — exactly one of the two. `application/pdf`, `text/plain` and `text/markdown` are extracted natively. Any other media type needs a converter (`POST /v1/projects/{project_id}/knowledge/converters`) registered for it in the project; without one the request is rejected with `unsupported_content_type` and no document is created. Ingestion (extract → chunk → embed) runs in the background: the document comes back `pending` and becomes `indexed` or `failed`, which is announced by the `knowledge.document_ingested` / `knowledge.ingest_failed` webhook events.",
|
|
4393
4477
|
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4394
4478
|
httpMethod: "post",
|
|
4395
4479
|
pathParams: ["project_id", "collection_id"],
|
|
@@ -4411,14 +4495,28 @@ const routes = {
|
|
|
4411
4495
|
},
|
|
4412
4496
|
{
|
|
4413
4497
|
"name": "content",
|
|
4414
|
-
"description": "The document's text content.",
|
|
4415
|
-
"required":
|
|
4498
|
+
"description": "The document's text content. Mutually exclusive with `file`.",
|
|
4499
|
+
"required": false,
|
|
4500
|
+
"type": "string",
|
|
4501
|
+
"in": "body"
|
|
4502
|
+
},
|
|
4503
|
+
{
|
|
4504
|
+
"name": "file",
|
|
4505
|
+
"description": "The file's bytes, base64-encoded. Mutually exclusive with `content`.\n",
|
|
4506
|
+
"required": false,
|
|
4507
|
+
"type": "string",
|
|
4508
|
+
"in": "body"
|
|
4509
|
+
},
|
|
4510
|
+
{
|
|
4511
|
+
"name": "content_type",
|
|
4512
|
+
"description": "Media type of `file`. `application/pdf`, `text/plain` and `text/markdown` are extracted natively; anything else needs a matching converter in the project. Required with `file`.\n",
|
|
4513
|
+
"required": false,
|
|
4416
4514
|
"type": "string",
|
|
4417
4515
|
"in": "body"
|
|
4418
4516
|
},
|
|
4419
4517
|
{
|
|
4420
4518
|
"name": "filename",
|
|
4421
|
-
"description": "A label for the document; also its logical filename.",
|
|
4519
|
+
"description": "A label for the document; also its logical filename. Required with `file`.\n",
|
|
4422
4520
|
"required": false,
|
|
4423
4521
|
"type": "string",
|
|
4424
4522
|
"in": "body"
|
|
@@ -4429,6 +4527,27 @@ const routes = {
|
|
|
4429
4527
|
"required": false,
|
|
4430
4528
|
"type": "string",
|
|
4431
4529
|
"in": "body"
|
|
4530
|
+
},
|
|
4531
|
+
{
|
|
4532
|
+
"name": "chunk_strategy",
|
|
4533
|
+
"description": "How the extracted text is split for embedding. `page` (the default) makes one chunk per page, which is what lets a retrieved chunk cite a page number; `size` makes fixed-width character windows, which retrieves more sharply on dense pages at the cost of that citation; `whole` keeps the document as a single chunk. Ignored for inline text.\n",
|
|
4534
|
+
"required": false,
|
|
4535
|
+
"type": "string",
|
|
4536
|
+
"in": "body"
|
|
4537
|
+
},
|
|
4538
|
+
{
|
|
4539
|
+
"name": "chunk_size",
|
|
4540
|
+
"description": "Window width in characters, when `chunk_strategy` is `size`.",
|
|
4541
|
+
"required": false,
|
|
4542
|
+
"type": "integer",
|
|
4543
|
+
"in": "body"
|
|
4544
|
+
},
|
|
4545
|
+
{
|
|
4546
|
+
"name": "chunk_overlap",
|
|
4547
|
+
"description": "Characters of overlap between consecutive windows, when `chunk_strategy` is `size`. Must be smaller than `chunk_size`.\n",
|
|
4548
|
+
"required": false,
|
|
4549
|
+
"type": "integer",
|
|
4550
|
+
"in": "body"
|
|
4432
4551
|
}
|
|
4433
4552
|
]
|
|
4434
4553
|
},
|
|
@@ -4540,6 +4659,237 @@ const routes = {
|
|
|
4540
4659
|
}
|
|
4541
4660
|
]
|
|
4542
4661
|
},
|
|
4662
|
+
"list-knowledge-converters": {
|
|
4663
|
+
serviceClass: "Knowledge",
|
|
4664
|
+
operationId: "listKnowledgeConverters",
|
|
4665
|
+
description: "Lists the media converters registered in the project.",
|
|
4666
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4667
|
+
httpMethod: "get",
|
|
4668
|
+
pathParams: ["project_id"],
|
|
4669
|
+
queryParams: ["limit", "cursor"],
|
|
4670
|
+
flags: [
|
|
4671
|
+
{
|
|
4672
|
+
"name": "project_id",
|
|
4673
|
+
"description": "Project public ID (proj_ prefix).",
|
|
4674
|
+
"required": true,
|
|
4675
|
+
"type": "string",
|
|
4676
|
+
"in": "path"
|
|
4677
|
+
},
|
|
4678
|
+
{
|
|
4679
|
+
"name": "limit",
|
|
4680
|
+
"description": "Maximum items per page.",
|
|
4681
|
+
"required": false,
|
|
4682
|
+
"type": "integer",
|
|
4683
|
+
"in": "query"
|
|
4684
|
+
},
|
|
4685
|
+
{
|
|
4686
|
+
"name": "cursor",
|
|
4687
|
+
"description": "Opaque pagination cursor from a previous response's next_cursor.",
|
|
4688
|
+
"required": false,
|
|
4689
|
+
"type": "string",
|
|
4690
|
+
"in": "query"
|
|
4691
|
+
}
|
|
4692
|
+
]
|
|
4693
|
+
},
|
|
4694
|
+
"create-knowledge-converter": {
|
|
4695
|
+
serviceClass: "Knowledge",
|
|
4696
|
+
operationId: "createKnowledgeConverter",
|
|
4697
|
+
description: "Register a converter for a media type the platform cannot extract natively, so files of that type become ingestable documents like any other. A converter maps a `content_type` glob (`image/*`, `audio/mpeg`, …) onto one of two workers: - an **agent** (`agent_id`) — the file is handed to a multimodal model with a fixed \"extract all the text\" instruction and its answer becomes the document text. The shortest path for images and scanned PDFs; nothing to map. - a **tool** (`tool_id`) — the file is passed to an `http` tool as `{ content_type, filename, data_base64 }`, and whatever string the tool returns becomes the document text. The path for dedicated non-chat APIs (speech-to-text, a specialist OCR engine); use the tool's `execute.body_mode: multipart` for form-data endpoints and its `output_mapping` to reduce a JSON response to the bare string. Exactly one of `agent_id` / `tool_id`, and one converter per `content_type` in a project.",
|
|
4698
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4699
|
+
httpMethod: "post",
|
|
4700
|
+
pathParams: ["project_id"],
|
|
4701
|
+
queryParams: [],
|
|
4702
|
+
flags: [
|
|
4703
|
+
{
|
|
4704
|
+
"name": "project_id",
|
|
4705
|
+
"description": "Project public ID (proj_ prefix).",
|
|
4706
|
+
"required": true,
|
|
4707
|
+
"type": "string",
|
|
4708
|
+
"in": "path"
|
|
4709
|
+
},
|
|
4710
|
+
{
|
|
4711
|
+
"name": "content_type",
|
|
4712
|
+
"description": "The media-type glob to claim — an exact type (`audio/mpeg`) or a `*` wildcard on the subtype (`image/*`).\n",
|
|
4713
|
+
"required": true,
|
|
4714
|
+
"type": "string",
|
|
4715
|
+
"in": "body"
|
|
4716
|
+
},
|
|
4717
|
+
{
|
|
4718
|
+
"name": "agent_id",
|
|
4719
|
+
"description": "An agent in this project, used as the converter.",
|
|
4720
|
+
"required": false,
|
|
4721
|
+
"type": "string",
|
|
4722
|
+
"in": "body"
|
|
4723
|
+
},
|
|
4724
|
+
{
|
|
4725
|
+
"name": "tool_id",
|
|
4726
|
+
"description": "An `http` tool in this project, used as the converter.",
|
|
4727
|
+
"required": false,
|
|
4728
|
+
"type": "string",
|
|
4729
|
+
"in": "body"
|
|
4730
|
+
},
|
|
4731
|
+
{
|
|
4732
|
+
"name": "preset_parameters",
|
|
4733
|
+
"description": "Fixed arguments merged into every tool-converter call.",
|
|
4734
|
+
"required": false,
|
|
4735
|
+
"type": "object",
|
|
4736
|
+
"in": "body"
|
|
4737
|
+
},
|
|
4738
|
+
{
|
|
4739
|
+
"name": "native_extraction",
|
|
4740
|
+
"description": "",
|
|
4741
|
+
"required": false,
|
|
4742
|
+
"type": "string",
|
|
4743
|
+
"in": "body"
|
|
4744
|
+
},
|
|
4745
|
+
{
|
|
4746
|
+
"name": "chunk_strategy",
|
|
4747
|
+
"description": "",
|
|
4748
|
+
"required": false,
|
|
4749
|
+
"type": "string",
|
|
4750
|
+
"in": "body"
|
|
4751
|
+
},
|
|
4752
|
+
{
|
|
4753
|
+
"name": "chunk_size",
|
|
4754
|
+
"description": "",
|
|
4755
|
+
"required": false,
|
|
4756
|
+
"type": "integer",
|
|
4757
|
+
"in": "body"
|
|
4758
|
+
},
|
|
4759
|
+
{
|
|
4760
|
+
"name": "chunk_overlap",
|
|
4761
|
+
"description": "",
|
|
4762
|
+
"required": false,
|
|
4763
|
+
"type": "integer",
|
|
4764
|
+
"in": "body"
|
|
4765
|
+
}
|
|
4766
|
+
]
|
|
4767
|
+
},
|
|
4768
|
+
"get-knowledge-converter": {
|
|
4769
|
+
serviceClass: "Knowledge",
|
|
4770
|
+
operationId: "getKnowledgeConverter",
|
|
4771
|
+
description: "Get a converter",
|
|
4772
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4773
|
+
httpMethod: "get",
|
|
4774
|
+
pathParams: ["project_id", "converter_id"],
|
|
4775
|
+
queryParams: [],
|
|
4776
|
+
flags: [{
|
|
4777
|
+
"name": "project_id",
|
|
4778
|
+
"description": "Project public ID (proj_ prefix).",
|
|
4779
|
+
"required": true,
|
|
4780
|
+
"type": "string",
|
|
4781
|
+
"in": "path"
|
|
4782
|
+
}, {
|
|
4783
|
+
"name": "converter_id",
|
|
4784
|
+
"description": "Knowledge converter public ID (igr_ prefix).",
|
|
4785
|
+
"required": true,
|
|
4786
|
+
"type": "string",
|
|
4787
|
+
"in": "path"
|
|
4788
|
+
}]
|
|
4789
|
+
},
|
|
4790
|
+
"update-knowledge-converter": {
|
|
4791
|
+
serviceClass: "Knowledge",
|
|
4792
|
+
operationId: "updateKnowledgeConverter",
|
|
4793
|
+
description: "Change the worker or the chunking defaults. At least one field is required; `agent_id` and `tool_id` stay mutually exclusive, so setting one clears the other.",
|
|
4794
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4795
|
+
httpMethod: "patch",
|
|
4796
|
+
pathParams: ["project_id", "converter_id"],
|
|
4797
|
+
queryParams: [],
|
|
4798
|
+
flags: [
|
|
4799
|
+
{
|
|
4800
|
+
"name": "project_id",
|
|
4801
|
+
"description": "Project public ID (proj_ prefix).",
|
|
4802
|
+
"required": true,
|
|
4803
|
+
"type": "string",
|
|
4804
|
+
"in": "path"
|
|
4805
|
+
},
|
|
4806
|
+
{
|
|
4807
|
+
"name": "converter_id",
|
|
4808
|
+
"description": "Knowledge converter public ID (igr_ prefix).",
|
|
4809
|
+
"required": true,
|
|
4810
|
+
"type": "string",
|
|
4811
|
+
"in": "path"
|
|
4812
|
+
},
|
|
4813
|
+
{
|
|
4814
|
+
"name": "content_type",
|
|
4815
|
+
"description": "",
|
|
4816
|
+
"required": false,
|
|
4817
|
+
"type": "string",
|
|
4818
|
+
"in": "body"
|
|
4819
|
+
},
|
|
4820
|
+
{
|
|
4821
|
+
"name": "agent_id",
|
|
4822
|
+
"description": "Switches the converter to this agent, clearing `tool_id`.",
|
|
4823
|
+
"required": false,
|
|
4824
|
+
"type": "string",
|
|
4825
|
+
"in": "body"
|
|
4826
|
+
},
|
|
4827
|
+
{
|
|
4828
|
+
"name": "tool_id",
|
|
4829
|
+
"description": "Switches the converter to this tool, clearing `agent_id`.",
|
|
4830
|
+
"required": false,
|
|
4831
|
+
"type": "string",
|
|
4832
|
+
"in": "body"
|
|
4833
|
+
},
|
|
4834
|
+
{
|
|
4835
|
+
"name": "preset_parameters",
|
|
4836
|
+
"description": "",
|
|
4837
|
+
"required": false,
|
|
4838
|
+
"type": "object",
|
|
4839
|
+
"in": "body"
|
|
4840
|
+
},
|
|
4841
|
+
{
|
|
4842
|
+
"name": "native_extraction",
|
|
4843
|
+
"description": "",
|
|
4844
|
+
"required": false,
|
|
4845
|
+
"type": "string",
|
|
4846
|
+
"in": "body"
|
|
4847
|
+
},
|
|
4848
|
+
{
|
|
4849
|
+
"name": "chunk_strategy",
|
|
4850
|
+
"description": "",
|
|
4851
|
+
"required": false,
|
|
4852
|
+
"type": "string",
|
|
4853
|
+
"in": "body"
|
|
4854
|
+
},
|
|
4855
|
+
{
|
|
4856
|
+
"name": "chunk_size",
|
|
4857
|
+
"description": "",
|
|
4858
|
+
"required": false,
|
|
4859
|
+
"type": "integer",
|
|
4860
|
+
"in": "body"
|
|
4861
|
+
},
|
|
4862
|
+
{
|
|
4863
|
+
"name": "chunk_overlap",
|
|
4864
|
+
"description": "",
|
|
4865
|
+
"required": false,
|
|
4866
|
+
"type": "integer",
|
|
4867
|
+
"in": "body"
|
|
4868
|
+
}
|
|
4869
|
+
]
|
|
4870
|
+
},
|
|
4871
|
+
"delete-knowledge-converter": {
|
|
4872
|
+
serviceClass: "Knowledge",
|
|
4873
|
+
operationId: "deleteKnowledgeConverter",
|
|
4874
|
+
description: "Removes the converter. Documents already ingested through it are untouched; new files of that media type stop being ingestable until another converter covers them.",
|
|
4875
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/knowledge",
|
|
4876
|
+
httpMethod: "delete",
|
|
4877
|
+
pathParams: ["project_id", "converter_id"],
|
|
4878
|
+
queryParams: [],
|
|
4879
|
+
flags: [{
|
|
4880
|
+
"name": "project_id",
|
|
4881
|
+
"description": "Project public ID (proj_ prefix).",
|
|
4882
|
+
"required": true,
|
|
4883
|
+
"type": "string",
|
|
4884
|
+
"in": "path"
|
|
4885
|
+
}, {
|
|
4886
|
+
"name": "converter_id",
|
|
4887
|
+
"description": "Knowledge converter public ID (igr_ prefix).",
|
|
4888
|
+
"required": true,
|
|
4889
|
+
"type": "string",
|
|
4890
|
+
"in": "path"
|
|
4891
|
+
}]
|
|
4892
|
+
},
|
|
4543
4893
|
"list-models": {
|
|
4544
4894
|
serviceClass: "Models",
|
|
4545
4895
|
operationId: "listModels",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturali/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tsx": "^4.23.1",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
32
|
"vitest": "^4.1.10",
|
|
33
|
-
"@naturali/sdk": "0.
|
|
33
|
+
"@naturali/sdk": "0.42.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"generate": "tsx scripts/generate.ts",
|