From aa3718261436ae8af09a0c7ff0a0b76c616f0f82 Mon Sep 17 00:00:00 2001 From: Niels Geens Date: Wed, 13 Nov 2024 11:51:02 +0100 Subject: [PATCH] Added temperature argument --- sia/__main__.py | 3 ++- sia/config.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sia/__main__.py b/sia/__main__.py index 8338bcc..b3bdc53 100644 --- a/sia/__main__.py +++ b/sia/__main__.py @@ -48,7 +48,8 @@ class Main: case "hf": self._llm = HfLlmEngine( model_id=self._config.model, - api_token=self._config.api_token + api_token=self._config.api_token, + temperature=self._config.temperature ) case "test": self._llm = TestLLM() diff --git a/sia/config.py b/sia/config.py index d911a7b..96f33a2 100644 --- a/sia/config.py +++ b/sia/config.py @@ -75,6 +75,12 @@ class Config: default=os.getenv('SIA_MODEL', '/root/model/'), help='Path to the model directory (default: /root/model/, env: SIA_MODEL)' ) + parser.add_argument( + '--temperature', + type=float, + default=float(os.getenv('SIA_TEMPERATURE', '0.7')), + help='LLM temperature parameter (default: 0.7, env: SIA_TEMPERATURE)' + ) self.args = parser.parse_args() def _parse_bool_env(self, env_var: str, default: bool) -> bool: @@ -134,4 +140,9 @@ class Config: @property def model(self) -> str: """Path to the model directory.""" - return self.args.model \ No newline at end of file + return self.args.model + + @property + def temperature(self) -> float: + """LLM temperature parameter.""" + return self.args.temperature \ No newline at end of file