Class Annotation

  • All Implemented Interfaces:

    
    public final class Annotation
    
                        

    A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

    • Constructor Detail

    • Method Detail

      • fileCitation

         final Optional<FileCitationAnnotation> fileCitation()

        A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

      • asFileCitation

         final FileCitationAnnotation asFileCitation()

        A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

      • asFilePath

         final FilePathAnnotation asFilePath()

        A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.

      • accept

         final <T extends Any> T accept(Annotation.Visitor<T> visitor)

        Maps this instance's current variant to a value of type T using the given visitor.

        Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:

        import com.openai.core.JsonValue;
        import java.util.Optional;
        
        Optional<String> result = annotation.accept(new Annotation.Visitor<Optional<String>>() {
            @Override
            public Optional<String> visitFileCitation(FileCitationAnnotation fileCitation) {
                return Optional.of(fileCitation.toString());
            }
        
            // ...
        
            @Override
            public Optional<String> unknown(JsonValue json) {
                // Or inspect the `json`.
                return Optional.empty();
            }
        });
      • validate

         final Annotation validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • ofFileCitation

         final static Annotation ofFileCitation(FileCitationAnnotation fileCitation)

        A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.