nace-cli 0.1.0__py3-none-any.whl
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.
- nace_cli/__init__.py +9 -0
- nace_cli/_cli.py +151 -0
- nace_cli/_decide.py +147 -0
- nace_cli/_docops.py +414 -0
- nace_cli/_entrypoint.py +24 -0
- nace_cli/_inputs.py +94 -0
- nace_cli/_jobs.py +292 -0
- nace_cli/_login.py +77 -0
- nace_cli/_output.py +169 -0
- nace_cli/_schemas.py +135 -0
- nace_cli/py.typed +0 -0
- nace_cli-0.1.0.dist-info/METADATA +124 -0
- nace_cli-0.1.0.dist-info/RECORD +16 -0
- nace_cli-0.1.0.dist-info/WHEEL +4 -0
- nace_cli-0.1.0.dist-info/entry_points.txt +3 -0
- nace_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nace-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nace CLI: calibrated decisions and document jobs from the shell
|
|
5
|
+
Keywords: drex,nace,cli,document-intelligence
|
|
6
|
+
Author: Nace AI
|
|
7
|
+
Author-email: Nace AI <engineering@nace.ai>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Dist: nace-sdk>=0.1,<1
|
|
20
|
+
Requires-Dist: truststore>=0.10.4,<1
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Project-URL: Homepage, https://console.nace.ai
|
|
23
|
+
Project-URL: Documentation, https://console.nace.ai/docs/developer-tools/cli
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# nace-cli
|
|
27
|
+
|
|
28
|
+
`nace` — the [Drex API](https://console.nace.ai/docs) from the shell: calibrated decisions and document jobs.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pipx install nace-cli # or: uv tool install nace-cli
|
|
32
|
+
nace login # paste a key from https://console.nace.ai/dashboard/api-keys
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`nace login` checks the key against Drex before saving it to `~/.nace/config.toml` (mode 0600). `$NACE_API_KEY` and `$NACE_BASE_URL` override the file; `--api-key -` reads the key from stdin for scripts. `nace --version` (or `nace version`) prints the CLI and SDK versions, and `NACE_LOG_LEVEL=debug` logs each request to stderr.
|
|
36
|
+
|
|
37
|
+
## Decisions
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nace decide --state "I was charged twice for my March invoice." \
|
|
41
|
+
--noul "wants_refund=Is the customer asking for a refund?" \
|
|
42
|
+
--choice "topic=billing,shipping,other: Which topic is it?" \
|
|
43
|
+
--score "urgency=low,medium,high: How urgent is it?"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
wants_refund noul 0.930
|
|
48
|
+
topic choice billing (confidence 0.880)
|
|
49
|
+
urgency score 1.400 on low < medium < high (confidence 0.500)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`--state` takes text, `@file` or `-` (stdin); a JSON object or array is sent as JSON. Richer questions go in `--questions questions.json`, or a whole request in `--body`. `nace models` lists the models; `-m` picks one. `--json` prints the response body, `request_id` included.
|
|
53
|
+
|
|
54
|
+
## Documents
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
nace parse https://example.com/invoice.pdf > invoice.md
|
|
58
|
+
nace parse ./invoice.pdf --format markdown,text -p 1-3 --mode high
|
|
59
|
+
nace parse ./locked.pdf --password - # reads the PDF password from stdin, hidden at a terminal
|
|
60
|
+
nace extract ./invoice.pdf --schema invoice.schema.json
|
|
61
|
+
nace extract job:<parse job id> --schema-id sch_... --schema-version 2
|
|
62
|
+
nace classify ./scan.pdf --class invoice:Invoice --class receipt:Receipt --granularity page
|
|
63
|
+
nace split ./batch.pdf --classes classes.json
|
|
64
|
+
nace ground ./invoice.pdf --target "total=Total due" --target "Net 30"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A `SOURCE` is one of:
|
|
68
|
+
|
|
69
|
+
- an `https://` URL. The document service picks the parser from the file name's extension, taken from the URL's last path segment; when the link doesn't end in one, name it with `--file-name invoice.pdf`;
|
|
70
|
+
- a local file, uploaded into your workspace first at its file name (`--upload-path` picks another path). The same bytes again reuse the file there; an edited file fails with `path_conflict`: pass another `--upload-path`, or `--on-conflict new_version` to add a version (jobs on that file not yet started then read the new version);
|
|
71
|
+
- `ws:<workspace_id>/<file_id>`, what `nace upload` prints;
|
|
72
|
+
- `job:<parse job id>` to reuse a finished parse (not for `classify`, `-p`, `--mode medium|high` or `--password`).
|
|
73
|
+
|
|
74
|
+
`-p/--pages` and `--mode` apply to parse, split, classify and extract. `--semantic` (deprecated) asks Ground to match each target by meaning; on PDF, Word and PowerPoint those targets fail with `semantic_mode_deprecated`. Any other request field goes in `--option key=value` (dotted keys nest, JSON values parse) or `--options request.json`; flags win over both, and the source always comes from `SOURCE`.
|
|
75
|
+
|
|
76
|
+
Each command waits for the job and prints Markdown for a parse, the result JSON otherwise. For a document too large to return inline, `nace parse` fetches the full Markdown instead of the preview; when it can't, it prints the preview, names the `nace file` command that fetches the rest, and exits `1`. `-o json` prints the whole job, `-o result` only the result, `-o id` the job id; `--save PATH` writes it to a file. `--async` prints the job id and returns at once; `--watch` streams progress to stderr; `--wait-seconds N` asks Drex to hold the create up to 60 s; `--wait-timeout` bounds the client-side wait (default 600 s).
|
|
77
|
+
|
|
78
|
+
## Uploads
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
nace upload ./invoice.pdf --path invoices/2026/invoice.pdf --on-conflict new_version
|
|
82
|
+
nace upload-grant --path inbox/scan.pdf --max-bytes 10000000 # a one-use upload token for another client
|
|
83
|
+
nace upload-session --path big.csv --total-size-bytes 734003200
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`upload-grant` and `upload-session` print JSON for another client to upload with: the CLI doesn't send parts or complete a session itself, and `nace upload` (or a local-file `SOURCE`) does every step for you.
|
|
87
|
+
|
|
88
|
+
## Jobs and their files
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
nace jobs --operation parse --status succeeded --limit 50 --cursor <next_cursor>
|
|
92
|
+
nace job <id> --wait # --watch implies --wait
|
|
93
|
+
nace events <id> # progress, one JSON object per line
|
|
94
|
+
nace job-request <id> # the request the job ran under
|
|
95
|
+
nace file <id> <document.content_url> # full Markdown, saved as <id>.md
|
|
96
|
+
nace file <id> parse-images/<ref> --save figure-1.png
|
|
97
|
+
nace rows <id> <rows_url> --all > sheet.tsv
|
|
98
|
+
nace cancel <id>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`nace file` saves any file a job produced, waiting for Markdown still being prepared. Without `--save` it goes in the current directory as `<id>.md` for a document's Markdown, else `<id>-<kind>-<digest>` with the file's extension. `--link` prints a stored file's five-minute signed link instead.
|
|
102
|
+
|
|
103
|
+
## Saved extraction schemas
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
nace schema-create Invoice --schema invoice.schema.json
|
|
107
|
+
nace schema-version-add sch_... --schema invoice-v2.schema.json
|
|
108
|
+
nace schemas --all
|
|
109
|
+
nace schema-versions sch_... # oldest first
|
|
110
|
+
nace schema sch_... > invoice.schema.json # the JSON Schema itself; --json for the whole record
|
|
111
|
+
nace schema-version sch_... 1
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Output and exit codes
|
|
115
|
+
|
|
116
|
+
Stdout carries the payload and stderr the status, so `nace parse doc.pdf > doc.md` captures only the document. Exit `0` on success, `1` on an API or job failure (the message names the error type, code, request id and up to five fields that failed validation), `2` on a usage or configuration error.
|
|
117
|
+
|
|
118
|
+
Requests are retried up to twice on a `408`, `429`, `5xx`, dropped connection or timeout, but only while the retry can start within 30 s of the first attempt, so a request that fails after 30 s, such as one that hit `--timeout` (120 s) or a slow `529`, is not retried. `schema-create` and `schema-version-add` are never retried.
|
|
119
|
+
|
|
120
|
+
Full guide: https://console.nace.ai/docs/developer-tools/cli (install, sign-in, `decide`, documents, uploads, jobs, schemas, exit codes).
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
nace_cli/__init__.py,sha256=b9asJBq8Vdtu5FNWu2HrokmlDcw83QEGkr2r4UMNDFY,308
|
|
2
|
+
nace_cli/_cli.py,sha256=NM6HNKWWVt352wFOZVIqa6aRxr6XguOvOXLwCxihAT8,6095
|
|
3
|
+
nace_cli/_decide.py,sha256=GDpOOZDUfCFPiKdVMxzufOPQ05bl57yVMtgESWjeW9E,6804
|
|
4
|
+
nace_cli/_docops.py,sha256=sYooODeoIWK4WNIGwRfPtPpnAgX0lSYJSxzHaXHfkXo,20483
|
|
5
|
+
nace_cli/_entrypoint.py,sha256=CT58_WZw3YQYZvW-a6rjzy7P0t33fviHL1pcMm2jcFQ,896
|
|
6
|
+
nace_cli/_inputs.py,sha256=OlpSxCPWTId-8baZKQfaypsZkhJA9_EEbdm3bkxfUHg,3384
|
|
7
|
+
nace_cli/_jobs.py,sha256=KTKVCLQUn0VUB9-JGLAHUyOF3adF7ccziw6PIi6yEcA,13462
|
|
8
|
+
nace_cli/_login.py,sha256=Z7XVWEtcOVSSqRPeBxO_YO0xpP8Skt5VmSKEETdNVjw,2787
|
|
9
|
+
nace_cli/_output.py,sha256=nMzyQ4wGPW1iDzswZ9xdcJkVM7nXrIaelH8tiEySns8,6909
|
|
10
|
+
nace_cli/_schemas.py,sha256=YLTvxaufRFFK7Nrf-2gPr6R0wwBQGfieddOsOEGqa-Y,6358
|
|
11
|
+
nace_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
nace_cli-0.1.0.dist-info/licenses/LICENSE,sha256=G9_ltpdqkmEvYqlN_39GUzHEJCjkrApP6bWKI7d3rcs,1064
|
|
13
|
+
nace_cli-0.1.0.dist-info/WHEEL,sha256=cmC5s21ojypbVslldL7IJq3hjZH-tINy4rziKePFsG0,81
|
|
14
|
+
nace_cli-0.1.0.dist-info/entry_points.txt,sha256=ivJNJqdBY1X7Apk721DNECK__mFpJo8-epyT7h6h9M8,52
|
|
15
|
+
nace_cli-0.1.0.dist-info/METADATA,sha256=HJ2GdGLZYn30Cn-cSXk4dES-X5NOwTVtggtrzsf5jBY,7115
|
|
16
|
+
nace_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nace AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|