Skip to content

Commit

Permalink
Update the lower limit of max_sections to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
impredicative committed Sep 17, 2024
1 parent 2928011 commit b993871
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ In the simplest case, run `python -m newssurvey` to interactively start the appl
For non-interactive use, the usage help is copied below:
```
$ python -m newssurvey -h
Using diskcache path: /workspaces/newssurvey/src/newssurvey/.diskcache/util/openai_
Usage: python -m newssurvey [OPTIONS]
Generate and write a response to a question or concern using a supported news source.
Expand All @@ -98,8 +97,8 @@ Options:
-q, --query TEXT Question or concern answerable by the news source. If a path to a file, the file
text is read as text. If not given, the user is prompted for it.
-m, --max-sections INTEGER RANGE
Maximum number of sections to include in the response, between 10 and 100. Its
recommended value, also the default, is 100. [10<=x<=100]
Maximum number of sections to include in the response, between 5 and 100. Its
recommended value, also the default, is 100. [5<=x<=100]
-f, --output-format TEXT Output format of the response. It can be txt (for text), md (for markdown), gfm.md
(for GitHub Flavored markdown), html, pdf, or json. If not specified, but if an
output filename is specified via '--output-path', it is determined automatically
Expand All @@ -124,7 +123,7 @@ Usage examples:

$ python -m newssurvey -s medicalxpress -q ./my_detailed_medical_concern.txt -f html -o ~/output.html -c

$ python -m newssurvey -s physorg -q ./my_science_query.txt -f pdf -o ./work/
$ python -m newssurvey -s physorg -q ./my_science_query.txt -f pdf -o ./work/ -m 10

### Usage as library

Expand All @@ -147,7 +146,7 @@ The progress is printed to stdout.
Params:
* `source`: Name of supported news source.
* `query`: Question or concern answerable by the news source.
* `max_sections`: Maximum number of sections to include in the response, between 10 and 100. Its recommended value, also the default, is 100.
* `max_sections`: Maximum number of sections to include in the response, between 5 and 100. Its recommended value, also the default, is 100.
* `output_format`: Output format. It can be txt (for text), md (for markdown), gfm.md (for GitHub Flavored markdown), html, pdf, or json. Its default is txt.
* `confirm`: Confirm as the workflow progresses. If true, a confirmation is interactively sought as each step of the workflow progresses. Its default is false.
Expand Down
2 changes: 1 addition & 1 deletion src/newssurvey/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
NEWS_SOURCE_NAMESPACE: str = f"{PACKAGE_NAME}.sources"
NEWS_SOURCES: dict[str, ModuleSpec] = {s.name: importlib.util.find_spec(f"{NEWS_SOURCE_NAMESPACE}.{s.name}") for s in (PACKAGE_PATH / "sources").iterdir()} # Note: A direct import is not practicable here due to a circular import.
NUM_SECTIONS_DEFAULT: int = 100
NUM_SECTIONS_MIN: int = 10 # Applies only to the `max_sections` argument. Does not apply to LLM output.
NUM_SECTIONS_MIN: int = 5 # Applies only to the `max_sections` argument. Does not apply to LLM output.
NUM_SECTIONS_MAX: int = 100
assert NUM_SECTIONS_MIN <= NUM_SECTIONS_DEFAULT <= NUM_SECTIONS_MAX
OUTPUT_FORMAT_DEFAULT: str = "txt"
Expand Down
2 changes: 1 addition & 1 deletion src/newssurvey/newssurvey.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def generate_response(source: str, query: str, max_sections: int = NUM_SECTIONS_
Params:
* `source`: Name of supported news source.
* `query`: Question or concern answerable by the news source.
* `max_sections`: Maximum number of sections to include in the response, between 10 and 100. Its recommended value, also the default, is 100.
* `max_sections`: Maximum number of sections to include in the response, between 5 and 100. Its recommended value, also the default, is 100.
* `output_format`: Output format. It can be txt (for text), md (for markdown), gfm.md (for GitHub Flavored markdown), html, pdf, or json. Its default is txt.
* `confirm`: Confirm as the workflow progresses. If true, a confirmation is interactively sought as each step of the workflow progresses. Its default is false.
Expand Down

0 comments on commit b993871

Please sign in to comment.