fix(llm): adapt async tool results for compatible APIs
This commit is contained in:
@@ -117,7 +117,7 @@ def create_llm(cfg: AssistantConfig):
|
||||
raise ValueError(f"不支持的 LLM 接口类型: {cfg.llm_interface_type}")
|
||||
extra_body = cfg.llm_values.get("extraBody")
|
||||
extra = {"extra_body": extra_body} if isinstance(extra_body, dict) else {}
|
||||
return OpenAILLMService(
|
||||
service = OpenAILLMService(
|
||||
api_key=_require(cfg.llm_api_key, "LLM apiKey"),
|
||||
base_url=_require(cfg.llm_base_url, "LLM apiUrl"),
|
||||
settings=OpenAILLMService.Settings(
|
||||
@@ -125,6 +125,15 @@ def create_llm(cfg: AssistantConfig):
|
||||
extra=extra,
|
||||
),
|
||||
)
|
||||
# Pipecat represents late async-tool results with the newer `developer`
|
||||
# role. Most OpenAI-compatible providers (including DeepSeek) only accept
|
||||
# system/assistant/user/tool. This flag uses Pipecat's built-in adapter to
|
||||
# downgrade developer messages before sending the request. Official or
|
||||
# otherwise compatible endpoints can opt in through the resource values.
|
||||
service.supports_developer_role = (
|
||||
cfg.llm_values.get("supportsDeveloperRole") is True
|
||||
)
|
||||
return service
|
||||
|
||||
|
||||
def create_tts(cfg: AssistantConfig):
|
||||
|
||||
Reference in New Issue
Block a user