Skip to content

Commit ff51b80

Browse files
committed
UPDATE: docker file
1 parent 64d73f0 commit ff51b80

File tree

4 files changed

+219
-2
lines changed

4 files changed

+219
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
### Fixed
2222
- Fix CI/CD build command from `uvx build` to `uv build`
2323
- Update GitHub Actions workflow for proper package building
24+
- Update Docker documentation with correct CLI parameters (`--input-file` not `--file`)
25+
- Remove obsolete `version` field from docker-compose.yml
26+
27+
### Documentation
28+
- Add comprehensive Docker usage guide (DOCKER_USAGE.md) with correct CLI syntax
29+
- Fix common CLI parameter mistakes in examples
2430

2531
### Technical
2632
- Remove unnecessary `uv tool install build` from CI pipeline

DOCKER_USAGE.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Docker Usage Guide
2+
3+
This guide shows how to use Docker with the structured-output-cookbook project using the **correct CLI parameters**.
4+
5+
## Prerequisites
6+
7+
Set your OpenAI API key:
8+
```bash
9+
export OPENAI_API_KEY='your-api-key-here'
10+
```
11+
12+
## Docker Setup Options
13+
14+
### 1. Quick Start with Helper Scripts (Recommended)
15+
16+
**For Development:**
17+
```bash
18+
./scripts/docker-dev.sh
19+
```
20+
This starts an interactive development environment where you can run commands like:
21+
```bash
22+
uv run structured-output list-templates
23+
uv run structured-output extract recipe --input-file examples/recipe.txt
24+
uv run pytest
25+
uv run ruff check .
26+
```
27+
28+
**For Production Use:**
29+
```bash
30+
# Show help
31+
./scripts/docker-run.sh
32+
33+
# Extract using a template (correct syntax)
34+
./scripts/docker-run.sh extract recipe --input-file examples/recipe.txt
35+
36+
# Extract with custom schema
37+
./scripts/docker-run.sh extract-custom news_article --input-file examples/news_article.txt
38+
39+
# Batch processing
40+
./scripts/docker-run.sh batch-extract examples/recipe.txt examples/product_review.txt recipe
41+
42+
# List available templates
43+
./scripts/docker-run.sh list-templates
44+
45+
# Validate schemas
46+
./scripts/docker-run.sh validate-schemas
47+
```
48+
49+
### 2. Using Docker Compose
50+
51+
**Production service:**
52+
```bash
53+
# Build and show help
54+
docker compose up structured-output-cookbook
55+
56+
# Run specific commands (correct syntax)
57+
docker compose run --rm structured-output-cookbook structured-output extract recipe --input-file examples/recipe.txt
58+
docker compose run --rm structured-output-cookbook structured-output list-templates
59+
docker compose run --rm structured-output-cookbook structured-output extract-custom customer_support --input-file examples/email.txt
60+
```
61+
62+
**Development service:**
63+
```bash
64+
# Start interactive development environment
65+
docker compose run --rm dev
66+
```
67+
68+
### 3. Direct Docker Commands
69+
70+
**Build the image:**
71+
```bash
72+
docker build -t structured-output-cookbook:latest .
73+
```
74+
75+
**Run commands:**
76+
```bash
77+
# Show help
78+
docker run --rm \
79+
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
80+
-v "$(pwd)/data:/app/data" \
81+
-v "$(pwd)/config:/app/config" \
82+
-v "$(pwd)/examples:/app/examples:ro" \
83+
structured-output-cookbook:latest
84+
85+
# Extract with template (correct syntax)
86+
docker run --rm \
87+
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
88+
-v "$(pwd)/data:/app/data" \
89+
-v "$(pwd)/config:/app/config" \
90+
-v "$(pwd)/examples:/app/examples:ro" \
91+
structured-output-cookbook:latest \
92+
structured-output extract recipe --input-file examples/recipe.txt
93+
94+
# Extract with custom schema
95+
docker run --rm \
96+
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
97+
-v "$(pwd)/data:/app/data" \
98+
-v "$(pwd)/config:/app/config" \
99+
-v "$(pwd)/examples:/app/examples:ro" \
100+
structured-output-cookbook:latest \
101+
structured-output extract-custom news_article --input-file examples/news_article.txt
102+
```
103+
104+
## Correct CLI Parameter Reference
105+
106+
### extract command
107+
```bash
108+
structured-output extract <TEMPLATE> --input-file <FILE> [OPTIONS]
109+
```
110+
- Template is a **positional argument** (recipe, job, product-review, email, event)
111+
- Use `--input-file` (not `--file`)
112+
- Use `--output` for output file (not `--output-format`)
113+
114+
### extract-custom command
115+
```bash
116+
structured-output extract-custom <SCHEMA_NAME> --input-file <FILE> [OPTIONS]
117+
```
118+
- Schema name is a **positional argument**
119+
- Use `--input-file` (not `--file`)
120+
121+
### batch-extract command
122+
```bash
123+
structured-output batch-extract <INPUT_FILES...> <TEMPLATE> [OPTIONS]
124+
```
125+
- Input files are **positional arguments** (multiple files allowed)
126+
- Template is the **last positional argument**
127+
- Use `--output-dir` for output directory
128+
129+
### validate-schemas command
130+
```bash
131+
structured-output validate-schemas [--config-dir <DIR>]
132+
```
133+
- Use `--config-dir` (not `--schema-dir`)
134+
135+
## Environment Variables
136+
137+
- `OPENAI_API_KEY` (required)
138+
- `OPENAI_MODEL` (default: gpt-4o-mini)
139+
- `LOG_LEVEL` (default: INFO for production, DEBUG for dev)
140+
- `MAX_TOKENS` (default: 4000)
141+
- `TEMPERATURE` (default: 0.1)
142+
143+
## Volume Mounts
144+
145+
The Docker setup automatically mounts:
146+
- `./data``/app/data` (for output files)
147+
- `./config``/app/config` (for custom schemas)
148+
- `./examples``/app/examples` (read-only, for input files)
149+
150+
## Complete Examples
151+
152+
**Extract a recipe:**
153+
```bash
154+
./scripts/docker-run.sh extract recipe --input-file examples/recipe.txt --pretty
155+
```
156+
157+
**Extract with custom schema:**
158+
```bash
159+
./scripts/docker-run.sh extract-custom product_review --input-file examples/product_review.txt --output data/custom_result.json
160+
```
161+
162+
**Batch processing:**
163+
```bash
164+
./scripts/docker-run.sh batch-extract examples/recipe.txt examples/product_review.txt recipe --output-dir data/batch_results
165+
```
166+
167+
**Validate all schemas:**
168+
```bash
169+
./scripts/docker-run.sh validate-schemas --config-dir config/schemas
170+
```
171+
172+
**Get session statistics:**
173+
```bash
174+
./scripts/docker-run.sh session-stats
175+
```
176+
177+
**Cost analysis:**
178+
```bash
179+
./scripts/docker-run.sh cost-analysis
180+
```
181+
182+
## Common Mistakes to Avoid
183+
184+
**Wrong:** `--file examples/recipe.txt`
185+
**Correct:** `--input-file examples/recipe.txt`
186+
187+
**Wrong:** `extract --template recipe --file examples/recipe.txt`
188+
**Correct:** `extract recipe --input-file examples/recipe.txt`
189+
190+
**Wrong:** `batch-extract --input-dir examples --template recipe`
191+
**Correct:** `batch-extract examples/*.txt recipe`
192+
193+
**Wrong:** `validate-schemas --schema-dir config/schemas`
194+
**Correct:** `validate-schemas --config-dir config/schemas`
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"ticket_id": null,
3+
"customer_name": "Sarah Johnson",
4+
"customer_email": "sarah.johnson@techcorp.com",
5+
"issue_category": "technical",
6+
"priority_level": "high",
7+
"product_service": "API",
8+
"issue_summary": "Request for extension on API migration deadline due to critical issues.",
9+
"detailed_description": "The development team has encountered several critical issues during the migration process, including database schema conflicts, authentication system incompatibilities, failures with third-party integrations, and performance degradation in the staging environment.",
10+
"steps_to_reproduce": [],
11+
"resolution_status": "open",
12+
"actions_taken": [
13+
"Requested a 2-week extension for the API migration deadline",
14+
"Scheduled an emergency team meeting for March 16th",
15+
"Requested an extended testing period for the new authentication system",
16+
"Coordination with DevOps team for infrastructure scaling"
17+
],
18+
"escalation_needed": false
19+
}

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
structured-output-cookbook:
53
build: .

0 commit comments

Comments
 (0)