Interface ModelResponse<T extends ModelResult<?>>

Type Parameters:
T - the type of the result(s) provided by the AI model
All Known Implementing Classes:
AudioTranscriptionResponse, ChatResponse, EmbeddingResponse, ImageResponse, ModerationResponse, TextToSpeechResponse

public interface ModelResponse<T extends ModelResult<?>>
Interface representing the response received from an AI model. This interface provides methods to access the main result or a list of results generated by the AI model, along with the response metadata. It serves as a standardized way to encapsulate and manage the output from AI models, ensuring easy retrieval and processing of the generated information.
Since:
0.8.0
Author:
Mark Pollack
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the response metadata associated with the AI model's response.
    @Nullable T
    Retrieves the (first) result of the AI model.
    Retrieves the list of generated outputs by the AI model.
  • Method Details

    • getResult

      @Nullable T getResult()
      Retrieves the (first) result of the AI model.
      Returns:
      the result generated by the AI model
    • getResults

      List<T> getResults()
      Retrieves the list of generated outputs by the AI model.
      Returns:
      the list of generated outputs
    • getMetadata

      ResponseMetadata getMetadata()
      Retrieves the response metadata associated with the AI model's response.
      Returns:
      the response metadata