diff --git a/src/pipecat/adapters/services/open_ai_responses_adapter.py b/src/pipecat/adapters/services/open_ai_responses_adapter.py index 01e6a7503..4f88e028d 100644 --- a/src/pipecat/adapters/services/open_ai_responses_adapter.py +++ b/src/pipecat/adapters/services/open_ai_responses_adapter.py @@ -79,9 +79,19 @@ class OpenAIResponsesLLMAdapter(BaseLLMAdapter[OpenAIResponsesLLMInvocationParam # message when instructions are provided. Contexts that worked with # OpenAILLMService (system_instruction + empty messages) need the # instructions converted to an initial developer message. - # NOTE: once we support `previous_response_id`, we need to revisit + # + # NOTE: if/when we support `previous_response_id`, we'll need to revisit # this logic, as it'll be legit to provide instructions without input - # items if `previous_response_id` is provided. + # items if `previous_response_id` is provided. Though...OpenAI's docs + + # ChatGPT suggests that `previous_response_id` is primarily for + # development convenience, not performance (other than minor bandwidth + # savings from not transferring the full context), as the model still + # processes the full context from the previous response. The tradeoff + # of using `previous_response_id` is that it requires enabling OpenAI-side + # 30-day conversation storage (meaning we couldn't do `store=False` + # in the API call), which may not be desirable for all users. So, + # my guess is we won't need to support `previous_response_id` in the + # immediate future. if not input_items: params["input"] = [{"role": "developer", "content": system_instruction}] else: diff --git a/src/pipecat/services/openai/responses/llm.py b/src/pipecat/services/openai/responses/llm.py index e0a3e4428..fd1d711cc 100644 --- a/src/pipecat/services/openai/responses/llm.py +++ b/src/pipecat/services/openai/responses/llm.py @@ -324,6 +324,7 @@ class OpenAIResponsesLLMService(LLMService): params: Dict[str, Any] = { "model": self._settings.model, "stream": True, + "store": False, "input": invocation_params["input"], } diff --git a/tests/test_run_inference.py b/tests/test_run_inference.py index e01d7b36d..f67c725ae 100644 --- a/tests/test_run_inference.py +++ b/tests/test_run_inference.py @@ -801,6 +801,7 @@ async def test_openai_responses_run_inference_with_llm_context(): call_kwargs = service._client.responses.create.call_args.kwargs assert call_kwargs["model"] == "gpt-4.1" assert call_kwargs["stream"] is False + assert call_kwargs["store"] is False assert call_kwargs["input"] == [{"role": "user", "content": "Hello, world!"}] assert call_kwargs["instructions"] == "You are a helpful assistant" assert call_kwargs["temperature"] == 0.7