Transformers

@InternalApi()
public final class Transformers

Transformers for GenAI SDK.

Functions

Link copied to clipboard
public static String camelToSnake(String str)
Converts a camelCase string to snake_case.
Link copied to clipboard
public static Blob tAudioBlob(Object blob)
Transforms a blob to an audio blob, validating its mime type.
Link copied to clipboard
public static Object tBatchJobDestination(Object dest)
Link copied to clipboard
public static String tBatchJobName(ApiClient apiClient, Object name)
It validates and extracts the batch job name based on the backend (Vertex AI or MLDev).
Link copied to clipboard
public static Object tBatchJobSource(Object src)
Link copied to clipboard
public static Blob tBlob(Object blob)
Link copied to clipboard
public static ArrayNode tBlobs(Object origin)
Dummy Blobs transformer.
Link copied to clipboard
public static Object tBytes(Object origin)
Dummy bytes transformer.
Link copied to clipboard
public static String tCachedContentName(ApiClient apiClient, Object origin)
Transforms an object to a cached content name for the API.
Link copied to clipboard
@Nullable()
public static @Nullable() String tCachesModel(ApiClient apiClient, Object origin)
Transforms a model name to the correct format for the Caches API.
Link copied to clipboard
public static Content tContent(Object content)
Transforms an object to a Content for the API.
Link copied to clipboard
public static ImmutableList<Content> tContents(Content content)
Transforms a Content to a list of Content for the API.
public static Object tContents(Object origin)
In other languages, this transformer is used for supporting union types.
public static ImmutableList<Content> tContents(String text)
Transforms a text string to a list of Content for the API.
Link copied to clipboard
@Nullable()
public static @Nullable() List<Object> tContentsForEmbed(ApiClient apiClient, Object origin)
Transforms an object to a list of Content for the embedding API.
Link copied to clipboard
@Nullable()
public static @Nullable() JsonNode tExtractModels(Object origin)
Extracts the models from the models.list response.
Link copied to clipboard
@Nullable()
public static @Nullable() String tFileName(Object origin)
Link copied to clipboard
public static Blob tImageBlob(Object blob)
Transforms a blob to an image blob, validating its mime type.
Link copied to clipboard
public static boolean tIsVertexEmbedContentModel(String model)
Checks if a given model name is a Vertex AI embed content model.
Link copied to clipboard
public static Object tJobState(Object state)
Maps specific batch states to job states, otherwise returns the state as is.
Link copied to clipboard
@Nullable()
public static @Nullable() SpeechConfig tLiveSpeechConfig(Object origin)
Transforms a SpeechConfig object for the live API, validating it.
Link copied to clipboard
public static ArrayNode tMetrics(Object metrics)
Prepares the metric payload for the evaluation request.
Link copied to clipboard
public static String tModel(ApiClient apiClient, Object origin)
Transforms a model name to the correct format for the API.
Link copied to clipboard
public static String tModelsUrl(ApiClient apiClient, @Nullable() Object baseModels)
Determines the appropriate models URL based on the API client type and whether base models are requested.
Link copied to clipboard
public static Object tRecvBatchJobDestination(Object dest)
Link copied to clipboard
public static Schema tSchema(Object origin)
Transforms an object to a Schema for the API.
Link copied to clipboard
public static SpeechConfig tSpeechConfig(Object speechConfig)
Link copied to clipboard
public static Tool tTool(Object origin)
Transforms an object to a Tool for the API.
Link copied to clipboard
public static Object tTools(Object origin)
In other languages, this transformer is used for supporting union types.
Link copied to clipboard
public static JobState tTuningJobStatus(Object origin)
Link copied to clipboard
public static void updateJsonNode(ObjectNode currentObject, String keyToSet, JsonNode valueNode)
Updates a JSON node with a new value, handling potential conflicts.