• Extracts the first text response from the given OpenAI API response object. If the response does not contain a valid message, throws an error with detailed logging.

    Parameters

    • response: any

      The OpenAI API response object.

    Returns string

    The first text response from the assistant.

    Error if the response does not contain a valid message.