Skip to content

Commit 3dcbb89

Browse files
author
Milder Hernandez Cagua
committed
Add EI_EXPOSE_REP updates
1 parent afaa50c commit 3dcbb89

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

semantickernel-api/src/main/java/com/microsoft/semantickernel/agents/AgentInvokeOptions.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.microsoft.semantickernel.builders.SemanticKernelBuilder;
55
import com.microsoft.semantickernel.orchestration.InvocationContext;
66
import com.microsoft.semantickernel.semanticfunctions.KernelArguments;
7+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
78

89
import javax.annotation.Nullable;
910

@@ -12,7 +13,7 @@
1213
*/
1314
public class AgentInvokeOptions {
1415

15-
private final KernelArguments KernelArguments;
16+
private final KernelArguments kernelArguments;
1617
private final Kernel kernel;
1718
private final String additionalInstructions;
1819
private final InvocationContext invocationContext;
@@ -27,33 +28,53 @@ public AgentInvokeOptions() {
2728
/**
2829
* Constructor for AgentInvokeOptions.
2930
*
30-
* @param KernelArguments The arguments for the kernel function.
31+
* @param kernelArguments The arguments for the kernel function.
3132
* @param kernel The kernel to use.
3233
* @param additionalInstructions Additional instructions for the agent.
3334
* @param invocationContext The invocation context.
3435
*/
35-
public AgentInvokeOptions(@Nullable KernelArguments KernelArguments,
36+
public AgentInvokeOptions(@Nullable KernelArguments kernelArguments,
3637
@Nullable Kernel kernel,
3738
@Nullable String additionalInstructions,
3839
@Nullable InvocationContext invocationContext) {
39-
this.KernelArguments = KernelArguments;
40+
this.kernelArguments = kernelArguments != null ? kernelArguments.copy() : null;
4041
this.kernel = kernel;
4142
this.additionalInstructions = additionalInstructions;
4243
this.invocationContext = invocationContext;
4344
}
4445

46+
/**
47+
* Get the kernel arguments.
48+
*
49+
* @return The kernel arguments.
50+
*/
4551
public KernelArguments getKernelArguments() {
46-
return KernelArguments;
52+
return kernelArguments;
4753
}
4854

55+
/**
56+
* Get the kernel.
57+
*
58+
* @return The kernel.
59+
*/
4960
public Kernel getKernel() {
5061
return kernel;
5162
}
5263

64+
/**
65+
* Get additional instructions.
66+
*
67+
* @return The additional instructions.
68+
*/
5369
public String getAdditionalInstructions() {
5470
return additionalInstructions;
5571
}
5672

73+
/**
74+
* Get the invocation context.
75+
*
76+
* @return The invocation context.
77+
*/
5778
public InvocationContext getInvocationContext() {
5879
return invocationContext;
5980
}
@@ -80,6 +101,7 @@ public static class Builder implements SemanticKernelBuilder<AgentInvokeOptions>
80101
* @param kernelArguments The kernel arguments.
81102
* @return The builder.
82103
*/
104+
@SuppressFBWarnings("EI_EXPOSE_REP2")
83105
public Builder withKernelArguments(KernelArguments kernelArguments) {
84106
this.kernelArguments = kernelArguments;
85107
return this;

semantickernel-api/src/main/java/com/microsoft/semantickernel/agents/AgentResponseItem.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
package com.microsoft.semantickernel.agents;
22

3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4+
35
public class AgentResponseItem<T> {
46
private final T message;
57
private final AgentThread thread;
68

9+
@SuppressFBWarnings("EI_EXPOSE_REP2")
710
public AgentResponseItem(T message, AgentThread thread) {
811
this.message = message;
912
this.thread = thread;
1013
}
1114

15+
/**
16+
* Gets the agent response message.
17+
*
18+
* @return The message.
19+
*/
1220
public T getMessage() {
1321
return message;
1422
}
1523

24+
/**
25+
* Gets the thread.
26+
*
27+
* @return The thread.
28+
*/
29+
@SuppressFBWarnings("EI_EXPOSE_REP")
1630
public AgentThread getThread() {
1731
return thread;
1832
}

semantickernel-api/src/main/java/com/microsoft/semantickernel/agents/KernelAgent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected KernelAgent(
4141
this.name = name;
4242
this.description = description;
4343
this.kernel = kernel;
44-
this.kernelArguments = kernelArguments;
44+
this.kernelArguments = kernelArguments != null ? kernelArguments.copy() : null;
4545
this.invocationContext = invocationContext != null
4646
? invocationContext : InvocationContext.builder().withReturnMode(InvocationReturnMode.FULL_HISTORY).build();
4747
this.instructions = instructions;

0 commit comments

Comments
 (0)