|
38 | 38 | import org.springframework.ai.template.TemplateRenderer; |
39 | 39 | import org.springframework.ai.template.st.StTemplateRenderer; |
40 | 40 | import org.springframework.core.OrderComparator; |
41 | | -import org.springframework.lang.Nullable; |
42 | 41 | import org.springframework.util.Assert; |
43 | 42 | import org.springframework.util.CollectionUtils; |
44 | 43 |
|
@@ -68,17 +67,14 @@ public class DefaultAroundAdvisorChain implements BaseAdvisorChain { |
68 | 67 |
|
69 | 68 | private final ObservationRegistry observationRegistry; |
70 | 69 |
|
71 | | - private final TemplateRenderer templateRenderer; |
72 | | - |
73 | | - DefaultAroundAdvisorChain(ObservationRegistry observationRegistry, @Nullable TemplateRenderer templateRenderer, |
74 | | - Deque<CallAdvisor> callAdvisors, Deque<StreamAdvisor> streamAdvisors) { |
| 70 | + DefaultAroundAdvisorChain(ObservationRegistry observationRegistry, Deque<CallAdvisor> callAdvisors, |
| 71 | + Deque<StreamAdvisor> streamAdvisors) { |
75 | 72 |
|
76 | 73 | Assert.notNull(observationRegistry, "the observationRegistry must be non-null"); |
77 | 74 | Assert.notNull(callAdvisors, "the callAdvisors must be non-null"); |
78 | 75 | Assert.notNull(streamAdvisors, "the streamAdvisors must be non-null"); |
79 | 76 |
|
80 | 77 | this.observationRegistry = observationRegistry; |
81 | | - this.templateRenderer = templateRenderer != null ? templateRenderer : DEFAULT_TEMPLATE_RENDERER; |
82 | 78 | this.callAdvisors = callAdvisors; |
83 | 79 | this.streamAdvisors = streamAdvisors; |
84 | 80 | this.originalCallAdvisors = List.copyOf(callAdvisors); |
@@ -164,19 +160,12 @@ public static class Builder { |
164 | 160 |
|
165 | 161 | private final Deque<StreamAdvisor> streamAdvisors; |
166 | 162 |
|
167 | | - private TemplateRenderer templateRenderer; |
168 | | - |
169 | 163 | public Builder(ObservationRegistry observationRegistry) { |
170 | 164 | this.observationRegistry = observationRegistry; |
171 | 165 | this.callAdvisors = new ConcurrentLinkedDeque<>(); |
172 | 166 | this.streamAdvisors = new ConcurrentLinkedDeque<>(); |
173 | 167 | } |
174 | 168 |
|
175 | | - public Builder templateRenderer(TemplateRenderer templateRenderer) { |
176 | | - this.templateRenderer = templateRenderer; |
177 | | - return this; |
178 | | - } |
179 | | - |
180 | 169 | public Builder push(Advisor advisor) { |
181 | 170 | Assert.notNull(advisor, "the advisor must be non-null"); |
182 | 171 | return this.pushAll(List.of(advisor)); |
@@ -225,8 +214,7 @@ private void reOrder() { |
225 | 214 | } |
226 | 215 |
|
227 | 216 | public DefaultAroundAdvisorChain build() { |
228 | | - return new DefaultAroundAdvisorChain(this.observationRegistry, this.templateRenderer, this.callAdvisors, |
229 | | - this.streamAdvisors); |
| 217 | + return new DefaultAroundAdvisorChain(this.observationRegistry, this.callAdvisors, this.streamAdvisors); |
230 | 218 | } |
231 | 219 |
|
232 | 220 | } |
|
0 commit comments