diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ContentMaker.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ContentMaker.java index 33e55e0fca47..e9338b91eb50 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ContentMaker.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ContentMaker.java @@ -24,7 +24,7 @@ public class ContentMaker { private static String role = "user"; /** - * Create a ContentMakerForRole for a given role. + * Creates a ContentMakerForRole for a given role. * * @param role Currently accepted role values are: "user", "model". No need to call forRole for * the "user" role since it's the default role. @@ -53,7 +53,7 @@ private static Content fromMultiModalDataWithRole(String role, Object... multiMo } /** - * Create a content from a string, assuming the role is "user". + * Creates a content from a string, assuming the role is "user". * *

The resulting content will contain one single {@link com.google.cloud.vertexai.api.Part} * with its text field set. @@ -65,7 +65,7 @@ public static Content fromString(String text) { } /** - * Create a content from an array of Objects, assuming the role is "user". + * Creates a content from an array of Objects, assuming the role is "user". * *

The resulting content can contain multiple {@link com.google.cloud.vertexai.api.Part}s. Each * element in the array becomes one part. @@ -91,7 +91,7 @@ private ContentMakerForRole(String role) { } /** - * Create a content from a string. + * Creates a content from a string. * * @param text a string which will be converted to a {@link com.google.cloud.vertexai.api.Part} * with its text field set. @@ -101,7 +101,7 @@ public Content fromString(String text) { } /** - * Create a content from an array of Objects. + * Creates a content from an array of Objects. * * @param multiModalData an array which contains the actual payload of each part. The element * could be either a single String or a Part. When it's a single string, it's converted to a diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerateContentConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerateContentConfig.java index 4c3a41ec3cb0..05ebcfdb72da 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerateContentConfig.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerateContentConfig.java @@ -66,7 +66,7 @@ public GenerateContentConfig build() { } /** - * Set {@link com.google.cloud.vertexai.api.GenerationConfig} that will be used in the generate + * Sets {@link com.google.cloud.vertexai.api.GenerationConfig} that will be used in the generate * content API call. * * @return builder for the GenerateContentConfig @@ -78,7 +78,7 @@ public Builder setGenerationConfig(GenerationConfig generationConfig) { } /** - * Set a list of {@link com.google.cloud.vertexai.api.SafetySetting} that will be used in the + * Sets a list of {@link com.google.cloud.vertexai.api.SafetySetting} that will be used in the * generate content API call. * * @return builder for the GenerateContentConfig @@ -90,7 +90,7 @@ public Builder setSafetySettings(List safetySettings) { } /** - * Set a list of {@link com.google.cloud.vertexai.api.Tool} that will be used in the generate + * Sets a list of {@link com.google.cloud.vertexai.api.Tool} that will be used in the generate * content API call. * * @return builder for the GenerateContentConfig diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java index 3b2f3dfcafed..24bc5af76f3a 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java @@ -99,7 +99,7 @@ public GenerativeModel build() { } /** - * Set the name of the generative model. This is required for building a GenerativeModel + * Sets the name of the generative model. This is required for building a GenerativeModel * instance. Supported format: "gemini-pro", "models/gemini-pro", * "publishers/google/models/gemini-pro", where "gemini-pro" is the model name. Valid model * names can be found at @@ -111,7 +111,7 @@ public Builder setModelName(String modelName) { } /** - * Set {@link com.google.cloud.vertexai.VertexAI} that contains the default configs for the + * Sets {@link com.google.cloud.vertexai.VertexAI} that contains the default configs for the * generative model. This is required for building a GenerativeModel instance. */ public Builder setVertexAi(VertexAI vertexAi) { @@ -120,7 +120,7 @@ public Builder setVertexAi(VertexAI vertexAi) { } /** - * Set {@link com.google.cloud.vertexai.api.GenerationConfig} that will be used by default to + * Sets {@link com.google.cloud.vertexai.api.GenerationConfig} that will be used by default to * interact with the generative model. */ @BetaApi @@ -130,7 +130,7 @@ public Builder setGenerationConfig(GenerationConfig generationConfig) { } /** - * Set a list of {@link com.google.cloud.vertexai.api.SafetySetting} that will be used by + * Sets a list of {@link com.google.cloud.vertexai.api.SafetySetting} that will be used by * default to interact with the generative model. */ @BetaApi @@ -145,7 +145,7 @@ public Builder setSafetySettings(List safetySettings) { } /** - * Set a list of {@link com.google.cloud.vertexai.api.Tool} that will be used by default to + * Sets a list of {@link com.google.cloud.vertexai.api.Tool} that will be used by default to * interact with the generative model. */ @BetaApi @@ -160,7 +160,7 @@ public Builder setTools(List tools) { } /** - * Set the {@link Transport} layer for API calls in the generative model. It overrides the + * Sets the {@link Transport} layer for API calls in the generative model. It overrides the * transport setting in {@link com.google.cloud.vertexai.VertexAI} */ public Builder setTransport(Transport transport) { @@ -170,7 +170,7 @@ public Builder setTransport(Transport transport) { } /** - * Construct a GenerativeModel instance. + * Constructs a GenerativeModel instance. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro", where "gemini-pro" is the model @@ -184,7 +184,7 @@ public GenerativeModel(String modelName, VertexAI vertexAi) { } /** - * Construct a GenerativeModel instance. + * Constructs a GenerativeModel instance. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -198,7 +198,7 @@ public GenerativeModel(String modelName, VertexAI vertexAi, Transport transport) } /** - * Construct a GenerativeModel instance with default generation config. + * Constructs a GenerativeModel instance with default generation config. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -213,7 +213,7 @@ public GenerativeModel(String modelName, GenerationConfig generationConfig, Vert } /** - * Construct a GenerativeModel instance with default generation config. + * Constructs a GenerativeModel instance with default generation config. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -231,7 +231,7 @@ public GenerativeModel( } /** - * Construct a GenerativeModel instance with default safety settings. + * Constructs a GenerativeModel instance with default safety settings. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -246,7 +246,7 @@ public GenerativeModel(String modelName, List safetySettings, Ver } /** - * Construct a GenerativeModel instance with default safety settings. + * Constructs a GenerativeModel instance with default safety settings. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -267,7 +267,7 @@ public GenerativeModel( } /** - * Construct a GenerativeModel instance with default generation config and safety settings. + * Constructs a GenerativeModel instance with default generation config and safety settings. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -288,7 +288,7 @@ public GenerativeModel( } /** - * Construct a GenerativeModel instance with default generation config and safety settings. + * Constructs a GenerativeModel instance with default generation config and safety settings. * * @param modelName the name of the generative model. Supported format: "gemini-pro", * "models/gemini-pro", "publishers/google/models/gemini-pro" @@ -332,7 +332,7 @@ public GenerativeModel( } /** - * Count tokens in a text message. + * Counts tokens in a text message. * * @param text a text message to count tokens * @return a {@link com.google.cloud.vertexai.api.CountTokensResponse} instance that contains the @@ -348,7 +348,7 @@ public CountTokensResponse countTokens(String text) throws IOException { } /** - * Count tokens in a single content. + * Counts tokens in a single content. * * @param content a {@link com.google.cloud.vertexai.api.Content} to count tokens * @return a {@link com.google.cloud.vertexai.api.CountTokensResponse} instance that contains the @@ -361,7 +361,7 @@ public CountTokensResponse countTokens(Content content) throws IOException { } /** - * Count tokens in a list of contents. + * Counts tokens in a list of contents. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to count tokens * @return a {@link com.google.cloud.vertexai.api.CountTokensResponse} instance that contains the @@ -376,7 +376,7 @@ public CountTokensResponse countTokens(List contents) throws IOExceptio } /** - * Send CountTokensRequest given a request builder. + * Sends CountTokensRequest given a request builder. * * @param requestBuilder a {@link com.google.cloud.vertexai.api.CountTokensRequest.Builder} that * contains a list of contents @@ -397,7 +397,7 @@ private CountTokensResponse countTokensFromBuilder(CountTokensRequest.Builder re } /** - * Generate content from generative model given a text. + * Generates content from generative model given a text. * * @param text a text message to send to the generative model * @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains @@ -426,7 +426,7 @@ public GenerateContentResponse generateContent(String text, GenerateContentConfi } /** - * Generate content from generative model given a text and generation config. + * Generates content from generative model given a text and generation config. * * @param text a text message to send to the generative model * @param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} instance for @@ -444,7 +444,7 @@ public GenerateContentResponse generateContent(String text, GenerationConfig gen } /** - * Generate content from generative model given a text and safety settings. + * Generates content from generative model given a text and safety settings. * * @param text a text message to send to the generative model * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} for @@ -462,7 +462,7 @@ public GenerateContentResponse generateContent(String text, List } /** - * Generate content from generative model given a text, generation config, and safety settings. + * Generates content from generative model given a text, generation config, and safety settings. * * @param text a text message to send to the generative model * @param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} instance for @@ -486,7 +486,7 @@ public GenerateContentResponse generateContent( } /** - * Generate content from this model given a list of contents. + * Generates content from this model given a list of contents. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the * generative model @@ -500,7 +500,7 @@ public GenerateContentResponse generateContent(List contents) throws IO } /** - * Generate content from this model given a list of contents and generation config. + * Generates content from this model given a list of contents and generation config. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the * generative model @@ -519,7 +519,7 @@ public GenerateContentResponse generateContent( } /** - * Generate content from this model given a list of contents and safety settings. + * Generates content from this model given a list of contents and safety settings. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the * generative model @@ -573,7 +573,7 @@ public GenerateContentResponse generateContent( } /** - * Generate content from generative model given a list of contents, generation config, and safety + * Generates content from generative model given a list of contents, generation config, and safety * settings. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the @@ -632,7 +632,7 @@ private GenerateContentResponse generateContent(GenerateContentRequest.Builder r } /** - * Generate content from this model given a single content. + * Generates content from this model given a single content. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model * @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains @@ -661,7 +661,7 @@ public GenerateContentResponse generateContent(Content content, GenerateContentC } /** - * Generate content from this model given a single content and generation config. + * Generates content from this model given a single content and generation config. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model * @param generationConfig a {@link com.google.cloud.vertexai.api.GenerationConfig} instance for @@ -679,7 +679,7 @@ public GenerateContentResponse generateContent(Content content, GenerationConfig } /** - * Generate content from this model given a single content and safety settings. + * Generates content from this model given a single content and safety settings. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} for @@ -697,7 +697,7 @@ public GenerateContentResponse generateContent( } /** - * Generate content from generative model given a single content, generation config, and safety + * Generates content from generative model given a single content, generation config, and safety * settings. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model @@ -719,7 +719,7 @@ public GenerateContentResponse generateContent( } /** - * Generate content with streaming support from generative model given a text. + * Generates content with streaming support from generative model given a text. * * @param text a text message to send to the generative model * @return a {@link ResponseStream} that contains a streaming of {@link @@ -732,7 +732,7 @@ public ResponseStream generateContentStream(String text } /** - * Generate content with streaming support from generative model given a text and configs. + * Generates content with streaming support from generative model given a text and configs. * * @param text a text message to send to the generative model * @param config a {@link GenerateContentConfig} that contains all the configs in making a @@ -747,7 +747,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a text and generation + * Generates content with streaming support from generative model given a text and generation * config. * * @param text a text message to send to the generative model @@ -766,7 +766,8 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a text and safety settings. + * Generates content with streaming support from generative model given a text and safety + * settings. * * @param text a text message to send to the generative model * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} for @@ -784,7 +785,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a text, generation config, + * Generates content with streaming support from generative model given a text, generation config, * and safety settings. * * @param text a text message to send to the generative model @@ -809,7 +810,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a single Content. + * Generates content with streaming support from generative model given a single Content. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model. * The role of the content is "user". @@ -823,7 +824,7 @@ public ResponseStream generateContentStream(Content con } /** - * Generate content with streaming support from generative model given a single content and + * Generates content with streaming support from generative model given a single content and * configs. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model @@ -839,7 +840,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a single Content and + * Generates content with streaming support from generative model given a single Content and * generation config. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model @@ -858,8 +859,8 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a single content and safety - * settings. + * Generates content with streaming support from generative model given a single content and + * safety settings. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model * @param safetySettings a list of {@link com.google.cloud.vertexai.api.SafetySetting} for @@ -877,7 +878,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a single content, + * Generates content with streaming support from generative model given a single content, * generation config, and safety settings. * * @param content a {@link com.google.cloud.vertexai.api.Content} to send to the generative model @@ -899,7 +900,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a list of contents. + * Generates content with streaming support from generative model given a list of contents. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the * generative model @@ -913,7 +914,7 @@ public ResponseStream generateContentStream(List generateContentStream( } /** - * Generate content with streaming support from generative model given a list of contents and + * Generates content with streaming support from generative model given a list of contents and * safety settings. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the @@ -953,7 +954,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a list of contents, + * Generates content with streaming support from generative model given a list of contents, * generation config, and safety settings. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the @@ -991,7 +992,7 @@ public ResponseStream generateContentStream( } /** - * Generate content with streaming support from generative model given a list of contents and + * Generates content with streaming support from generative model given a list of contents and * configs. * * @param contents a list of {@link com.google.cloud.vertexai.api.Content} to send to the @@ -1145,7 +1146,7 @@ public ChatSession startChat() { return new ChatSession(this); } - /** Keep the model name only, if users specify the resource name, and returns the model name. */ + /** Keeps the model name only, if users specify the resource name, and returns the model name. */ private static String reconcileModelName(String modelName) { for (String prefix : Constants.MODEL_NAME_PREFIXES) { if (modelName.startsWith(prefix)) { diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/PartMaker.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/PartMaker.java index 32ed3b52a947..db4d5b12a155 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/PartMaker.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/PartMaker.java @@ -33,7 +33,7 @@ public class PartMaker { private PartMaker() {} /** - * Make a {@link com.google.cloud.vertexai.api.Part} from mimeType and data (or link to the data). + * Makes a {@link com.google.cloud.vertexai.api.Part} from mimeType and data (or link to the data). * * @param mimeType currently accepted values are "image/png", "image/jpeg", "video/mp4", * "video/mpeg", "video/quicktime", "video/x-msvideo", "video/x-ms-wmv", "video/x-flv" @@ -84,7 +84,7 @@ public static Part fromMimeTypeAndData(String mimeType, Object partData) { } /** - * Make a {@link com.google.cloud.vertexai.api.Part} from the output of {@link + * Makes a {@link com.google.cloud.vertexai.api.Part} from the output of {@link * com.google.cloud.vertexai.api.FunctionCall}. * * @param name a string represents the name of the {@link @@ -98,7 +98,7 @@ public static Part fromFunctionResponse(String name, Struct response) { } /** - * Make a {@link com.google.cloud.vertexai.api.Part} from the result output of {@link + * Makes a {@link com.google.cloud.vertexai.api.Part} from the result output of {@link * com.google.cloud.vertexai.api.FunctionCall}. * * @param name a string represents the name of the {@link diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseHandler.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseHandler.java index 7f9e5f616da5..fe10c00daccc 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseHandler.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseHandler.java @@ -33,7 +33,7 @@ public class ResponseHandler { /** - * Get the text message in a GenerateContentResponse. + * Gets the text message in a GenerateContentResponse. * * @param response a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance * @return a String that aggregates all the text parts in the response @@ -58,7 +58,7 @@ public static String getText(GenerateContentResponse response) { } /** - * Get the content in a GenerateContentResponse. + * Gets the content in a GenerateContentResponse. * * @param response a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance * @return the {@link com.google.cloud.vertexai.api.Content} in the response @@ -77,7 +77,7 @@ public static Content getContent(GenerateContentResponse response) { } /** - * Get the finish reason in a GenerateContentResponse. + * Gets the finish reason in a GenerateContentResponse. * * @param response a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance * @return the {@link com.google.cloud.vertexai.api.FinishReason} in the response @@ -93,7 +93,7 @@ public static FinishReason getFinishReason(GenerateContentResponse response) { return response.getCandidates(0).getFinishReason(); } - /** Aggregate a stream of responses into a single GenerateContentResponse. */ + /** Aggregates a stream of responses into a single GenerateContentResponse. */ static GenerateContentResponse aggregateStreamIntoResponse( ResponseStream responseStream) { GenerateContentResponse res = GenerateContentResponse.getDefaultInstance(); diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStream.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStream.java index d1371dc4460f..b789588fae72 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStream.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStream.java @@ -43,7 +43,7 @@ public Iterator iterator() throws IllegalStateException } } - /** Make a stream from the instance. */ + /** Makes a stream from the instance. */ public Stream stream() { return StreamSupport.stream(this.spliterator(), false); } diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStreamIteratorWithHistory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStreamIteratorWithHistory.java index a97432af4ce0..16a5db5ba9af 100644 --- a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStreamIteratorWithHistory.java +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStreamIteratorWithHistory.java @@ -46,7 +46,7 @@ public GenerateContentResponse next() { return nextItem; } - /** Retrieve all the chunks in a stream of responses. */ + /** Retrieves all the chunks in a stream of responses. */ public List getHistory() { return history; }