From b99387151a886a1c979d9b78964c3c2f34758639 Mon Sep 17 00:00:00 2001 From: Ouroboros Chrysopoeia Date: Tue, 17 Sep 2024 19:30:57 +0000 Subject: [PATCH] Update the lower limit of max_sections to 5 --- README.md | 9 ++++----- src/newssurvey/config.py | 2 +- src/newssurvey/newssurvey.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16bb6e9..e2d9d6a 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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 @@ -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. diff --git a/src/newssurvey/config.py b/src/newssurvey/config.py index 303855a..7bafa4a 100644 --- a/src/newssurvey/config.py +++ b/src/newssurvey/config.py @@ -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" diff --git a/src/newssurvey/newssurvey.py b/src/newssurvey/newssurvey.py index 6066e7b..22c2bc6 100644 --- a/src/newssurvey/newssurvey.py +++ b/src/newssurvey/newssurvey.py @@ -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.