Spaces:
Configuration error
Configuration error
Download openhands/security/invariant/nodes.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 967 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/security/invariant/nodes.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/openhands/security/invariant/nodes.py
-
curl -L -o nodes.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/security/invariant/nodes.py
967 Bytes
| from typing import Any, Iterable | |
| from pydantic import BaseModel, Field | |
| from pydantic.dataclasses import dataclass | |
| class LLM: | |
| vendor: str | |
| model: str | |
| class Event(BaseModel): | |
| metadata: dict | None = Field( | |
| default_factory=lambda: dict(), description='Metadata associated with the event' | |
| ) | |
| class Function(BaseModel): | |
| name: str | |
| arguments: dict | |
| class ToolCall(Event): | |
| id: str | |
| type: str | |
| function: Function | |
| class Message(Event): | |
| role: str | |
| content: str | None | |
| tool_calls: list[ToolCall] | None = None | |
| def __rich_repr__( | |
| self, | |
| ) -> Iterable[Any | tuple[Any] | tuple[str, Any] | tuple[str, Any, Any]]: | |
| # Print on separate line | |
| yield 'role', self.role | |
| yield 'content', self.content | |
| yield 'tool_calls', self.tool_calls | |
| class ToolOutput(Event): | |
| role: str | |
| content: str | |
| tool_call_id: str | None = None | |
| _tool_call: ToolCall | None = None | |