MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / reduce_step

Method reduce_step

camel/human.py:115–138  ·  view source on GitHub ↗

r"""Performs one step of the conversation by displaying options to the user, getting their input, and parsing their choice. Args: messages (Sequence[BaseMessage]): A list of BaseMessage objects. Returns: ChatAgentResponse: A `ChatAgentResponse` objec

(
        self, messages: Sequence[BaseMessage]
    )

Source from the content-addressed store, hash-verified

113 return content
114
115 def reduce_step(
116 self, messages: Sequence[BaseMessage]
117 ) -> ChatAgentResponse:
118 r"""Performs one step of the conversation by displaying options to the
119 user, getting their input, and parsing their choice.
120
121 Args:
122 messages (Sequence[BaseMessage]): A list of BaseMessage objects.
123
124 Returns:
125 ChatAgentResponse: A `ChatAgentResponse` object representing the
126 user's choice.
127 """
128 meta_chat_message = BaseMessage(
129 role_name=messages[0].role_name,
130 role_type=messages[0].role_type,
131 meta_dict=messages[0].meta_dict,
132 content="",
133 )
134 self.display_options(messages)
135 human_input = self.get_input()
136 content = self.parse_input(human_input)
137 message = meta_chat_message.create_new_instance(content)
138 return ChatAgentResponse(msgs=[message], terminated=False, info={})

Callers

nothing calls this directly

Calls 6

display_optionsMethod · 0.95
get_inputMethod · 0.95
parse_inputMethod · 0.95
create_new_instanceMethod · 0.95
BaseMessageClass · 0.90
ChatAgentResponseClass · 0.90

Tested by

no test coverage detected