瀏覽代碼

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
tags/v0.20.0
Liu An 3 月之前
父節點
當前提交
e9c5c7bc7c
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      api/db/services/llm_service.py

+ 2
- 2
api/db/services/llm_service.py 查看文件

@@ -16,6 +16,7 @@
import logging
import re
from functools import partial
from typing import Generator

from langfuse import Langfuse

@@ -57,7 +58,6 @@ class TenantLLMService(CommonService):
mdlnm += "___OpenAI-API"
elif fid == "VLLM":
mdlnm += "___VLLM"
objs = cls.query(tenant_id=tenant_id, llm_name=mdlnm, llm_factory=fid)
if not objs:
return
@@ -334,7 +334,7 @@ class LLMBundle:

return txt

def tts(self, text: str) -> None:
def tts(self, text: str) -> Generator[bytes, None, None]:
if self.langfuse:
span = self.trace.span(name="tts", input={"text": text})


Loading…
取消
儲存