Skip to content

fix: preserve MCP session across tool calls #2526

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/openai/lib/streaming/responses/_responses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations


import inspect
from types import TracebackType
from typing import Any, List, Generic, Iterable, Awaitable, cast
Expand Down Expand Up @@ -126,7 +127,8 @@ def __exit__(
exc_tb: TracebackType | None,
) -> None:
if self.__stream is not None:
self.__stream.close()
self.__



class AsyncResponseStream(Generic[TextFormatT]):
Expand Down Expand Up @@ -229,7 +231,7 @@ async def __aexit__(
) -> None:
if self.__stream is not None:
await self.__stream.close()


class ResponseStreamState(Generic[TextFormatT]):
def __init__(
Expand Down Expand Up @@ -301,6 +303,7 @@ def handle_event(self, event: RawResponseStreamEvent) -> List[ResponseStreamEven
output_index=event.output_index,
sequence_number=event.sequence_number,
type="response.function_call_arguments.delta",

snapshot=output.arguments,
)
)
Expand Down