Код: Выделить всё
class PlanExecute(TypedDict):
input: str
plan: List[str]
past_steps: Annotated[List[Tuple], operator.add]
response: str
def should_end(state: PlanExecute):
if state["response"]:
return True
else:
return False
Естественно, я бы сделал это так:
Код: Выделить всё
def should_end(state: PlanExecute):
return 'response' in state
Код: Выделить всё
def should_end(state: PlanExecute):
if state.get("response"):
return True
else:
return False
Подробнее здесь: https://stackoverflow.com/questions/783 ... en-the-pro