File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -227,27 +227,28 @@ if __name__ == "__main__":
227
227
You can implement your own session memory by creating a class that follows the [ ` Session ` ] [ agents.memory.session.Session ] protocol:
228
228
229
229
``` python
230
- from agents.memory import Session
230
+ from agents.memory.session import SessionABC
231
+ from agents.items import TResponseInputItem
231
232
from typing import List
232
233
233
- class MyCustomSession :
234
+ class MyCustomSession ( SessionABC ) :
234
235
""" Custom session implementation following the Session protocol."""
235
236
236
237
def __init__ (self , session_id : str ):
237
238
self .session_id = session_id
238
239
# Your initialization here
239
240
240
- async def get_items (self , limit : int | None = None ) -> List[dict ]:
241
+ async def get_items (self , limit : int | None = None ) -> List[TResponseInputItem ]:
241
242
""" Retrieve conversation history for this session."""
242
243
# Your implementation here
243
244
pass
244
245
245
- async def add_items (self , items : List[dict ]) -> None :
246
+ async def add_items (self , items : List[TResponseInputItem ]) -> None :
246
247
""" Store new items for this session."""
247
248
# Your implementation here
248
249
pass
249
250
250
- async def pop_item (self ) -> dict | None :
251
+ async def pop_item (self ) -> TResponseInputItem | None :
251
252
""" Remove and return the most recent item from this session."""
252
253
# Your implementation here
253
254
pass
You can’t perform that action at this time.
0 commit comments