Spaces:
Sleeping
Sleeping
Download debatemind/tools/read_transcript.py from Smzu890/DebateMind: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/Smzu890/DebateMind/resolve/main/debatemind/tools/read_transcript.py
- Command line
-
hf download hf://spaces/Smzu890/DebateMind/debatemind/tools/read_transcript.py
-
curl -L -o read_transcript.py https://huggingface.co/spaces/Smzu890/DebateMind/resolve/main/debatemind/tools/read_transcript.py
1.18 kB
| """MCP tool: read_transcript -- read transcript entries for a turn range.""" | |
| from __future__ import annotations | |
| from debatemind.models.observation import TranscriptEntry | |
| def read_transcript( | |
| start_turn: int, | |
| end_turn: int, | |
| transcript: list[TranscriptEntry], | |
| ) -> dict: | |
| """Return transcript entries for the specified turn range. | |
| The range is clamped to valid bounds so out-of-range values are | |
| handled gracefully rather than raising errors. | |
| Args: | |
| start_turn: First turn to include (inclusive). | |
| end_turn: Last turn to include (inclusive). | |
| transcript: Full list of transcript entries. | |
| Returns: | |
| A dict with an "entries" key containing a list of dicts, | |
| each with turn, actor, action_type, and content fields. | |
| """ | |
| # Clamp to valid bounds | |
| start_turn = max(0, start_turn) | |
| end_turn = max(start_turn, end_turn) | |
| entries = [ | |
| { | |
| "turn": e.turn, | |
| "actor": e.actor, | |
| "action_type": e.action_type, | |
| "content": e.content, | |
| } | |
| for e in transcript | |
| if start_turn <= e.turn <= end_turn | |
| ] | |
| return {"entries": entries} | |