Java: API for 04-DynamicRag sample (#3736)

### 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:
David Grieve
2023-11-29 16:11:50 +00:00
committed by GitHub
parent 12f592cfad
commit 773260e2ea
3 changed files with 30 additions and 0 deletions
@@ -1,9 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.orchestration;
import java.util.Map;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import com.microsoft.semantickernel.Kernel;
import com.microsoft.semantickernel.memory.SemanticTextMemory;
import com.microsoft.semantickernel.skilldefinition.FunctionView;
import com.microsoft.semantickernel.skilldefinition.ReadOnlySkillCollection;
@@ -81,6 +84,14 @@ public interface SKFunction {
@Deprecated
Mono<SKContext> invokeAsync(SKContext context, @Nullable Object settings);
/**
* @return The result of invoking the function.
* @param kernel The kernel to invoke the function on
* @param variables The variables to invoke the function with
* @since 1.0.0
*/
Mono<FunctionResult> invokeAsync(Kernel kernel, Map<String,Object> variables);
/**
* @return The name of the skill that this function is within
*/
@@ -17,4 +17,6 @@ public @interface DefineSKFunction {
String returnType() default "void";
String returnDescription() default "";
SKSample[] samples() default {};
}
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.skilldefinition.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @since 1.0.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SKSample {
String inputs();
String output();
}