-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(sessions): add offset parameter to get_items() for pagination #2878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,8 +239,10 @@ async def run_compaction(self, args: OpenAIResponsesCompactionArgs | None = None | |
| f"candidates={len(self._compaction_candidate_items)})" | ||
| ) | ||
|
|
||
| async def get_items(self, limit: int | None = None) -> list[TResponseInputItem]: | ||
| return await self.underlying_session.get_items(limit) | ||
| async def get_items( | ||
| self, limit: int | None = None, offset: int = 0 | ||
| ) -> list[TResponseInputItem]: | ||
| return await self.underlying_session.get_items(limit, offset) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This positional forward has the same compatibility regression: wrapped sessions with a non- Useful? React with 👍 / 👎. |
||
|
|
||
| async def _defer_compaction(self, response_id: str, store: bool | None = None) -> None: | ||
| if self._deferred_response_id is not None: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forwarding
limitandoffsetpositionally here breaks wrapped sessions whose second positional parameter is notoffset(notablyAdvancedSQLiteSession, where it isbranch_id) and can also raiseTypeErrorfor custom sessions that still accept onlylimitor makeoffsetkeyword-only. This meansEncryptedSession.get_items()can silently fetch the wrong history (often empty) even with default arguments; forward using keywords to preserve compatibility.Useful? React with 👍 / 👎.