Skip to content

Commit 80ffb4c

Browse files
committed
Revert "Fix OpenAiChatClientMethodInvokingFunctionCallbackIT"
This reverts commit bb52db5.
1 parent 89d8f6a commit 80ffb4c

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/client/OpenAiChatClientMethodInvokingFunctionCallbackIT.java

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.springframework.util.ReflectionUtils;
3838

3939
import static org.assertj.core.api.Assertions.assertThat;
40-
import static org.assertj.core.api.Assertions.assertThatCode;
4140
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
4241

4342
@SpringBootTest(classes = OpenAiTestConfiguration.class)
@@ -166,12 +165,12 @@ void methodGetWeatherToolContext() {
166165
}
167166

168167
@Test
169-
void methodGetWeatherNonStaticButWithToolContext() {
168+
void methodGetWeatherToolContextButMissingContextArgument() {
170169

171170
TestFunctionClass targetObject = new TestFunctionClass();
172171

173-
var toolMethod = ReflectionUtils.findMethod(TestFunctionClass.class, "getWeatherNonStatic", String.class,
174-
Unit.class);
172+
var toolMethod = ReflectionUtils.findMethod(TestFunctionClass.class, "getWeatherWithContext", String.class,
173+
Unit.class, ToolContext.class);
175174

176175
// @formatter:off
177176
assertThatThrownBy(() -> ChatClient.create(this.chatModel).prompt()
@@ -183,37 +182,13 @@ void methodGetWeatherNonStaticButWithToolContext() {
183182
.toolMethod(toolMethod)
184183
.toolObject(targetObject)
185184
.build())
186-
.toolContext(Map.of("tool-context", "value"))
187185
.call()
188186
.content())
189187
.isInstanceOf(IllegalArgumentException.class)
190188
.hasMessage("ToolContext is required by the method as an argument");
191189
// @formatter:on
192190
}
193191

194-
@Test
195-
void methodGetWeatherToolContextButWithoutToolContext() {
196-
197-
TestFunctionClass targetObject = new TestFunctionClass();
198-
199-
var toolMethod = ReflectionUtils.findMethod(TestFunctionClass.class, "getWeatherWithContext", String.class,
200-
Unit.class, ToolContext.class);
201-
202-
// @formatter:off
203-
assertThatCode(() ->ChatClient.create(this.chatModel).prompt()
204-
.user("What's the weather like in San Francisco, Tokyo, and Paris? Use Celsius.")
205-
.toolCallbacks(MethodToolCallback.builder()
206-
.toolDefinition(ToolDefinitions.builder(toolMethod)
207-
.description("Get the weather in location")
208-
.build())
209-
.toolMethod(toolMethod)
210-
.toolObject(targetObject)
211-
.build())
212-
.call()
213-
.content()).doesNotThrowAnyException();
214-
// @formatter:on
215-
}
216-
217192
@Test
218193
void methodNoParameters() {
219194

0 commit comments

Comments
 (0)