From 016e50e0d2a6c343e12604acba54f37b16331c72 Mon Sep 17 00:00:00 2001 From: million Date: Fri, 22 Nov 2024 17:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B6=85=E6=97=B6=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 1 + entity_extraction_process.py | 6 +++++- main.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 0f62724..6a0a585 100644 --- a/config.py +++ b/config.py @@ -2,3 +2,4 @@ API_KEY = "ollama" MODEL = "qwen2.5:32b-instruct-q5_K_M" # MODEL = "qwen2.5:7b" LLM_BASE_URL = "http://localhost:11434/v1" +TIMEOUT_SECONDS = 300 diff --git a/entity_extraction_process.py b/entity_extraction_process.py index 8113565..787d9da 100644 --- a/entity_extraction_process.py +++ b/entity_extraction_process.py @@ -30,7 +30,11 @@ class entityExtractionProcess: response = ( llm.chat.completions.create( - model=config.MODEL, messages=messages, temperature=0, max_tokens=128_000 + model=config.MODEL, + messages=messages, + temperature=0, + max_tokens=128_000, + timeout=config.TIMEOUT_SECONDS, ) .choices[0] .message.content diff --git a/main.py b/main.py index 52f8a52..bd65d7f 100644 --- a/main.py +++ b/main.py @@ -20,12 +20,12 @@ DEBUG = False class Main(QueueProcessor): def processor_handle(self, input): - print("input:", input) + # print("input:", input) currentEngineId = input["currentEngineId"] inputData = json.loads(input["inputData"]) match currentEngineId: case 3000: # InfoExtractor 实体信息提取 - logger.warning(f"get queueing inputData= {inputData}") + # logger.warning(f"get queueing inputData= {inputData}") input_text = inputData["text"] result = entityExtractionProcess.entity_extract(input_text)