diff --git a/java/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/XMLPromptParser.java b/java/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/XMLPromptParser.java index 2aa182026b..c60b4a907b 100644 --- a/java/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/XMLPromptParser.java +++ b/java/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/XMLPromptParser.java @@ -105,7 +105,7 @@ class XMLPromptParser { XMLEventReader reader = factory.createXMLEventReader(is); FunctionDefinition functionDefinition = null; Map parameters = new HashMap<>(); - List requiredParmeters = new ArrayList<>(); + List requiredParameters = new ArrayList<>(); while (reader.hasNext()) { XMLEvent event = reader.nextEvent(); if (event.isStartElement()) { @@ -113,7 +113,7 @@ class XMLPromptParser { if (elementName.equals("function")) { assert functionDefinition == null; assert parameters.isEmpty(); - assert requiredParmeters.isEmpty(); + assert requiredParameters.isEmpty(); String pluginName = getAttributeValue(event, "pluginName"); String name = getAttributeValue(event, "name"); String description = getAttributeValue(event, "description"); @@ -132,7 +132,7 @@ class XMLPromptParser { String isRequired = getAttributeValue(event, "isRequired"); if (Boolean.parseBoolean(isRequired)) { - requiredParmeters.add(name); + requiredParameters.add(name); } } } else if (event.isEndElement()) { @@ -169,9 +169,9 @@ class XMLPromptParser { }); // strip off trailing comma and close the properties object sb.replace(sb.length() - 1, sb.length(), "}"); - if (!requiredParmeters.isEmpty()) { + if (!requiredParameters.isEmpty()) { sb.append(", \"required\": ["); - requiredParmeters.forEach(name -> { + requiredParameters.forEach(name -> { sb.append(String.format("\"%s\",", name)); }); // strip off trailing comma and close the required array @@ -188,7 +188,7 @@ class XMLPromptParser { functionDefinitions.add(functionDefinition); functionDefinition = null; parameters.clear(); - requiredParmeters.clear(); + requiredParameters.clear(); } } } diff --git a/java/eclipse-formatter.xml b/java/eclipse-formatter.xml index 8d74a651ce..576a3375a3 100644 --- a/java/eclipse-formatter.xml +++ b/java/eclipse-formatter.xml @@ -7,7 +7,6 @@ - @@ -400,10 +399,10 @@ - + - + diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java index a1881feab3..2a2c77c8ab 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java +++ b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java @@ -42,13 +42,13 @@ public class Example08_RetryHandler { String question = "How popular is the Polly library?"; - KernelFunction fuction = KernelFunctionFromPrompt.builder() + KernelFunction function = KernelFunctionFromPrompt.builder() .withTemplate(question) .build(); try { // Will retry 3 times with exponential backoff - kernel.invokeAsync(fuction).block(); + kernel.invokeAsync(function).block(); } catch (Exception e) { System.out.println("Hit max retries"); } diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java index b4ff8ecc0c..53a44f7854 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java +++ b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java @@ -264,17 +264,17 @@ public class Example09_FunctionTypes { .block(); var result10 = kernel - .invokeAsync(plugin.get("WithPrimativeReturnType")) + .invokeAsync(plugin.get("WithPrimitiveReturnType")) .block(); System.out.println(result10.getResult()); var result11 = kernel - .invokeAsync(plugin.get("WithBoxedPrimativeReturnType")) + .invokeAsync(plugin.get("WithBoxedPrimitiveReturnType")) .block(); System.out.println(result11.getResult()); var result12 = kernel - .invokeAsync(plugin.get("AsyncWithBoxedPrimativeReturnType")) + .invokeAsync(plugin.get("AsyncWithBoxedPrimitiveReturnType")) .block(); System.out.println(result12.getResult()); @@ -520,18 +520,18 @@ public class Example09_FunctionTypes { + "}, y = {" + y + "}]"); } - @DefineKernelFunction(name = "WithPrimativeReturnType", returnType = "int") - public int WithPrimativeReturnType() { + @DefineKernelFunction(name = "WithPrimitiveReturnType", returnType = "int") + public int WithPrimitiveReturnType() { return 1; } - @DefineKernelFunction(name = "WithBoxedPrimativeReturnType", returnType = "int") - public Integer WithBoxedPrimativeReturnType() { + @DefineKernelFunction(name = "WithBoxedPrimitiveReturnType", returnType = "int") + public Integer WithBoxedPrimitiveReturnType() { return Integer.valueOf(1); } - @DefineKernelFunction(name = "AsyncWithBoxedPrimativeReturnType", returnType = "int") - public Mono AsyncWithBoxedPrimativeReturnType() { + @DefineKernelFunction(name = "AsyncWithBoxedPrimitiveReturnType", returnType = "int") + public Mono AsyncWithBoxedPrimitiveReturnType() { return Mono.just(Integer.valueOf(1)); } diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java index 0e4f6dc209..db1c1a1ec7 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java +++ b/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java @@ -102,7 +102,7 @@ public class Example13_ConversationSummaryPlugin { Jane: Lorem ipsum dolor sit amet, con Jane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam Jane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam - Jane: Darn, it's just repeating stuf now. + Jane: Darn, it's just repeating stuff now. John: I think we're done. Jane: We're not though! We need like 1500 more characters. John: Oh Cananda, our home and native land. diff --git a/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java b/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java index 22f4aaec13..c1be538dcf 100644 --- a/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java +++ b/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java @@ -144,7 +144,7 @@ public class SemanticKernelOpenAPIImporter { @Nullable HttpHeaders httpHeaders, @Nullable HttpClient client) { - // Currently this does not apply as the Netty client does not obay the headers provided in the + // Currently this does not apply as the Netty client does not obey the headers provided in the // HttpClientOptions, however they may do one day if (httpHeaders != null && client != null) { throw new IllegalArgumentException( diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypeConverter.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypeConverter.java index bb87d3b5d0..0a4bc75853 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypeConverter.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypeConverter.java @@ -234,7 +234,7 @@ public class ContextVariableTypeConverter { /** * A converter that does no conversion. This converter is often used as a default when no other - * conveter can be found for the type. + * converter can be found for the type. * * @param the type of the context variable */ diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypes.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypes.java index fd1404dae1..21e12e70ab 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypes.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/ContextVariableTypes.java @@ -110,12 +110,12 @@ public class ContextVariableTypes { /** * Add a converter to the global collection of context variable type converters. * - * @param conveter The converter to add. + * @param converter The converter to add. * @see #getGlobalVariableTypeForClass(Class) */ public static void addGlobalConverter( - ContextVariableTypeConverter conveter) { - DEFAULT_TYPES.putConverter(conveter); + ContextVariableTypeConverter converter) { + DEFAULT_TYPES.putConverter(converter); } /** diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/converters/PrimitiveVariableContextVariableTypeConverter.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/converters/PrimitiveVariableContextVariableTypeConverter.java index 5b9bc866e6..d41b3a3330 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/converters/PrimitiveVariableContextVariableTypeConverter.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/contextvariables/converters/PrimitiveVariableContextVariableTypeConverter.java @@ -10,7 +10,7 @@ import java.util.function.Function; import javax.annotation.Nullable; /** - * A {@link ContextVariableTypeConverter} for primative variables. + * A {@link ContextVariableTypeConverter} for primitive variables. * * @param the type of the variable */ @@ -24,7 +24,7 @@ public class PrimitiveVariableContextVariableTypeConverter extends * * @param clazz the class * @param fromPromptString the function to convert from a prompt string - * @param fromObject the function to convert from an object to primative + * @param fromObject the function to convert from an object to primitive */ public PrimitiveVariableContextVariableTypeConverter( Class clazz, diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/FunctionInvocation.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/FunctionInvocation.java index 2ee18f73d7..2a0a550dd9 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/FunctionInvocation.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/FunctionInvocation.java @@ -311,7 +311,7 @@ public class FunctionInvocation extends Mono> { } /** - * This method hanldes the reactive stream when the KernelFunciton is invoked. + * This method handles the reactive stream when the KernelFunction is invoked. * * @param coreSubscriber The subscriber to subscribe to the function invocation. */ diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettings.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettings.java index 8d5828568b..10b2079f82 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettings.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettings.java @@ -227,7 +227,7 @@ public class PromptExecutionSettings { /** * Presence penalty encourages the model to use a more or less diverse range of tokens in the * output. A higher value means that the model will try to use a greater variety of tokens in - * the ouput. + * the output. * * @return The presence penalty setting. */ diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/plugin/KernelPluginFactory.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/plugin/KernelPluginFactory.java index 0f5a968ea9..f6e8ad1e33 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/plugin/KernelPluginFactory.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/plugin/KernelPluginFactory.java @@ -45,20 +45,20 @@ public class KernelPluginFactory { private static final Logger LOGGER = LoggerFactory.getLogger(KernelPluginFactory.class); private static final String CONFIG_FILE = "config.json"; private static final String PROMPT_FILE = "skprompt.txt"; - private static final CaseInsensitiveMap> PRIMATIVE_CLASS_NAMES = new CaseInsensitiveMap<>(); + private static final CaseInsensitiveMap> PRIMITIVE_CLASS_NAMES = new CaseInsensitiveMap<>(); private static final CaseInsensitiveMap> COMMON_CLASS_NAMES = new CaseInsensitiveMap<>(); - private static final Map, Class> BOXED_FROM_PRIMATIVE = new HashMap<>(); + private static final Map, Class> BOXED_FROM_PRIMITIVE = new HashMap<>(); static { - PRIMATIVE_CLASS_NAMES.put("void", void.class); - PRIMATIVE_CLASS_NAMES.put("int", int.class); - PRIMATIVE_CLASS_NAMES.put("double", double.class); - PRIMATIVE_CLASS_NAMES.put("boolean", boolean.class); - PRIMATIVE_CLASS_NAMES.put("float", float.class); - PRIMATIVE_CLASS_NAMES.put("long", long.class); - PRIMATIVE_CLASS_NAMES.put("short", short.class); - PRIMATIVE_CLASS_NAMES.put("byte", byte.class); - PRIMATIVE_CLASS_NAMES.put("char", char.class); + PRIMITIVE_CLASS_NAMES.put("void", void.class); + PRIMITIVE_CLASS_NAMES.put("int", int.class); + PRIMITIVE_CLASS_NAMES.put("double", double.class); + PRIMITIVE_CLASS_NAMES.put("boolean", boolean.class); + PRIMITIVE_CLASS_NAMES.put("float", float.class); + PRIMITIVE_CLASS_NAMES.put("long", long.class); + PRIMITIVE_CLASS_NAMES.put("short", short.class); + PRIMITIVE_CLASS_NAMES.put("byte", byte.class); + PRIMITIVE_CLASS_NAMES.put("char", char.class); COMMON_CLASS_NAMES.put("integer", int.class); COMMON_CLASS_NAMES.put("string", String.class); @@ -66,15 +66,15 @@ public class KernelPluginFactory { COMMON_CLASS_NAMES.put("map", HashMap.class); COMMON_CLASS_NAMES.put("set", HashSet.class); - BOXED_FROM_PRIMATIVE.put(void.class, Void.class); - BOXED_FROM_PRIMATIVE.put(int.class, Integer.class); - BOXED_FROM_PRIMATIVE.put(double.class, Double.class); - BOXED_FROM_PRIMATIVE.put(boolean.class, Boolean.class); - BOXED_FROM_PRIMATIVE.put(float.class, Float.class); - BOXED_FROM_PRIMATIVE.put(long.class, Long.class); - BOXED_FROM_PRIMATIVE.put(short.class, Short.class); - BOXED_FROM_PRIMATIVE.put(byte.class, Byte.class); - BOXED_FROM_PRIMATIVE.put(char.class, Character.class); + BOXED_FROM_PRIMITIVE.put(void.class, Void.class); + BOXED_FROM_PRIMITIVE.put(int.class, Integer.class); + BOXED_FROM_PRIMITIVE.put(double.class, Double.class); + BOXED_FROM_PRIMITIVE.put(boolean.class, Boolean.class); + BOXED_FROM_PRIMITIVE.put(float.class, Float.class); + BOXED_FROM_PRIMITIVE.put(long.class, Long.class); + BOXED_FROM_PRIMITIVE.put(short.class, Short.class); + BOXED_FROM_PRIMITIVE.put(byte.class, Byte.class); + BOXED_FROM_PRIMITIVE.put(char.class, Character.class); } @@ -205,7 +205,7 @@ public class KernelPluginFactory { */ @Nullable private static Class getCommonTypeAlias(Method method, String className) { - Class returnType = PRIMATIVE_CLASS_NAMES.get(className); + Class returnType = PRIMITIVE_CLASS_NAMES.get(className); if (returnType == null) { returnType = COMMON_CLASS_NAMES.get(className); @@ -216,7 +216,7 @@ public class KernelPluginFactory { } if (returnType != null && !returnType.isAssignableFrom(method.getReturnType())) { - returnType = BOXED_FROM_PRIMATIVE.get(returnType); + returnType = BOXED_FROM_PRIMITIVE.get(returnType); } return returnType; @@ -229,7 +229,7 @@ public class KernelPluginFactory { * @return The class for the type name. */ public static Class getTypeForName(String className) { - Class clazz = PRIMATIVE_CLASS_NAMES.get(className); + Class clazz = PRIMITIVE_CLASS_NAMES.get(className); if (clazz == null) { clazz = COMMON_CLASS_NAMES.get(className); diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromMethod.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromMethod.java index d8209b0abd..77ba83189d 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromMethod.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromMethod.java @@ -451,7 +451,7 @@ public class KernelFunctionFromMethod extends KernelFunction { return arg.getValue(); } - if (isPrimative(arg.getType().getClazz(), parameter.getType())) { + if (isPrimitive(arg.getType().getClazz(), parameter.getType())) { return arg.getValue(); } @@ -492,7 +492,7 @@ public class KernelFunctionFromMethod extends KernelFunction { } @SuppressWarnings("OperatorPrecedence") - private static boolean isPrimative(Class argType, Class param) { + private static boolean isPrimitive(Class argType, Class param) { return (argType == Byte.class || argType == byte.class) && (param == Byte.class || param == byte.class) || (argType == Integer.class || argType == int.class) && (param == Integer.class diff --git a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromPrompt.java b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromPrompt.java index e6a945925d..56a8e36660 100644 --- a/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromPrompt.java +++ b/java/semantickernel-api/src/main/java/com/microsoft/semantickernel/semanticfunctions/KernelFunctionFromPrompt.java @@ -112,7 +112,7 @@ public class KernelFunctionFromPrompt extends KernelFunction { KernelFunctionArguments arguments = preRenderingHookResult.getArguments(); - // TOOD: put in method, add catch for classcastexception, fallback to noopconverter + // TODO: put in method, add catch for classcastexception, fallback to noopconverter ContextVariableType variableType = contextVariableType != null ? contextVariableType : context.getContextVariableTypes().getVariableTypeForClass( diff --git a/java/semantickernel-api/src/test/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettingsTest.java b/java/semantickernel-api/src/test/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettingsTest.java index e39e650c77..daec47226c 100644 --- a/java/semantickernel-api/src/test/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettingsTest.java +++ b/java/semantickernel-api/src/test/java/com/microsoft/semantickernel/orchestration/PromptExecutionSettingsTest.java @@ -71,7 +71,7 @@ public class PromptExecutionSettingsTest { } @Test - void testJsonDeserialze() throws Exception { + void testJsonDeserialize() throws Exception { String json = "{" + "\"service_id\":\"custom-service\"," + "\"max_tokens\":512,"