Skip to content

Commit bd6afbb

Browse files
committed
refactor: remove obsolete templateRenderer from AdvisorChain
The templateRenderer is no longer required within the AdvisorChain itself, as template rendering now occurs during the construction of the ChatClientRequest. This field was unused and has been removed to clean up the code. Signed-off-by: eeaters <[email protected]>
1 parent 1dd686b commit bd6afbb

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,6 @@ private BaseAdvisorChain buildAdvisorChain() {
10081008

10091009
return DefaultAroundAdvisorChain.builder(this.observationRegistry)
10101010
.pushAll(this.advisors)
1011-
.templateRenderer(this.templateRenderer)
10121011
.build();
10131012
}
10141013

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,14 @@ public class DefaultAroundAdvisorChain implements BaseAdvisorChain {
6868

6969
private final ObservationRegistry observationRegistry;
7070

71-
private final TemplateRenderer templateRenderer;
72-
73-
DefaultAroundAdvisorChain(ObservationRegistry observationRegistry, @Nullable TemplateRenderer templateRenderer,
71+
DefaultAroundAdvisorChain(ObservationRegistry observationRegistry,
7472
Deque<CallAdvisor> callAdvisors, Deque<StreamAdvisor> streamAdvisors) {
7573

7674
Assert.notNull(observationRegistry, "the observationRegistry must be non-null");
7775
Assert.notNull(callAdvisors, "the callAdvisors must be non-null");
7876
Assert.notNull(streamAdvisors, "the streamAdvisors must be non-null");
7977

8078
this.observationRegistry = observationRegistry;
81-
this.templateRenderer = templateRenderer != null ? templateRenderer : DEFAULT_TEMPLATE_RENDERER;
8279
this.callAdvisors = callAdvisors;
8380
this.streamAdvisors = streamAdvisors;
8481
this.originalCallAdvisors = List.copyOf(callAdvisors);
@@ -164,19 +161,12 @@ public static class Builder {
164161

165162
private final Deque<StreamAdvisor> streamAdvisors;
166163

167-
private TemplateRenderer templateRenderer;
168-
169164
public Builder(ObservationRegistry observationRegistry) {
170165
this.observationRegistry = observationRegistry;
171166
this.callAdvisors = new ConcurrentLinkedDeque<>();
172167
this.streamAdvisors = new ConcurrentLinkedDeque<>();
173168
}
174169

175-
public Builder templateRenderer(TemplateRenderer templateRenderer) {
176-
this.templateRenderer = templateRenderer;
177-
return this;
178-
}
179-
180170
public Builder push(Advisor advisor) {
181171
Assert.notNull(advisor, "the advisor must be non-null");
182172
return this.pushAll(List.of(advisor));
@@ -225,7 +215,7 @@ private void reOrder() {
225215
}
226216

227217
public DefaultAroundAdvisorChain build() {
228-
return new DefaultAroundAdvisorChain(this.observationRegistry, this.templateRenderer, this.callAdvisors,
218+
return new DefaultAroundAdvisorChain(this.observationRegistry, this.callAdvisors,
229219
this.streamAdvisors);
230220
}
231221

0 commit comments

Comments
 (0)