-
Notifications
You must be signed in to change notification settings - Fork 0
Clarify placeholder-editing guidance and add run-timing output #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,28 +7,35 @@ | |||||||||||||||||||||||||
| from unstructured_client.models.operations import CreateJobRequest, DownloadJobOutputRequest | ||||||||||||||||||||||||||
| from unstructured_client.models.shared import BodyCreateJob, InputFiles | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # ---------------------------------------------------------------------------------- | ||||||||||||||||||||||||||
| # SET THE VARIABLES BELOW as they apply to you. | ||||||||||||||||||||||||||
| # ---------------------------------------------------------------------------------- | ||||||||||||||||||||||||||
| # API_KEY is included here as a local variable for ease of use in this quickstart. | ||||||||||||||||||||||||||
| # This isn't best practice outside of local testing on your own machine. Once | ||||||||||||||||||||||||||
| # you've added your real key, don't share this file or check it into any | ||||||||||||||||||||||||||
| # repositories. | ||||||||||||||||||||||||||
| API_KEY = "YOUR_API_KEY_HERE" | ||||||||||||||||||||||||||
| # The local directory containing the file (or files) you want to process. | ||||||||||||||||||||||||||
| # This folder should contain only the file(s) you want to process, since the | ||||||||||||||||||||||||||
| # script processes every file it finds here. | ||||||||||||||||||||||||||
| INPUT_DIR = "/full/path/to/your/input/directory" | ||||||||||||||||||||||||||
| # The local directory where you want the results saved. | ||||||||||||||||||||||||||
| # Use a different folder than INPUT_DIR, or on a second run the script will | ||||||||||||||||||||||||||
| # also try to process the JSON files already saved here. | ||||||||||||||||||||||||||
| OUTPUT_DIR = "/full/path/to/your/output/directory" | ||||||||||||||||||||||||||
| # ---------------------------------------------------------------------------------- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Set the variables below this validation function before running this script. | ||||||||||||||||||||||||||
| # Validate the variable settings | ||||||||||||||||||||||||||
| def validate_inputs(api_key, input_dir, output_dir): | ||||||||||||||||||||||||||
| # Checks that the settings below have been changed from their placeholder values. | ||||||||||||||||||||||||||
| if api_key in ("YOUR_API_KEY_HERE", ""): | ||||||||||||||||||||||||||
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | ||||||||||||||||||||||||||
| if input_dir in ("/full/path/to/your/input/directory", ""): | ||||||||||||||||||||||||||
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | ||||||||||||||||||||||||||
| if output_dir in ("/full/path/to/your/output/directory", ""): | ||||||||||||||||||||||||||
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") | ||||||||||||||||||||||||||
|
Comment on lines
30
to
35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The validation checks still contain the same placeholder strings as the editable settings, but removing their Prompt for AI agents
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # API_KEY is included here as a local variable for ease of use in this quickstart. | ||||||||||||||||||||||||||
| # This isn't best practice outside of local testing on your own machine. Once | ||||||||||||||||||||||||||
| # you've added your real key, don't share this file or check it into any | ||||||||||||||||||||||||||
| # repositories. | ||||||||||||||||||||||||||
| API_KEY = "YOUR_API_KEY_HERE" | ||||||||||||||||||||||||||
| # API_URL is already preset for you. Do not change the value. | ||||||||||||||||||||||||||
| API_URL = "https://platform-api.transform.unstructured.io/api/v1" | ||||||||||||||||||||||||||
| # The local directory containing the file (or files) you want to process. | ||||||||||||||||||||||||||
| INPUT_DIR = "/full/path/to/your/input/directory" | ||||||||||||||||||||||||||
| # The local directory where you want the results saved. | ||||||||||||||||||||||||||
| OUTPUT_DIR = "/full/path/to/your/output/directory" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| validate_inputs(API_KEY, INPUT_DIR, OUTPUT_DIR) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The validation comparisons no longer identify their literals as non-editable, so readers can mistake these guard values for the settings they should change. Restore
# <-- DO NOT UPDATEon each validation check to preserve the promised placeholder-editing guidance.Prompt for AI agents