|
2 | 2 | from typing import Optional |
3 | 3 | from pydantic import BaseModel, Field |
4 | 4 | from src.client.obp_client import OBPClient |
| 5 | +import json |
5 | 6 |
|
6 | 7 | class OpeyCheckpointEntity(BaseModel): |
7 | 8 | """OBP Dynamic Entity representation of a LangGraph checkpoint.""" |
@@ -73,26 +74,21 @@ def __init__(self, obp_client: OBPClient, endpoint_url: str): |
73 | 74 |
|
74 | 75 |
|
75 | 76 | async def create(self, entity: OpeyCheckpointEntity | OpeyCheckpointWriteEntity): |
76 | | - await self.client.async_obp_requests( |
77 | | - method="POST", |
78 | | - body=str(entity.model_dump()), |
79 | | - path=self.endpoint_url |
| 77 | + await self.client.post( |
| 78 | + path=self.endpoint_url, |
| 79 | + body=entity.model_dump() |
80 | 80 | ) |
81 | 81 |
|
82 | 82 | async def delete(self, entity_id: str): |
83 | | - await self.client.async_obp_requests( |
84 | | - method="DELETE", |
85 | | - body="", |
| 83 | + await self.client.delete( |
86 | 84 | path=f"{self.endpoint_url}/{entity_id}" |
87 | 85 | ) |
88 | 86 |
|
89 | 87 | async def read(self, entity_id: str) -> dict: |
90 | | - response = await self.client.async_obp_requests( |
91 | | - method="GET", |
92 | | - body="", |
| 88 | + response = await self.client.get( |
93 | 89 | path=f"{self.endpoint_url}/{entity_id}" |
94 | 90 | ) |
95 | | - return response |
| 91 | + return json.loads(response) if isinstance(response, str) else response |
96 | 92 |
|
97 | 93 | opey_checkpoint_entity = { |
98 | 94 | "hasPersonalEntity": True, |
|
0 commit comments