使用旧式联合体写法以兼容python3.9

This commit is contained in:
春河晴
2025-04-23 14:39:51 +09:00
parent 7b707014f5
commit 7e26304e94
2 changed files with 4 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import json import json
import time import time
from typing import List from typing import List, Union
from .global_logger import logger from .global_logger import logger
from . import prompt_template from . import prompt_template
@@ -64,7 +64,7 @@ def _rdf_triple_extract(llm_client: LLMClient, paragraph: str, entities: list) -
def info_extract_from_str( def info_extract_from_str(
llm_client_for_ner: LLMClient, llm_client_for_rdf: LLMClient, paragraph: str llm_client_for_ner: LLMClient, llm_client_for_rdf: LLMClient, paragraph: str
) -> tuple[None, None] | tuple[list[str], list[list[str]]]: ) -> Union[tuple[None, None], tuple[list[str], list[list[str]]]]:
try_count = 0 try_count = 0
while True: while True:
try: try:

View File

@@ -1,5 +1,5 @@
import time import time
from typing import Tuple, List, Dict from typing import Tuple, List, Dict, Optional
from .global_logger import logger from .global_logger import logger
@@ -28,7 +28,7 @@ class QAManager:
"qa": llm_client_qa, "qa": llm_client_qa,
} }
def process_query(self, question: str) -> Tuple[List[Tuple[str, float, float]], Dict[str, float] | None]: def process_query(self, question: str) -> Tuple[List[Tuple[str, float, float]], Optional[Dict[str, float]]]:
"""处理查询""" """处理查询"""
# 生成问题的Embedding # 生成问题的Embedding