Skip to content

Commit

Permalink
Improve comments around executor usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazo committed Jun 13, 2024
1 parent 10da9cd commit 9aa0765
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void chat() {
userMessageBuilder.addText("How many paws are in my house?");
Content userMessage = userMessageBuilder.build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

// Send the message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void tokensTextOnly() {
Content inputContent =
new Content.Builder().addText("Write a story about a magic backpack.").build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

// For text-only input
Expand Down Expand Up @@ -103,7 +103,7 @@ void tokensChat() {

Collections.addAll(history, messageContent);

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

ListenableFuture<CountTokensResponse> countTokensResponse =
Expand Down Expand Up @@ -137,7 +137,7 @@ void tokensMultimodalImageInline(Context context) {
GenerativeModelFutures model = GenerativeModelFutures.from(gm);
Content text = new Content.Builder().addText("Write a story about a magic backpack.").build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

// For text-and-image input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void TextGenTextOnlyPrompt() {
Content content =
new Content.Builder().addText("Write a story about a magic backpack.").build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

ListenableFuture<GenerateContentResponse> response = model.generateContent(content);
Expand Down Expand Up @@ -131,7 +131,7 @@ void TextGenMultimodalOneImagePrompt(Context context) {
.addImage(image)
.build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

ListenableFuture<GenerateContentResponse> response = model.generateContent(content);
Expand Down Expand Up @@ -174,7 +174,7 @@ void TextGenMultimodalOneImagePromptStreaming(Context context) {
.addImage(image2)
.build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

Publisher<GenerateContentResponse> streamingResponse = model.generateContentStream(content);
Expand Down Expand Up @@ -228,7 +228,7 @@ void TextGenMultimodalMultiImagePrompt(Context context) {
.addImage(image2)
.build();

// TODO COMMENT
// For illustrative purposes only. You should use an executor that fits your needs.
Executor executor = Executors.newSingleThreadExecutor();

ListenableFuture<GenerateContentResponse> response = model.generateContent(content);
Expand Down

0 comments on commit 9aa0765

Please sign in to comment.