mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
Java: Fix null check (#5225)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
This commit is contained in:
@@ -68,8 +68,6 @@
|
||||
<modules>
|
||||
<module>semantickernel-bom</module>
|
||||
|
||||
<module>connectors/semantickernel-connectors-web-bing</module>
|
||||
|
||||
<module>aiservices/openai</module>
|
||||
|
||||
<module>semantickernel-api</module>
|
||||
@@ -140,11 +138,6 @@
|
||||
<artifactId>semantickernel-actionplanner-extension</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.semantic-kernel</groupId>
|
||||
<artifactId>semantickernel-connectors-web-bing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class WebSearchEnginePlugin {
|
||||
/// This method is marked as "unsafe." The usage of JavaScriptEncoder.UnsafeRelaxedJsonEscaping may introduce security risks.
|
||||
/// Only use this method if you are aware of the potential risks and have validated the input to prevent security vulnerabilities.
|
||||
/// </remarks>
|
||||
@DefineKernelFunction(name = "search", description = "Searches the web for the given query", returnType="java.lang.String")
|
||||
@DefineKernelFunction(name = "search", description = "Searches the web for the given query", returnType = "java.lang.String")
|
||||
public Mono<String> searchAsync(
|
||||
@KernelFunctionParameter(description = "The search query", name = "query", type = String.class) String query,
|
||||
@KernelFunctionParameter(description = "The number of results to return", name = "count", defaultValue = "1", type = int.class) int count,
|
||||
|
||||
+5
-4
@@ -96,9 +96,9 @@ public class Example59_OpenAIFunctionCalling {
|
||||
|
||||
// Based on coordinates
|
||||
var toolCallBehavior = ToolCallBehavior.allowOnlyKernelFunctions(true,
|
||||
plugin.get("getLatitudeOfCity"),
|
||||
plugin.get("getLongitudeOfCity"),
|
||||
plugin.get("getsTheWeatherAtAGivenLocation"));
|
||||
plugin.get("getLatitudeOfCity"),
|
||||
plugin.get("getLongitudeOfCity"),
|
||||
plugin.get("getsTheWeatherAtAGivenLocation"));
|
||||
|
||||
var result = kernel
|
||||
.invokeAsync(function)
|
||||
@@ -113,7 +113,8 @@ public class Example59_OpenAIFunctionCalling {
|
||||
KernelFunction<?> function) {
|
||||
System.out.println("======== Require a function ========");
|
||||
|
||||
var toolCallBehavior = ToolCallBehavior.requireKernelFunction(plugin.get("getsTheWeatherForCity"));
|
||||
var toolCallBehavior = ToolCallBehavior
|
||||
.requireKernelFunction(plugin.get("getsTheWeatherForCity"));
|
||||
|
||||
var result = kernel
|
||||
.invokeAsync(function)
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<Logger name="com.azure.core.implementation" level="warn">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Logger>
|
||||
<Logger name="com.microsoft.semantickernel.orchestration.FunctionInvocation" level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Logger>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
|
||||
@@ -39,6 +39,7 @@ public class Kernel implements Buildable {
|
||||
|
||||
// Only present so we can create a builder in copy method
|
||||
private final AIServiceCollection services;
|
||||
@Nullable
|
||||
private final Function<AIServiceCollection, AIServiceSelector> serviceSelectorProvider;
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ public class Kernel implements Buildable {
|
||||
*/
|
||||
public Kernel(
|
||||
AIServiceCollection services,
|
||||
Function<AIServiceCollection, AIServiceSelector> serviceSelectorProvider,
|
||||
@Nullable Function<AIServiceCollection, AIServiceSelector> serviceSelectorProvider,
|
||||
@Nullable List<KernelPlugin> plugins,
|
||||
@Nullable KernelHooks globalKernelHooks) {
|
||||
|
||||
|
||||
@@ -59,11 +59,6 @@
|
||||
<artifactId>semantickernel-plugin-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.semantic-kernel</groupId>
|
||||
<artifactId>semantickernel-connectors-web-bing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.semantic-kernel</groupId>
|
||||
<artifactId>aiservices-azureopenai</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user