mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-10-13 16:46:58 +08:00
Merge pull request #801 from pkdog/fix-zhipu
Refactor get_choice_delta_text for safer dict access while using ZHIPU API
This commit is contained in:
@@ -91,7 +91,7 @@ class BaseLLM(ABC):
|
||||
|
||||
def get_choice_delta_text(self, rsp: dict) -> str:
|
||||
"""Required to provide the first text of stream choice"""
|
||||
return rsp.get("choices")[0]["delta"]["content"]
|
||||
return rsp.get("choices", [{}])[0].get("delta", {}).get("content", "")
|
||||
|
||||
def get_choice_function(self, rsp: dict) -> dict:
|
||||
"""Required to provide the first function of choice
|
||||
|
||||
Reference in New Issue
Block a user