mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 01:36:29 +02: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:
commit
d35527b0ba
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue