Package com.google.genai
Class AsyncModels
java.lang.Object
com.google.genai.AsyncModels
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateContent(String model, Content content, GenerateContentConfig config) Asynchronously generates content given a GenAI model and a content object.generateContent(String model, String text, GenerateContentConfig config) Asynchronously generates content given a GenAI model and a text string.generateContent(String model, List<Content> contents, GenerateContentConfig config) Asynchronously generates content given a GenAI model and a content object.generateContentStream(String model, Content content, GenerateContentConfig config) Asynchronously generates content with streaming support given a GenAI model and a content object.generateContentStream(String model, String text, GenerateContentConfig config) Asynchronously generates content with streaming support given a GenAI model and a text string.generateContentStream(String model, List<Content> contents, GenerateContentConfig config) Asynchronously generates content with streaming support given a GenAI model and a content object.generateImages(String model, String prompt, GenerateImagesConfig config) upscaleImage(String model, Image image, String upscaleFactor, UpscaleImageConfig config) Asynchronously upscales an image given a GenAI model and an image and an upscale factor.
-
Constructor Details
-
AsyncModels
public AsyncModels(com.google.genai.ApiClient apiClient)
-
-
Method Details
-
generateImages
public CompletableFuture<GenerateImagesResponse> generateImages(String model, String prompt, GenerateImagesConfig config) -
generateContent
public CompletableFuture<GenerateContentResponse> generateContent(String model, List<Content> contents, GenerateContentConfig config) Asynchronously generates content given a GenAI model and a content object.- Parameters:
model- the name of the GenAI model to use for generationcontents- aList<Content>to send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
generateContent
public CompletableFuture<GenerateContentResponse> generateContent(String model, Content content, GenerateContentConfig config) throws IOException, org.apache.http.HttpException Asynchronously generates content given a GenAI model and a content object.- Parameters:
model- the name of the GenAI model to use for generationcontent- aContentto send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
generateContent
public CompletableFuture<GenerateContentResponse> generateContent(String model, String text, GenerateContentConfig config) throws IOException, org.apache.http.HttpException Asynchronously generates content given a GenAI model and a text string.- Parameters:
model- the name of the GenAI model to use for generationtext- the text string to send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
generateContentStream
public CompletableFuture<ResponseStream<GenerateContentResponse>> generateContentStream(String model, List<Content> contents, GenerateContentConfig config) Asynchronously generates content with streaming support given a GenAI model and a content object.- Parameters:
model- the name of the GenAI model to use for generationcontents- aList<Content>to send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
generateContentStream
public CompletableFuture<ResponseStream<GenerateContentResponse>> generateContentStream(String model, Content content, GenerateContentConfig config) throws IOException, org.apache.http.HttpException Asynchronously generates content with streaming support given a GenAI model and a content object.- Parameters:
model- the name of the GenAI model to use for generationcontent- aContentto send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
generateContentStream
public CompletableFuture<ResponseStream<GenerateContentResponse>> generateContentStream(String model, String text, GenerateContentConfig config) throws IOException, org.apache.http.HttpException Asynchronously generates content with streaming support given a GenAI model and a text string.- Parameters:
model- the name of the GenAI model to use for generationtext- the text string to send to the generative modelconfig- aGenerateContentConfiginstance that specifies the optional configurations- Returns:
- a
GenerateContentResponseinstance that contains response contents and other metadata - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-
upscaleImage
public CompletableFuture<UpscaleImageResponse> upscaleImage(String model, Image image, String upscaleFactor, UpscaleImageConfig config) throws IOException, org.apache.http.HttpException Asynchronously upscales an image given a GenAI model and an image and an upscale factor.- Parameters:
model- the name of the GenAI model to use for upscalingimage- aImageto send to the generative modelupscaleFactor- the factor to upscale the imageconfig- aUpscaleImageConfiginstance that specifies the optional configurations- Returns:
- a
UpscaleImageResponseinstance that contains the upscaled image. - Throws:
IOException- if an I/O error occurs while making the API callorg.apache.http.HttpException- if an HTTP error occurs while making the API call
-