Skip to content

Commit f069c56

Browse files
authored
Merge pull request #4 from Zipstack/feat/unstract-clientV0.2.0
updated batch run with compatible to unstract-client V0.2.0
2 parents bfc9d46 + 66ecea5 commit f069c56

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ This will display detailed usage information.
6060
- `--skip_unprocessed`: Skip unprocessed files when retrying failed files.
6161
- `--log_level`: Log level (default: `INFO`).
6262
- `--print_report`: Print a detailed report of all processed files at the end.
63+
- `--include_metadata`: Include metadata on tokens consumed and the context passed to LLMs for prompt studio exported tools in the result for each file.
6364

6465
## Usage Examples
6566

@@ -129,3 +130,15 @@ The following statuses are tracked for each file during processing:
129130
- **ERROR**: File processing encountered an error.
130131
- **COMPLETED**: File was processed successfully and will not be processed again unless forced by rerun options.
131132

133+
For more about statuses : [API Docs](https://docs.unstract.com/unstract/unstract_platform/api_deployment/unstract_api_deployment_execution_api/#possible-execution-status)
134+
135+
136+
## Questions and Feedback
137+
138+
On Slack, [join great conversations](https://join-slack.unstract.com/) around LLMs, their ecosystem and leveraging them to automate the previously unautomatable!
139+
140+
[Unstract client](https://github.com/Zipstack/unstract-python-client): Learn more about Unstract API clint.
141+
142+
[Unstract Cloud](https://unstract.com/): Signup and Try!.
143+
144+
[Unstract developer documentation](https://docs.unstract.com/): Learn more about Unstract and its API.

main.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Arguments:
3434
skip_unprocessed: bool = False
3535
log_level: str = "INFO"
3636
print_report: bool = False
37+
include_metadata: bool = False
3738

3839

3940
# Initialize SQLite DB
@@ -244,12 +245,13 @@ def process_file(
244245
api_key=args.api_key,
245246
api_timeout=args.api_timeout,
246247
logging_level=args.log_level,
248+
include_metadata=args.include_metadata,
247249
)
248250

249251
status_endpoint, execution_status, response = get_status_endpoint(
250252
file_path=file_path, client=client, args=args
251253
)
252-
# Polling until status is COMPLETE or ERROR
254+
# Polling until status is COMPLETED or ERROR
253255
while execution_status not in ["COMPLETED", "ERROR"]:
254256
time.sleep(args.poll_interval)
255257
response = client.check_execution_status(status_endpoint)
@@ -409,6 +411,13 @@ def main():
409411
help="Print a detailed report of all file processed.",
410412
)
411413

414+
parser.add_argument(
415+
"--include_metadata",
416+
dest="include_metadata",
417+
action="store_true",
418+
help="Include metadata on tokens consumed and the context passed to LLMs for prompt studio exported tools in the result for each file.",
419+
)
420+
412421
args = Arguments(**vars(parser.parse_args()))
413422

414423
ch = logging.StreamHandler(sys.stdout)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
unstract-client~=0.1.0
1+
unstract-client~=1.0.0
22
tqdm~=4.66.5
33
tabulate~=0.9.0

0 commit comments

Comments
 (0)