Skip to content

Commit d9cd39b

Browse files
committed
fix
1 parent 0f1c99d commit d9cd39b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/agents/memory/openai_conversations_session.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional
1+
from __future__ import annotations
22

33
from openai import AsyncOpenAI
44

@@ -8,7 +8,7 @@
88
from .session import SessionABC
99

1010

11-
async def start_openai_conversations_session(openai_client: Optional[AsyncOpenAI] = None) -> str:
11+
async def start_openai_conversations_session(openai_client: AsyncOpenAI | None = None) -> str:
1212
_maybe_openai_client = openai_client
1313
if openai_client is None:
1414
_maybe_openai_client = get_default_openai_client() or AsyncOpenAI()
@@ -26,8 +26,8 @@ class OpenAIConversationsSession(SessionABC):
2626
def __init__(
2727
self,
2828
*,
29-
session_id: Optional[str] = None,
30-
openai_client: Optional[AsyncOpenAI] = None,
29+
session_id: str | None = None,
30+
openai_client: AsyncOpenAI | None = None,
3131
):
3232
# this implementation allows to set this value later
3333
self.session_id = session_id or _EMPTY_SESSION_ID
@@ -41,7 +41,7 @@ async def _ensure_session_id(self) -> None:
4141
if self.session_id == _EMPTY_SESSION_ID:
4242
self.session_id = await start_openai_conversations_session(self.openai_client)
4343

44-
async def get_items(self, limit: Optional[int] = None) -> list[TResponseInputItem]:
44+
async def get_items(self, limit: int | None = None) -> list[TResponseInputItem]:
4545
await self._ensure_session_id()
4646

4747
all_items = []
@@ -73,7 +73,7 @@ async def add_items(self, items: list[TResponseInputItem]) -> None:
7373
items=items,
7474
)
7575

76-
async def pop_item(self) -> Optional[TResponseInputItem]:
76+
async def pop_item(self) -> TResponseInputItem | None:
7777
await self._ensure_session_id()
7878
items = await self.get_items(limit=1)
7979
if not items:

0 commit comments

Comments
 (0)