Skip to content

Commit 7cf08e9

Browse files
committed
fix(db): change underscore to dash on cli args
1 parent 6502488 commit 7cf08e9

1 file changed

Lines changed: 31 additions & 32 deletions

File tree

config.py

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def from_dict(cls, config_dict: dict):
138138
DatabaseConfig: Instance of DatabaseConfig with provided configuration.
139139
"""
140140

141-
print(config_dict)
142141
return cls(
143142
db_type=config_dict['db_type'],
144143
cache_translation=config_dict['cache_translation'],
@@ -301,60 +300,60 @@ def parse_args():
301300
parser = argparse.ArgumentParser(description="Application Configuration CLI")
302301

303302
# OpenAI Config
304-
parser.add_argument("--base_url", type=str, default="https://api.openai.com/v1", help="Base URL for OpenAI API")
305-
parser.add_argument("--api_key", type=str, required=True, help="openai")
306-
parser.add_argument("--model_name", type=str, default="gpt-3.5-turbo", help="OpenAI model name")
303+
parser.add_argument("--base-url", type=str, default="https://api.openai.com/v1", help="Base URL for OpenAI API")
304+
parser.add_argument("--api-key", type=str, required=True, help="openai")
305+
parser.add_argument("--model-name", type=str, default="gpt-3.5-turbo", help="OpenAI model name")
307306

308307
# Model Config
309308
parser.add_argument("--temperature", type=float, default=0.0, help="Model temperature (randomness control)")
310-
parser.add_argument("--max_tokens", type=int, default=2048, help="Maximum number of tokens to generate")
311-
parser.add_argument("--frequency_penalty", type=float, default=0.0, help="Penalty for repeated tokens")
312-
parser.add_argument("--presence_penalty", type=float, default=0.0, help="Penalty for new tokens")
309+
parser.add_argument("--max-tokens", type=int, default=2048, help="Maximum number of tokens to generate")
310+
parser.add_argument("--frequency-penalty", type=float, default=0.0, help="Penalty for repeated tokens")
311+
parser.add_argument("--presence-penalty", type=float, default=0.0, help="Penalty for new tokens")
313312

314313
# Server Config
315314
parser.add_argument("--host", type=str, default="0.0.0.0", help="Server host address")
316315
parser.add_argument("--port", type=int, default=5000, help="Server port")
317316

318317
# History Config
319-
parser.add_argument("--use_history", action="store_true", help="Enable history usage")
320-
parser.add_argument("--max_history", type=int, default=20, help="Maximum number of history records")
321-
parser.add_argument("--use_latest_history", action="store_true", help="Use latest history records")
318+
parser.add_argument("--use-history", action="store_true", help="Enable history usage")
319+
parser.add_argument("--max-history", type=int, default=20, help="Maximum number of history records")
320+
parser.add_argument("--use-latest-history", action="store_true", help="Use latest history records")
322321

323322
# Database Config
324-
parser.add_argument("--db_type", type=str, default="sqlite", help="Database type to use")
325-
parser.add_argument("--cache_translation", action="store_true", help="Enable translation caching")
326-
parser.add_argument("--use_cached_translation", action="store_true", help="Use cached translations if available")
327-
parser.add_argument("--use_latest_records", action="store_true", help="Use latest database records")
328-
parser.add_argument("--init_latest_records", type=int, default=20, help="Number of initial latest records")
323+
parser.add_argument("--db-type", type=str, default="sqlite", help="Database type to use")
324+
parser.add_argument("--cache-translation", action="store_true", help="Enable translation caching")
325+
parser.add_argument("--use-cached-translation", action="store_true", help="Use cached translations if available")
326+
parser.add_argument("--use-latest-records", action="store_true", help="Use latest database records")
327+
parser.add_argument("--init-latest-records", type=int, default=20, help="Number of initial latest records")
329328

330329
# PostgreSQL Configs
331-
parser.add_argument("--postgres_host", type=str, default="localhost", help="PostgreSQL server host")
332-
parser.add_argument("--postgres_port", type=int, default=5432, help="PostgreSQL server port")
333-
parser.add_argument("--postgres_user", type=str, help="PostgreSQL username")
334-
parser.add_argument("--postgres_password", type=str, help="PostgreSQL password")
335-
parser.add_argument("--postgres_db", type=str, help="PostgreSQL database name")
330+
parser.add_argument("--postgres-host", type=str, default="localhost", help="PostgreSQL server host")
331+
parser.add_argument("--postgres-port", type=int, default=5432, help="PostgreSQL server port")
332+
parser.add_argument("--postgres-user", type=str, help="PostgreSQL username")
333+
parser.add_argument("--postgres-password", type=str, help="PostgreSQL password")
334+
parser.add_argument("--postgres-db", type=str, help="PostgreSQL database name")
336335

337336
# SQLite Config
338-
parser.add_argument("--sqlite_db_path", type=str, default="translated_texts.db", help="Path to the SQLite database file")
337+
parser.add_argument("--sqlite-db-path", type=str, default="translated_texts.db", help="Path to the SQLite database file")
339338

340339
# Logging Config
341-
parser.add_argument("--log_file", type=str, help="Log file path")
342-
parser.add_argument("--log_level", type=str, choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], default="INFO", help="Logging level")
340+
parser.add_argument("--log-file", type=str, help="Log file path")
341+
parser.add_argument("--log-level", type=str, choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], default="INFO", help="Logging level")
343342

344343
# Prompt Config
345-
parser.add_argument("--task_template", type=str, default="Translate text in the {src_start}{src_end} section to the target language as naturally as possible, considering the context in the translation history and ensuring consistency and cultural relevance. Translated text must be enclosed in the {tgt_start}{tgt_end} section. You must respond with only the {tgt_end} section.", help="Template for the translation task")
346-
parser.add_argument("--specify_language", action="store_true", help="Specify source and target languages in the prompt")
347-
parser.add_argument("--language_template", type=str, default="Translate from {src_lang} to {tgt_lang}", help="Template for specifying languages")
344+
parser.add_argument("--task-template", type=str, default="Translate text in the {src_start}{src_end} section to the target language as naturally as possible, considering the context in the translation history and ensuring consistency and cultural relevance. Translated text must be enclosed in the {tgt_start}{tgt_end} section. You must respond with only the {tgt_end} section.", help="Template for the translation task")
345+
parser.add_argument("--specify-language", action="store_true", help="Specify source and target languages in the prompt")
346+
parser.add_argument("--language-template", type=str, default="Translate from {src_lang} to {tgt_lang}", help="Template for specifying languages")
348347

349348
# Tag Config
350-
parser.add_argument("--src_start", type=str, default="<src>", help="Start tag for the source language")
351-
parser.add_argument("--src_end", type=str, default="</src>", help="End tag for the source language")
352-
parser.add_argument("--tgt_start", type=str, default="<tgt>", help="Start tag for the target language")
353-
parser.add_argument("--tgt_end", type=str, default="</tgt>", help="End tag for the target language")
349+
parser.add_argument("--src-start", type=str, default="<src>", help="Start tag for the source language")
350+
parser.add_argument("--src-end", type=str, default="</src>", help="End tag for the source language")
351+
parser.add_argument("--tgt-start", type=str, default="<tgt>", help="Start tag for the target language")
352+
parser.add_argument("--tgt-end", type=str, default="</tgt>", help="End tag for the target language")
354353

355354
# System Prompt Config
356-
parser.add_argument("--use_system_prompt", action="store_true", help="Enable system prompt")
357-
parser.add_argument("--system_prompt", type=str, help="System prompt to be used")
355+
parser.add_argument("--use-system-prompt", action="store_true", help="Enable system prompt")
356+
parser.add_argument("--system-prompt", default="", type=str, help="System prompt to be used")
358357

359358
# Configuration Files
360359
parser.add_argument("--config", type=str, help="Path to the TOML configuration file")

0 commit comments

Comments
 (0)