This commit refactors getContentFromChatResponse to use Java's Optional for null handling. Initially, the method relied on explicit null checks for ChatResponse and its nested properties.

By replacing these with Optional chaining, the code is more streamlined, following Java 8+ best practices for handling nulls. This improves readability and reduces clutter from traditional null - checking.

Now, Optional.ofNullable safely manages the ChatResponse object, and map operations traverse nested objects, gracefully returning null if any link in the chain is null.