getContent does not return the content of the body but the remaining content of the stream.
If you were to use OpenAI::factory with withHttpClient and, for example, a logging middleware, getContent would return an empty string since the stream was already read by the log middleware.
getContent
does not return the content of the body but the remaining content of the stream.If you were to use
OpenAI::factory
withwithHttpClient
and, for example, a logging middleware,getContent
would return an empty string since the stream was already read by the log middleware.See:
https://www.php-fig.org/psr/psr-7/ https://stackoverflow.com/questions/30549226/guzzlehttp-how-get-the-body-of-a-response-from-guzzle-6