mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-29 08:26:32 +00:00
Rafe: Update LLMService type hints (#9131)
### What problem does this PR solve? - Add Generator return type annotation for tts method - Import typing.Generator for type hints ### Type of change - [x] Refactoring
This commit is contained in:
parent
2bf4ed6512
commit
e9c5c7bc7c
@ -16,6 +16,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from typing import Generator
|
||||||
|
|
||||||
from langfuse import Langfuse
|
from langfuse import Langfuse
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ class TenantLLMService(CommonService):
|
|||||||
mdlnm += "___OpenAI-API"
|
mdlnm += "___OpenAI-API"
|
||||||
elif fid == "VLLM":
|
elif fid == "VLLM":
|
||||||
mdlnm += "___VLLM"
|
mdlnm += "___VLLM"
|
||||||
|
|
||||||
objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm, llm_factory=fid)
|
objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm, llm_factory=fid)
|
||||||
if not objs:
|
if not objs:
|
||||||
return
|
return
|
||||||
@ -334,7 +334,7 @@ class LLMBundle:
|
|||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def tts(self, text: str) -> None:
|
def tts(self, text: str) -> Generator[bytes, None, None]:
|
||||||
if self.langfuse:
|
if self.langfuse:
|
||||||
span = self.trace.span(name="tts", input={"text": text})
|
span = self.trace.span(name="tts", input={"text": text})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user