> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/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 Galileo.

This class wraps the OpenAI streaming response generator and logs the response
to Galileo 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` (`GalileoLogger`): The Galileo logger instance.

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