Skip to content

Commit 835073e

Browse files
authored
Merge pull request #18 from mozilla-ai/17-cli-run-bug
fix(cli): Load `question` from config.
2 parents 148afe5 + ca3fa95 commit 835073e

File tree

6 files changed

+8
-3
lines changed

6 files changed

+8
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pip install structured-qa
5151
structured-qa \
5252
--question "What optimizer was used to train the model?" \
5353
--input_file "example_data/1706.03762v7.pdf" \
54-
--output_folder "example_outputs/1706.03762v7.pdf"
54+
--output_dir "example_outputs/1706.03762v7.pdf"
5555
```
5656

5757
### Graphical Interface App

docs/cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Or provide values to the arguments directly:
1515
structured-qa \
1616
--question "What learning rate was used?" \
1717
--input_file "example_data/1706.03762v7.pdf" \
18-
--output_folder "example_outputs/1706.03762v7.pdf"
18+
--output_dir "example_outputs/1706.03762v7.pdf"
1919
```
2020

2121
---

docs/customization.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This Blueprint is designed to be flexible and easily adaptable to your specific
66

77
## 🖋️ **Customizable Parameters**
88

9+
-- **`question`**: The question to be answered.
10+
911
- **`input_file`**: The input file specifies the document to be processed. Supports the `pdf` format.
1012

1113
- **`output_dir`**: Path to the output directory where the extracted sections will be saved.

example_data/config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
question: "What optimizer was used to train the model?"
12
input_file: example_data/1706.03762v7.pdf
23
output_dir: example_outputs/1706.03762v7.pdf
34
model: "bartowski/Qwen2.5-3B-Instruct-GGUF/Qwen2.5-3B-Instruct-f16.gguf"

src/structured_qa/cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@logger.catch(reraise=True)
1414
def structured_qa(
15-
question: str,
15+
question: str | None = None,
1616
input_file: str | None = None,
1717
output_dir: str | None = None,
1818
model: str
@@ -57,6 +57,7 @@ def structured_qa(
5757
else:
5858
Path(output_dir).mkdir(exist_ok=True, parents=True)
5959
config = Config(
60+
question=question,
6061
input_file=input_file,
6162
output_dir=output_dir,
6263
model=model,

src/structured_qa/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def answer_prompt(value):
6060

6161

6262
class Config(BaseModel):
63+
question: str
6364
input_file: FilePath
6465
output_dir: DirectoryPath
6566
model: Annotated[str, AfterValidator(validate_model)]

0 commit comments

Comments
 (0)