Skip to content

Commit ecc5c65

Browse files
committed
✨ Adapt MCP protocal to different program language #416
[Specification Details] 1.Remove redundant code and modify test cases.
1 parent d9ed4fd commit ecc5c65

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

sdk/nexent/core/agents/core_agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ def _step_stream(self, memory_step: ActionStep) -> Generator[Any]:
128128
# Add new step in logs
129129
memory_step.model_input_messages = input_messages
130130
stop_sequences = ["<END_CODE>", "Observation:", "Calling tools:", "<END_CODE"]
131-
if self.code_block_tags[1] not in self.code_block_tags[0]:
132-
# If the closing tag is contained in the opening tag, adding it as a stop sequence would cut short any code generation
133-
stop_sequences.append(self.code_block_tags[1])
134131

135132
try:
136133
additional_args: dict[str, Any] = {}

test/sdk/core/agents/test_core_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def test_step_stream_parse_success(core_agent_instance):
752752

753753

754754
def test_step_stream_structured_outputs_with_stop_sequence(core_agent_instance):
755-
"""Ensure _step_stream handles structured outputs and adds closing stop sequence."""
755+
"""Ensure _step_stream handles structured outputs correctly."""
756756
mock_memory_step = MagicMock()
757757
mock_chat_message = MagicMock()
758758
mock_chat_message.content = json.dumps({"code": "print('hello')"})
@@ -776,7 +776,6 @@ def test_step_stream_structured_outputs_with_stop_sequence(core_agent_instance):
776776
mock_extract.assert_called_once_with("print('hello')", core_agent_instance.code_block_tags)
777777
call_kwargs = core_agent_instance.model.call_args.kwargs
778778
assert call_kwargs["response_format"] == core_agent_module.CODEAGENT_RESPONSE_FORMAT
779-
assert "[CLOSE]" in call_kwargs["stop_sequences"]
780779

781780

782781
def test_step_stream_skips_execution_for_display_only(core_agent_instance):

0 commit comments

Comments
 (0)