Spaces:
Paused
Paused
Download agent_zero_framework/python/api/history_get.py from Oldmangrizzz/Agent-Node: direct link, hf CLI and curl.
- Browser
- Download file 487 Bytes
-
https://huggingface.co/spaces/Oldmangrizzz/Agent-Node/resolve/main/agent_zero_framework/python/api/history_get.py
- Command line
-
hf download hf://spaces/Oldmangrizzz/Agent-Node/agent_zero_framework/python/api/history_get.py
-
curl -L -o history_get.py https://huggingface.co/spaces/Oldmangrizzz/Agent-Node/resolve/main/agent_zero_framework/python/api/history_get.py
487 Bytes
| from python.helpers.api import ApiHandler, Request, Response | |
| class GetHistory(ApiHandler): | |
| async def process(self, input: dict, request: Request) -> dict | Response: | |
| ctxid = input.get("context", []) | |
| context = self.use_context(ctxid) | |
| agent = context.streaming_agent or context.agent0 | |
| history = agent.history.output_text() | |
| size = agent.history.get_tokens() | |
| return { | |
| "history": history, | |
| "tokens": size | |
| } |