Skip to content

Commit e0710b2

Browse files
committed
docs(readme): add note on image URL handling and provide usage examples
docs(ask2api): update main function description for clarity
1 parent 824fa70 commit e0710b2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,27 @@ You can also analyze images and get structured JSON responses:
117117
ask2api -p "Where is this place?" -sf schema.json -i https://upload.wikimedia.org/wikipedia/commons/6/64/Lesdeuxmagots.jpg
118118
```
119119

120+
<details>
121+
122+
<summary><b>Note:</b> Some API providers may not accept image URLs...</summary>
123+
124+
...and require images to be provided as base64-encoded data (i.e., a local file). If you encounter problems using an image URL, download the image locally and pass the file path, then `ask2api` will base64-encode local files automatically.
125+
126+
Example (download with curl and run):
127+
128+
```bash
129+
curl -sSL -o place.jpg "https://upload.wikimedia.org/wikipedia/commons/6/64/Lesdeuxmagots.jpg"
130+
ask2api -p "Where is this place?" -sf schema.json -i ./place.jpg
131+
```
132+
133+
Or download with wget:
134+
135+
```bash
136+
wget -O place.jpg "https://upload.wikimedia.org/wikipedia/commons/6/64/Lesdeuxmagots.jpg"
137+
```
138+
139+
</details>
140+
120141
## How it works
121142

122143
1. You define the desired output structure using a JSON Schema.

ask2api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def generate_api_response(
250250

251251
def main():
252252
parser = argparse.ArgumentParser(
253+
description="Ask a language model to return a JSON object that strictly follows a provided JSON schema.",
253254
formatter_class=argparse.RawDescriptionHelpFormatter,
254255
epilog=Config.get_env_vars_help(),
255256
)

0 commit comments

Comments
 (0)