-
Notifications
You must be signed in to change notification settings - Fork 553
Description
The Python Copilot SDK currently exposes a mixed public API surface: some higher-level methods return dataclass-based models (generated from NodeJS definitions), while others return raw JSON-RPC dicts typed only via TypedDict (e.g. get_status(), list_sessions()).
I understand that the underlying JsonRpcClient intentionally returns dicts at the transport layer, but at the SDK boundary this leads to an inconsistent abstraction and unclear guidance for users (object attributes vs dict access).
Some responses are represented as dataclasses generated from NodeJS definitions which are generated, with explicit serialization helpers:
copilot/generated/session_events.py
@dataclass
class ContextClass:
...
@staticmethod
def from_dict(...)These expose a clear, object-oriented API to SDK users.
Moreover Sample:
>>> sess = await client.create_session()
>>> sess
<copilot.session.CopilotSession object at 0x000002292C6F7E00>Other public methods return raw JSON-RPC responses directly:
async def get_status(self) -> GetStatusResponse:
return await self._client.request("status.get", {})>>> await client.get_status()
{'version': '0.0.394', 'protocolVersion': 2}This should return GetStatusResponse ?
Could you clarify whether the intended direction is to consistently expose object-based models at the public API level, with dicts treated as an internal detail? @friggeri
Happy to help refactor or align missing response types if this matches the design intent.