Skip to content

Commit 3e7f6c8

Browse files
author
David Grieve
authored
Eliminate javadoc warnings (#246)
* fix javadoc warnings in semantickernel-api * fix javadoc warnings in aiservices/google * fix javadoc warnings in aiservices/huggingface * fix javadoc warnings in aiservices/openai * fix javadoc warnings in semantickernel-experimental * HuggingFaceClient Builder missing 'public'
1 parent 607db38 commit 3e7f6c8

File tree

128 files changed

+1431
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1431
-64
lines changed

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/GeminiService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@
66

77
import javax.annotation.Nullable;
88

9+
10+
/**
11+
* Makes a Gemini service available to the Semantic Kernel.
12+
*/
913
public class GeminiService implements AIService {
1014
private final VertexAI client;
1115
private final String modelId;
1216

17+
/**
18+
* Creates a new Gemini service.
19+
* @param client The VertexAI client
20+
* @param modelId The Gemini model ID
21+
*/
1322
protected GeminiService(VertexAI client, String modelId) {
1423
this.client = client;
1524
this.modelId = modelId;
@@ -27,6 +36,10 @@ public String getServiceId() {
2736
return null;
2837
}
2938

39+
/**
40+
* Gets the VertexAI client.
41+
* @return The VertexAI client
42+
*/
3043
protected VertexAI getClient() {
3144
return client;
3245
}

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/GeminiServiceBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* Builder for a Gemini service.
10+
* @param <T> The type of the service
11+
* @param <U> The type of the builder
1012
*/
1113
public abstract class GeminiServiceBuilder<T, U extends GeminiServiceBuilder<T, U>> implements
1214
SemanticKernelBuilder<T> {

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/chatcompletion/GeminiChatCompletion.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,23 @@
5050
import reactor.core.publisher.Flux;
5151
import reactor.core.publisher.Mono;
5252

53+
54+
/**
55+
* A chat completion service that uses the Gemini model to generate chat completions.
56+
*/
5357
public class GeminiChatCompletion extends GeminiService implements ChatCompletionService {
5458

5559
private static final Logger LOGGER = LoggerFactory.getLogger(GeminiChatCompletion.class);
5660

61+
/**
62+
* Constructor for {@link GeminiChatCompletion}.
63+
* @param client The VertexAI client
64+
* @param modelId The model ID
65+
*/
5766
public GeminiChatCompletion(VertexAI client, String modelId) {
5867
super(client, modelId);
5968
}
60-
69+
6170
/**
6271
* Create a new instance of {@link GeminiChatCompletion.Builder}.
6372
*
@@ -391,6 +400,13 @@ private Tool getTool(@Nullable Kernel kernel, @Nullable ToolCallBehavior toolCal
391400
return toolBuilder.build();
392401
}
393402

403+
/**
404+
* Invoke the Gemini function call.
405+
* @param kernel The semantic kernel
406+
* @param invocationContext Additional context for the invocation
407+
* @param geminiFunction The Gemini function call
408+
* @return The result of the function call
409+
*/
394410
public Mono<GeminiFunctionCall> performFunctionCall(@Nullable Kernel kernel,
395411
@Nullable InvocationContext invocationContext, GeminiFunctionCall geminiFunction) {
396412
if (kernel == null) {
@@ -433,6 +449,9 @@ public Mono<GeminiFunctionCall> performFunctionCall(@Nullable Kernel kernel,
433449
.map(result -> new GeminiFunctionCall(geminiFunction.getFunctionCall(), result));
434450
}
435451

452+
/**
453+
* Builder for {@link GeminiChatCompletion}.
454+
*/
436455
public static class Builder extends GeminiServiceBuilder<GeminiChatCompletion, Builder> {
437456

438457
@Override

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/chatcompletion/GeminiFunctionCall.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import javax.annotation.Nonnull;
1010
import javax.annotation.Nullable;
1111

12+
/**
13+
* Represents a function call in Gemini.
14+
*/
1215
public class GeminiFunctionCall {
1316
@Nonnull
1417
private final FunctionCall functionCall;
@@ -17,6 +20,11 @@ public class GeminiFunctionCall {
1720
private final String pluginName;
1821
private final String functionName;
1922

23+
/**
24+
* Creates a new Gemini function call.
25+
* @param functionCall The function call
26+
* @param functionResult The result of the function invocation
27+
*/
2028
@SuppressFBWarnings("EI_EXPOSE_REP2")
2129
public GeminiFunctionCall(
2230
@Nonnull FunctionCall functionCall,
@@ -29,19 +37,35 @@ public GeminiFunctionCall(
2937
this.functionName = name[1];
3038
}
3139

40+
/**
41+
* Gets the plugin name.
42+
* @return The plugin name
43+
*/
3244
public String getPluginName() {
3345
return pluginName;
3446
}
3547

48+
/**
49+
* Gets the function name.
50+
* @return The function name
51+
*/
3652
public String getFunctionName() {
3753
return functionName;
3854
}
3955

56+
/**
57+
* Gets the function call.
58+
* @return The function call
59+
*/
4060
@SuppressFBWarnings("EI_EXPOSE_REP")
4161
public FunctionCall getFunctionCall() {
4262
return functionCall;
4363
}
4464

65+
/**
66+
* Gets the function result.
67+
* @return The function result
68+
*/
4569
@Nullable
4670
public FunctionResult<?> getFunctionResult() {
4771
return functionResult;

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/chatcompletion/GeminiRole.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
package com.microsoft.semantickernel.aiservices.google.chatcompletion;
33

4+
/**
5+
* Represents the role of a message in a Gemini conversation.
6+
*/
47
public enum GeminiRole {
58
/**
69
* A user message is a message generated by the user.

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/chatcompletion/GeminiStreamingChatMessageContent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class GeminiStreamingChatMessageContent<T> extends GeminiChatMessageConte
2727
* @param innerContent The inner content.
2828
* @param encoding The encoding.
2929
* @param metadata The metadata.
30+
* @param id The id of the message.
3031
* @param geminiFunctionCalls The function calls.
3132
*/
3233
public GeminiStreamingChatMessageContent(AuthorRole authorRole, String content,

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/chatcompletion/GeminiXMLPromptParser.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,26 @@
1717
import org.slf4j.Logger;
1818
import org.slf4j.LoggerFactory;
1919

20+
/**
21+
* Parses an XML prompt for a Gemini chat.
22+
*/
2023
public class GeminiXMLPromptParser {
2124

2225
private static final Logger LOGGER = LoggerFactory.getLogger(GeminiXMLPromptParser.class);
2326

27+
/**
28+
* Represents a parsed prompt for Gemini chat.
29+
*/
2430
public static class GeminiParsedPrompt {
2531

2632
private final ChatHistory chatHistory;
2733
private final List<FunctionDeclaration> functions;
2834

35+
/**
36+
* Creates a new parsed prompt.
37+
* @param parsedChatHistory The chat history
38+
* @param parsedFunctions The functions declarations.
39+
*/
2940
protected GeminiParsedPrompt(
3041
ChatHistory parsedChatHistory,
3142
@Nullable List<FunctionDeclaration> parsedFunctions) {
@@ -36,10 +47,18 @@ protected GeminiParsedPrompt(
3647
this.functions = parsedFunctions;
3748
}
3849

50+
/**
51+
* Gets the chat history.
52+
* @return A copy of the chat history.
53+
*/
3954
public ChatHistory getChatHistory() {
4055
return new ChatHistory(chatHistory.getMessages());
4156
}
4257

58+
/**
59+
* Gets the functions declarations.
60+
* @return A copy of the functions declarations.
61+
*/
4362
public List<FunctionDeclaration> getFunctions() {
4463
return Collections.unmodifiableList(functions);
4564
}
@@ -131,6 +150,11 @@ public ChatPromptParseVisitor<GeminiParsedPrompt> reset() {
131150
}
132151
}
133152

153+
/**
154+
* Create a GeminiParsedPrompt by parsing a raw prompt.
155+
* @param rawPrompt the raw prompt to parse.
156+
* @return The parsed prompt.
157+
*/
134158
public static GeminiParsedPrompt parse(String rawPrompt) {
135159
ChatPromptParseVisitor<GeminiParsedPrompt> visitor = ChatXMLPromptParser.parse(
136160
rawPrompt,

aiservices/google/src/main/java/com/microsoft/semantickernel/aiservices/google/textcompletion/GeminiTextGenerationService.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,27 @@
2828
import reactor.core.publisher.Flux;
2929
import reactor.core.publisher.Mono;
3030

31+
/**
32+
* A Gemini service for text generation.
33+
* @see TextGenerationService
34+
*/
3135
public class GeminiTextGenerationService extends GeminiService implements TextGenerationService {
3236

3337
private static final Logger LOGGER = LoggerFactory.getLogger(GeminiTextGenerationService.class);
3438

39+
/**
40+
* Creates a new Gemini text generation service.
41+
* @param client The VertexAI client
42+
* @param modelId The Gemini model ID
43+
*/
3544
public GeminiTextGenerationService(VertexAI client, String modelId) {
3645
super(client, modelId);
3746
}
3847

48+
/**
49+
* Creates a new builder for a Gemini text generation service.
50+
* @return The builder
51+
*/
3952
public static Builder builder() {
4053
return new Builder();
4154
}
@@ -121,6 +134,9 @@ private GenerativeModel getGenerativeModel(
121134
return modelBuilder.build();
122135
}
123136

137+
/**
138+
* Builder for a Gemini text generation service.
139+
*/
124140
public static class Builder extends
125141
GeminiServiceBuilder<GeminiTextGenerationService, GeminiTextGenerationService.Builder> {
126142

aiservices/huggingface/src/main/java/com/microsoft/semantickernel/aiservices/huggingface/HuggingFaceClient.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,21 @@
1919
import reactor.core.publisher.Mono;
2020
import javax.annotation.Nullable;
2121

22+
/**
23+
* A client for the Hugging Face API.
24+
*/
2225
public class HuggingFaceClient {
2326

2427
private final KeyCredential key;
2528
private final String endpoint;
2629
private final HttpClient httpClient;
2730

31+
/**
32+
* Creates a new Hugging Face client.
33+
* @param key The key credential for endpoint authentication.
34+
* @param endpoint The endpoint for the Hugging Face API.
35+
* @param httpClient The HTTP client to use for requests.
36+
*/
2837
public HuggingFaceClient(
2938
KeyCredential key,
3039
String endpoint,
@@ -74,6 +83,12 @@ public GeneratedTextItemList(
7483

7584
}
7685

86+
/**
87+
* Gets the text contents from the Hugging Face API.
88+
* @param modelId The model ID.
89+
* @param textGenerationRequest The text generation request.
90+
* @return The generated text items.
91+
*/
7792
public Mono<List<GeneratedTextItem>> getTextContentsAsync(
7893
String modelId,
7994
TextGenerationRequest textGenerationRequest) {
@@ -131,11 +146,18 @@ private Mono<String> performRequest(String modelId,
131146
return responseBody;
132147
}
133148

149+
/**
150+
* Creates a new builder for a Hugging Face client.
151+
* @return The builder
152+
*/
134153
public static Builder builder() {
135154
return new Builder();
136155
}
137156

138-
public static class Builder {
157+
/**
158+
* Builder for a Hugging Face client.
159+
*/
160+
public static class Builder {
139161

140162
@Nullable
141163
private KeyCredential key = null;
@@ -144,6 +166,10 @@ public static class Builder {
144166
@Nullable
145167
private HttpClient httpClient = null;
146168

169+
/**
170+
* Builds the Hugging Face client.
171+
* @return The client
172+
*/
147173
public HuggingFaceClient build() {
148174
if (httpClient == null) {
149175
httpClient = HttpClient.createDefault();
@@ -160,16 +186,31 @@ public HuggingFaceClient build() {
160186
httpClient);
161187
}
162188

189+
/**
190+
* Sets the key credential for the client.
191+
* @param key The key credential
192+
* @return The builder
193+
*/
163194
public Builder credential(KeyCredential key) {
164195
this.key = key;
165196
return this;
166197
}
167198

199+
/**
200+
* Sets the endpoint for the client.
201+
* @param endpoint The endpoint
202+
* @return The builder
203+
*/
168204
public Builder endpoint(String endpoint) {
169205
this.endpoint = endpoint;
170206
return this;
171207
}
172208

209+
/**
210+
* Sets the HTTP client for the client.
211+
* @param httpClient The HTTP client
212+
* @return The builder
213+
*/
173214
public Builder httpClient(HttpClient httpClient) {
174215
this.httpClient = httpClient;
175216
return this;

0 commit comments

Comments
 (0)