Skip to content

Commit 266401e

Browse files
jamespudilayaperumalg
authored andcommitted
Fix: Refactor advisor documentation and type usage for clarity and consistency
Signed-off-by: Wenli Tian <[email protected]>
1 parent 0abfedf commit 266401e

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/DefaultChatClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* @author Dariusz Jedrzejczyk
7979
* @author Thomas Vitale
8080
* @author Jonatan Ivanov
81+
* @author Wenli Tian
8182
* @since 1.0.0
8283
*/
8384
public class DefaultChatClient implements ChatClient {
@@ -813,7 +814,7 @@ public Builder mutate() {
813814
this.advisorObservationConvention)
814815
.defaultTemplateRenderer(this.templateRenderer)
815816
.defaultToolCallbacks(this.toolCallbacks)
816-
.defaultToolCallbacks(this.toolCallbackProviders.toArray(new ToolCallback[0]))
817+
.defaultToolCallbacks(this.toolCallbackProviders.toArray(new ToolCallbackProvider[0]))
817818
.defaultToolContext(this.toolContext)
818819
.defaultToolNames(StringUtils.toStringArray(this.toolNames));
819820

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/advisor/DefaultAroundAdvisorChain.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor;
2626
import reactor.core.publisher.Flux;
2727

28+
import org.springframework.ai.chat.client.ChatClient;
2829
import org.springframework.ai.chat.client.ChatClientMessageAggregator;
2930
import org.springframework.ai.chat.client.ChatClientRequest;
3031
import org.springframework.ai.chat.client.ChatClientResponse;
@@ -43,9 +44,9 @@
4344
import org.springframework.util.CollectionUtils;
4445

4546
/**
46-
* Default implementation for the {@link BaseAdvisorChain}. Used by the
47-
* {@link org.springframework.ai.chat.client.ChatClient} to delegate the call to the next
48-
* {@link CallAdvisor} or {@link StreamAdvisor} in the chain.
47+
* Default implementation for the {@link BaseAdvisorChain}. Used by the {@link ChatClient}
48+
* to delegate the call to the next {@link CallAdvisor} or {@link StreamAdvisor} in the
49+
* chain.
4950
*
5051
* @author Christian Tzolov
5152
* @author Dariusz Jedrzejczyk

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/advisor/StructuredOutputValidationAdvisor.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.springframework.ai.chat.prompt.Prompt;
4141
import org.springframework.ai.util.json.JsonParser;
4242
import org.springframework.ai.util.json.schema.JsonSchemaGenerator;
43+
import org.springframework.core.Ordered;
4344
import org.springframework.core.ParameterizedTypeReference;
4445
import org.springframework.util.Assert;
4546

@@ -63,10 +64,10 @@ public final class StructuredOutputValidationAdvisor implements CallAdvisor, Str
6364
};
6465

6566
/**
66-
* Set the order close to Ordered.LOWEST_PRECEDENCE to ensure an advisor is executed
67-
* toward the last (but before the model call) in the chain (last for request
67+
* Set the order close to {@link Ordered#LOWEST_PRECEDENCE} to ensure an advisor is
68+
* executed toward the last (but before the model call) in the chain (last for request
6869
* processing, first for response processing).
69-
*
70+
* <p>
7071
* https://docs.spring.io/spring-ai/reference/api/advisors.html#_advisor_order
7172
*/
7273
private final int advisorOrder;
@@ -223,10 +224,10 @@ public static Builder builder() {
223224
public final static class Builder {
224225

225226
/**
226-
* Set the order close to Ordered.LOWEST_PRECEDENCE to ensure an advisor is
227-
* executed toward the last (but before the model call) in the chain (last for
227+
* Set the order close to {@link Ordered#LOWEST_PRECEDENCE} to ensure an advisor
228+
* is executed toward the last (but before the model call) in the chain (last for
228229
* request processing, first for response processing).
229-
*
230+
* <p>
230231
* https://docs.spring.io/spring-ai/reference/api/advisors.html#_advisor_order
231232
*/
232233
private int advisorOrder = BaseAdvisor.LOWEST_PRECEDENCE - 2000;

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/advisor/ToolCallAdvisor.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@
3030
import org.springframework.ai.model.tool.ToolCallingChatOptions;
3131
import org.springframework.ai.model.tool.ToolCallingManager;
3232
import org.springframework.ai.model.tool.ToolExecutionResult;
33+
import org.springframework.core.Ordered;
3334
import org.springframework.util.Assert;
3435

3536
/**
3637
* Recursive Advisor that disables the internal tool execution flow and instead implements
3738
* the tool calling loop as part of the advisor chain.
38-
*
39+
* <p>
3940
* It uses the CallAdvisorChainUtil to implement looping advisor chain calls.
40-
*
41+
* <p>
4142
* This enables intercepting the tool calling loop by the rest of the advisors next in the
4243
* chain.
4344
*
@@ -48,9 +49,10 @@ public final class ToolCallAdvisor implements CallAdvisor, StreamAdvisor {
4849
private final ToolCallingManager toolCallingManager;
4950

5051
/**
51-
* Set the order close to Ordered.HIGHEST_PRECEDENCE to ensure an advisor is executed
52-
* first in the chain (first for request processing, last for response processing).
53-
*
52+
* Set the order close to {@link Ordered#LOWEST_PRECEDENCE} to ensure an advisor is
53+
* executed first in the chain (first for request processing, last for response
54+
* processing).
55+
* <p>
5456
* https://docs.spring.io/spring-ai/reference/api/advisors.html#_advisor_order
5557
*/
5658
private final int advisorOrder;

0 commit comments

Comments
 (0)