> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# response_generator

## ResponseGeneratorSync

A wrapper for OpenAI streaming responses that logs the response to Splunk AO.

This class wraps the OpenAI streaming response generator and logs the response
to Splunk AO when the generator is exhausted. It implements the iterator protocol
to allow for streaming responses.

**Arguments**

* `resource` (`OpenAiModuleDefinition`): The OpenAI resource definition.

* `response` (`Generator or openai.Stream`): The OpenAI streaming response.

* `input_data` (`OpenAiInputData`): The input data for the OpenAI request.

* `logger` (`SplunkAOLogger`): The Splunk AO logger instance.

* `should_complete_trace` (`bool`): Whether to complete the trace when the generator is exhausted.
