MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / ParsedResponse

Class ParsedResponse

src/harness/execution/response_parser.py:29–54  ·  view source on GitHub ↗

Parsed LLM response with extracted tool calls. Attributes: content: The text content of the LLM response. tool_calls: List of OpenAI-format tool call objects. inline_calls: List of parsed inline tool calls from code blocks. raw_bash_block: Raw shell command if a

Source from the content-addressed store, hash-verified

27
28@dataclass
29class ParsedResponse:
30 """Parsed LLM response with extracted tool calls.
31
32 Attributes:
33 content: The text content of the LLM response.
34 tool_calls: List of OpenAI-format tool call objects.
35 inline_calls: List of parsed inline tool calls from code blocks.
36 raw_bash_block: Raw shell command if a bash block was detected.
37 parse_error: Error message if parsing failed (e.g., malformed code block).
38 """
39
40 content: str
41 tool_calls: List[Any] = field(default_factory=list)
42 inline_calls: List[Any] = field(default_factory=list)
43 raw_bash_block: Optional[str] = None
44 parse_error: Optional[str] = None
45
46 @property
47 def has_tool_calls(self) -> bool:
48 """Check if any tool calls were extracted."""
49 return bool(self.tool_calls or self.inline_calls or self.raw_bash_block)
50
51 @property
52 def has_error(self) -> bool:
53 """Check if parsing encountered an error."""
54 return self.parse_error is not None
55
56
57class ResponseParser:

Calls

no outgoing calls