ostruct-cli 0.4.0__py3-none-any.whl → 0.5.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.
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ostruct-cli
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: CLI for OpenAI Structured Output
5
5
  Author: Yaniv Golan
6
6
  Author-email: yaniv@golan.name
7
- Requires-Python: >=3.9,<4.0
7
+ Requires-Python: >=3.10,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
9
  Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
@@ -17,10 +16,10 @@ Requires-Dist: click (>=8.1.7,<9.0.0)
17
16
  Requires-Dist: ijson (>=3.2.3,<4.0.0)
18
17
  Requires-Dist: jsonschema (>=4.23.0,<5.0.0)
19
18
  Requires-Dist: openai (>=1.0.0,<2.0.0)
20
- Requires-Dist: openai-structured (>=1.3.0,<2.0.0)
19
+ Requires-Dist: openai-structured (>=2.0.0,<3.0.0)
21
20
  Requires-Dist: pydantic (>=2.6.3,<3.0.0)
22
21
  Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
23
- Requires-Dist: tiktoken (>=0.8.0,<0.9.0)
22
+ Requires-Dist: tiktoken (>=0.9.0,<0.10.0)
24
23
  Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
25
24
  Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
26
25
  Requires-Dist: werkzeug (>=3.1.3,<4.0.0)
@@ -91,7 +90,16 @@ Extract information about the person: {{ stdin }}
91
90
  4. Run the CLI:
92
91
 
93
92
  ```bash
94
- echo "John Smith is a 35 year old software engineer" | ostruct --task @task.j2 --schema schema.json
93
+ ostruct run task.j2 schema.json
94
+ ```
95
+
96
+ Or with more options:
97
+
98
+ ```bash
99
+ ostruct run task.j2 schema.json \
100
+ -f content input.txt \
101
+ -m gpt-4o \
102
+ --sys-prompt "You are an expert content analyzer"
95
103
  ```
96
104
 
97
105
  Output:
@@ -112,15 +120,56 @@ Template files use the `.j2` extension to indicate they contain Jinja2 template
112
120
  - Makes it clear the file contains template logic
113
121
  - Follows industry standards for Jinja2 templates
114
122
 
115
- While the CLI accepts templates with any extension (when prefixed with `@`), we recommend using `.j2` for better tooling support and clarity.
123
+ ## CLI Options
124
+
125
+ The CLI revolves around a single subcommand called `run`. Basic usage:
126
+
127
+ ```bash
128
+ ostruct run <TASK_TEMPLATE> <SCHEMA_FILE> [OPTIONS]
129
+ ```
130
+
131
+ Common options include:
132
+
133
+ - File & Directory Inputs:
134
+ - `-f <NAME> <PATH>`: Map a single file to a variable name
135
+ - `-d <NAME> <DIR>`: Map a directory to a variable name
136
+ - `-p <NAME> <PATTERN>`: Map files matching a glob pattern to a variable name
137
+ - `-R, --recursive`: Enable recursive directory/pattern scanning
138
+
139
+ - Variables:
140
+ - `-V name=value`: Define a simple string variable
141
+ - `-J name='{"key":"value"}'`: Define a JSON variable
142
+
143
+ - Model Parameters:
144
+ - `-m, --model MODEL`: Select the OpenAI model (supported: gpt-4o, o1, o3-mini)
145
+ - `--temperature FLOAT`: Set sampling temperature (0.0-2.0)
146
+ - `--max-output-tokens INT`: Set maximum output tokens
147
+ - `--top-p FLOAT`: Set top-p sampling parameter (0.0-1.0)
148
+ - `--frequency-penalty FLOAT`: Adjust frequency penalty (-2.0-2.0)
149
+ - `--presence-penalty FLOAT`: Adjust presence penalty (-2.0-2.0)
150
+ - `--reasoning-effort [low|medium|high]`: Control model reasoning effort
151
+
152
+ - System Prompt:
153
+ - `--sys-prompt TEXT`: Provide system prompt directly
154
+ - `--sys-file FILE`: Load system prompt from file
155
+ - `--ignore-task-sysprompt`: Ignore system prompt in template frontmatter
156
+
157
+ - API Configuration:
158
+ - `--api-key KEY`: OpenAI API key (defaults to OPENAI_API_KEY env var)
159
+ - `--timeout FLOAT`: API timeout in seconds (default: 60.0)
116
160
 
117
161
  ## Debug Options
118
162
 
119
- - `--show-model-schema`: Display the generated Pydantic model schema
120
163
  - `--debug-validation`: Show detailed schema validation debugging
121
- - `--verbose-schema`: Enable verbose schema debugging output
122
- - `--debug-openai-stream`: Enable low-level debug output for OpenAI streaming (very verbose)
123
- - `--progress-level {none,basic,detailed}`: Set progress reporting level (default: basic)
164
+ - `--debug-openai-stream`: Enable low-level debug output for OpenAI streaming
165
+ - `--progress-level {none,basic,detailed}`: Set progress reporting level
166
+ - `none`: No progress indicators
167
+ - `basic`: Show key operation steps (default)
168
+ - `detailed`: Show all steps with additional info
169
+ - `--show-model-schema`: Display the generated Pydantic model schema
170
+ - `--verbose`: Enable verbose logging
171
+ - `--dry-run`: Validate and render template without making API calls
172
+ - `--no-progress`: Disable all progress indicators
124
173
 
125
174
  All debug and error logs are written to:
126
175
 
@@ -174,13 +223,3 @@ Contributions are welcome! Please feel free to submit a Pull Request.
174
223
 
175
224
  This project is licensed under the MIT License - see the LICENSE file for details.
176
225
 
177
- ## Migration from openai-structured
178
-
179
- If you were previously using the CLI bundled with openai-structured (pre-1.0.0), this is its new home. The migration is straightforward:
180
-
181
- 1. Update openai-structured to version 1.0.0 or later
182
- 2. Install ostruct-cli
183
- 3. Replace any `openai-structured` CLI commands with `ostruct`
184
-
185
- The functionality remains the same, just moved to a dedicated package for better maintenance and focus.
186
-
@@ -0,0 +1,42 @@
1
+ ostruct/__init__.py,sha256=X6zo6V7ZNMv731Wi388aTVQngD1410ExGwGx4J6lpyo,187
2
+ ostruct/cli/__init__.py,sha256=sYHKT6o1kFy1acbXejzAvVm8Cy8U91Yf1l4DlzquHKg,409
3
+ ostruct/cli/base_errors.py,sha256=S1cQxoiALbXKPxzgLo6XdSWpzPRb7RKz0QARmu9Zt4g,5987
4
+ ostruct/cli/cache_manager.py,sha256=ej3KrRfkKKZ_lEp2JswjbJ5bW2ncsvna9NeJu81cqqs,5192
5
+ ostruct/cli/cli.py,sha256=R9k4eHpREmvQJb-JLY1VRiWZJO8fJcer1QgnaDX0RrY,74011
6
+ ostruct/cli/click_options.py,sha256=WbRJdB9sO63ChN3fnCP7XWs73DHKl0C1ervfwL11am0,11371
7
+ ostruct/cli/errors.py,sha256=Muc4PygxON7M4bdZJ7-apztK9MrF252PXLPVNEogUv0,13322
8
+ ostruct/cli/exit_codes.py,sha256=uNjvQeUGwU1mlUJYIDrExAn7YlwOXZo603yLAwpqIwk,338
9
+ ostruct/cli/file_info.py,sha256=ilpT8IuckfhadLF1QQAPLXJp7p8kVpffDEEJ2erHPZU,14485
10
+ ostruct/cli/file_list.py,sha256=jLuCd1ardoAXX8FNwPgIqEM-ixzr1xP5ZSqXo2lmrj0,11270
11
+ ostruct/cli/file_utils.py,sha256=J3-6fbEGQ7KD_bU81pAxueHLv9XV0X7f8FSMt_0AJGQ,22537
12
+ ostruct/cli/path_utils.py,sha256=j44q1OoLkqMErgK-qEuhuIZ1VyzqRIvNgxR1et9PoXA,4813
13
+ ostruct/cli/progress.py,sha256=rj9nVEco5UeZORMbzd7mFJpFGJjbH9KbBFh5oTE5Anw,3415
14
+ ostruct/cli/security/__init__.py,sha256=CQpkCgTFYlA1p6atpQeNgIKtE4LZGUKt4EbytbGKpCs,846
15
+ ostruct/cli/security/allowed_checker.py,sha256=N5UXlpjdj5zAbKk-lRDlHiHV3KtQHtJNhtZI_qGB4zw,1638
16
+ ostruct/cli/security/base.py,sha256=q9YUdHEj2eg5w8GEw5403E9OQKIjZbEiaWsvYFnCGLw,1359
17
+ ostruct/cli/security/case_manager.py,sha256=I_ZJSyntLuGx5qVzze559CI-OxsaNPSibkAN8zZ7PvE,2345
18
+ ostruct/cli/security/errors.py,sha256=VZDOGGD-jYLf6E5gCkKxrE34RJXJP_CPWGOF5jV_r4I,5230
19
+ ostruct/cli/security/normalization.py,sha256=qevvxW3hHDtD1cVvDym8LJEQD1AKenVB-0ZvjCYjn5E,5242
20
+ ostruct/cli/security/safe_joiner.py,sha256=PHowCeBAkfHfPqRwuO5Com0OemGuq3cHkdu2p9IYNT0,7107
21
+ ostruct/cli/security/security_manager.py,sha256=R54CgE7eG_0VybvjXj4fNn1jB-RHMUlnJ6Yw8BOtKKc,13512
22
+ ostruct/cli/security/symlink_resolver.py,sha256=wtZdJ_T_0FOy6B1P5ty1odEXQk9vr8BzlWeAFD4huJE,16744
23
+ ostruct/cli/security/types.py,sha256=15yuG_T4CXyAFFFdSWLjVS7ACmDGIPXhQpZ8awcDwCQ,2991
24
+ ostruct/cli/security/windows_paths.py,sha256=qxC2H2kLwtmQ7YePYde3UrmOJcGnsLEebDLh242sUaI,13453
25
+ ostruct/cli/serialization.py,sha256=ec0UswDE2onwtZVUoZaMCsGv6zW_tSKdBng2qVo6Ucs,704
26
+ ostruct/cli/template_env.py,sha256=S2ZvxuMQMicodSVqUhrw0kOzbNmlpQjSHtWlOwjXCms,1538
27
+ ostruct/cli/template_extensions.py,sha256=tJN3HGAS2yzGI8Up6STPday8NVL0VV6UCClBrtDKYr0,1623
28
+ ostruct/cli/template_filters.py,sha256=SjuQxlM5S283TS2El_AbrzETGnYoQeTpmA9sv5et3QI,19222
29
+ ostruct/cli/template_io.py,sha256=yUWO-8rZnSdX97DTMSEX8fG9CP1ISsOhm2NZN3Fab9A,8821
30
+ ostruct/cli/template_rendering.py,sha256=vp_4gvrYLd_kbQi3TYrYNniXLTeLmTaitGVBQManXvo,13342
31
+ ostruct/cli/template_schema.py,sha256=ckH4rUZnEgfm_BHS9LnMGr8LtDxRmZ0C6UBVrSp8KTc,19604
32
+ ostruct/cli/template_utils.py,sha256=Lf1TvonlRA835nxyevEBSPTEbKiz_momvQYM0ZoZDZU,8034
33
+ ostruct/cli/template_validation.py,sha256=AXa2zmsws1j-0CTFlp7fMiZR43iNLnj4h467up2JdgU,12693
34
+ ostruct/cli/token_utils.py,sha256=r4KPEO3Sec18Q6mU0aClK6XGShvusgUggXEQgEPPlaA,1369
35
+ ostruct/cli/utils.py,sha256=1UCl4rHjBWKR5EKugvlVGHiHjO3XXmqvkgeAUSyIPDU,831
36
+ ostruct/cli/validators.py,sha256=BYFZeebCPZObTUjO1TaAMpsD6h7ROkYAFn9C7uf1Q68,2992
37
+ ostruct/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ ostruct_cli-0.5.0.dist-info/LICENSE,sha256=QUOY6QCYVxAiH8vdrUTDqe3i9hQ5bcNczppDSVpLTjk,1068
39
+ ostruct_cli-0.5.0.dist-info/METADATA,sha256=1SaOOVJvTKEqaheLw2MZzdwtinTgw2x_ms3xerwuCKA,6533
40
+ ostruct_cli-0.5.0.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
41
+ ostruct_cli-0.5.0.dist-info/entry_points.txt,sha256=NFq9IuqHVTem0j9zKjV8C1si_zGcP1RL6Wbvt9fUDXw,48
42
+ ostruct_cli-0.5.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.0.1
2
+ Generator: poetry-core 2.1.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,36 +0,0 @@
1
- ostruct/__init__.py,sha256=X6zo6V7ZNMv731Wi388aTVQngD1410ExGwGx4J6lpyo,187
2
- ostruct/cli/__init__.py,sha256=sYHKT6o1kFy1acbXejzAvVm8Cy8U91Yf1l4DlzquHKg,409
3
- ostruct/cli/cache_manager.py,sha256=ej3KrRfkKKZ_lEp2JswjbJ5bW2ncsvna9NeJu81cqqs,5192
4
- ostruct/cli/cli.py,sha256=kh2_P8O7BAbu7qWB64d1qH0rgWSJZuyxn4MdXd13h4I,65574
5
- ostruct/cli/click_options.py,sha256=rrx04tiZmOu2103k0WJMNtc4ZYGpDftD9DjtGCVaNW0,7551
6
- ostruct/cli/errors.py,sha256=lr8c4nkRCZZ5QoWHMZxX4B22CNoaoL1JJx8Y8WTt53Y,10448
7
- ostruct/cli/file_info.py,sha256=xafeONqhUC7D9OPVuDIlc-44KcrPjdEBVmHN69CEtzs,13838
8
- ostruct/cli/file_list.py,sha256=OiOl0NfkrWipZEdtRAf4eDJGDo2kyWdurxmU2k4KaZ0,11438
9
- ostruct/cli/file_utils.py,sha256=On5zjqTx0qKlcZBbt1SNaq7HXtEON5_vyeTFE4UsCFg,22075
10
- ostruct/cli/path_utils.py,sha256=RzGO-QOrp__NtDcIfAjfKl71NSXz3m_pb07UybgF8ro,3681
11
- ostruct/cli/progress.py,sha256=rj9nVEco5UeZORMbzd7mFJpFGJjbH9KbBFh5oTE5Anw,3415
12
- ostruct/cli/security/__init__.py,sha256=CQpkCgTFYlA1p6atpQeNgIKtE4LZGUKt4EbytbGKpCs,846
13
- ostruct/cli/security/allowed_checker.py,sha256=y_R1UIJeGr1Ah1jlsg8t6aO28DnOfLqSH0wqmlVhx5A,1369
14
- ostruct/cli/security/case_manager.py,sha256=I_ZJSyntLuGx5qVzze559CI-OxsaNPSibkAN8zZ7PvE,2345
15
- ostruct/cli/security/errors.py,sha256=hDYKxo7V600ibXtXbrDoCbLNL7MEkarZEQbO2QYfTnI,5859
16
- ostruct/cli/security/normalization.py,sha256=qevvxW3hHDtD1cVvDym8LJEQD1AKenVB-0ZvjCYjn5E,5242
17
- ostruct/cli/security/safe_joiner.py,sha256=PHowCeBAkfHfPqRwuO5Com0OemGuq3cHkdu2p9IYNT0,7107
18
- ostruct/cli/security/security_manager.py,sha256=KkI-fApKoDfRD7HSlz_H5LrIMbM5Rz9aP727t4Q_b5g,12770
19
- ostruct/cli/security/symlink_resolver.py,sha256=wtZdJ_T_0FOy6B1P5ty1odEXQk9vr8BzlWeAFD4huJE,16744
20
- ostruct/cli/security/types.py,sha256=15yuG_T4CXyAFFFdSWLjVS7ACmDGIPXhQpZ8awcDwCQ,2991
21
- ostruct/cli/security/windows_paths.py,sha256=qxC2H2kLwtmQ7YePYde3UrmOJcGnsLEebDLh242sUaI,13453
22
- ostruct/cli/template_env.py,sha256=S2ZvxuMQMicodSVqUhrw0kOzbNmlpQjSHtWlOwjXCms,1538
23
- ostruct/cli/template_extensions.py,sha256=tJN3HGAS2yzGI8Up6STPday8NVL0VV6UCClBrtDKYr0,1623
24
- ostruct/cli/template_filters.py,sha256=wZiR08e2_2SW28B7_tTU3wiij_KTCx3CCvlg-P2q7mk,19126
25
- ostruct/cli/template_io.py,sha256=yUWO-8rZnSdX97DTMSEX8fG9CP1ISsOhm2NZN3Fab9A,8821
26
- ostruct/cli/template_rendering.py,sha256=GrQAcKpGe6QEjSVQkOjpegMcor9LzVUikGmmEVgiWCE,12391
27
- ostruct/cli/template_schema.py,sha256=ckH4rUZnEgfm_BHS9LnMGr8LtDxRmZ0C6UBVrSp8KTc,19604
28
- ostruct/cli/template_utils.py,sha256=QGgewxU_Tgn81J5U-Y4xfi67CkN2dEqXI7PsaNiI9es,7812
29
- ostruct/cli/template_validation.py,sha256=q3ACw4TscdekJb3Z3CTYw0YPEYttqjKjm74ap4lWtU4,11737
30
- ostruct/cli/utils.py,sha256=1UCl4rHjBWKR5EKugvlVGHiHjO3XXmqvkgeAUSyIPDU,831
31
- ostruct/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- ostruct_cli-0.4.0.dist-info/LICENSE,sha256=QUOY6QCYVxAiH8vdrUTDqe3i9hQ5bcNczppDSVpLTjk,1068
33
- ostruct_cli-0.4.0.dist-info/METADATA,sha256=Khg3pmpYFixNMW_RrpF9bfD_ZRJDjAqP4VDWDdMcBhY,5405
34
- ostruct_cli-0.4.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
35
- ostruct_cli-0.4.0.dist-info/entry_points.txt,sha256=NFq9IuqHVTem0j9zKjV8C1si_zGcP1RL6Wbvt9fUDXw,48
36
- ostruct_cli-0.4.0.dist-info/RECORD,,