From c67a25c5756fe569d35619db2fa30461e53e7ec4 Mon Sep 17 00:00:00 2001 From: hibobmaster <32976627+hibobmaster@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:31:02 +0800 Subject: [PATCH] Fix variable type imported from environment variable --- src/main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.py b/src/main.py index 3641283..07e7e9c 100644 --- a/src/main.py +++ b/src/main.py @@ -65,17 +65,17 @@ async def main(): openai_api_key=os.environ.get("OPENAI_API_KEY"), gpt_api_endpoint=os.environ.get("GPT_API_ENDPOINT"), gpt_model=os.environ.get("GPT_MODEL"), - max_tokens=os.environ.get("MAX_TOKENS"), - top_p=os.environ.get("TOP_P"), - presence_penalty=os.environ.get("PRESENCE_PENALTY"), - frequency_penalty=os.environ.get("FREQUENCY_PENALTY"), - reply_count=os.environ.get("REPLY_COUNT"), + max_tokens=int(os.environ.get("MAX_TOKENS", 4000)), + top_p=float(os.environ.get("TOP_P", 1.0)), + presence_penalty=float(os.environ.get("PRESENCE_PENALTY", 0.0)), + frequency_penalty=float(os.environ.get("FREQUENCY_PENALTY", 0.0)), + reply_count=int(os.environ.get("REPLY_COUNT", 1)), system_prompt=os.environ.get("SYSTEM_PROMPT"), - temperature=os.environ.get("TEMPERATURE"), + temperature=float(os.environ.get("TEMPERATURE", 0.8)), lc_admin=os.environ.get("LC_ADMIN"), image_generation_endpoint=os.environ.get("IMAGE_GENERATION_ENDPOINT"), image_generation_backend=os.environ.get("IMAGE_GENERATION_BACKEND"), - timeout=os.environ.get("TIMEOUT"), + timeout=float(os.environ.get("TIMEOUT", 120.0)), ) if ( os.environ.get("IMPORT_KEYS_PATH")