refactor(core): extract common function callback builder functionality
Extracts shared function callback builder functionality into DefaultCommonCallbackInvokingSpec base class, reducing code duplication across builder implementations. Makes FunctionInvokingSpec and MethodInvokingSpec extend CommonCallbackInvokingSpec for better code organization. Also fixes function/description builder order in Anthropic tests. - Introduced a common base class for function callback builders to centralize shared logic - Standardized the order of method chaining for function and description in multiple AI model test classes - Refactored test cases across various AI model integrations - Corrected builder method order from .description().function() to .function().description() and .description().method() to .method().description() - Updated multiple test files to consistently use .function() before .description() - Updated documentation examples to reflect new builder method order - Modified DefaultFunctionCallbackResolver to maintain new builder method order - Updated DefaultChatClient and ChatClient test classes to reflect new builder pattern - Simplified callback specification by removing parent spec reference - Removed cascading getter logic for description, schema type, and other properties - Minor adjustments to function callback builder and invoking specs
This commit is contained in:
committed by
Ilayaperumal Gopinathan
parent
dcc8d5b620
commit
6a195ee9fe
@@ -68,8 +68,8 @@ public class ChatCompletionRequestTests {
|
||||
MiniMaxChatOptions.builder()
|
||||
.withModel("PROMPT_MODEL")
|
||||
.withFunctionCallbacks(List.of(FunctionCallback.builder()
|
||||
.description("Get the weather in location")
|
||||
.function(TOOL_FUNCTION_NAME, new MockWeatherService())
|
||||
.description("Get the weather in location")
|
||||
.inputType(MockWeatherService.Request.class)
|
||||
.build()))
|
||||
.build()),
|
||||
@@ -95,8 +95,8 @@ public class ChatCompletionRequestTests {
|
||||
MiniMaxChatOptions.builder()
|
||||
.withModel("DEFAULT_MODEL")
|
||||
.withFunctionCallbacks(List.of(FunctionCallback.builder()
|
||||
.description("Get the weather in location")
|
||||
.function(TOOL_FUNCTION_NAME, new MockWeatherService())
|
||||
.description("Get the weather in location")
|
||||
.inputType(MockWeatherService.Request.class)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -127,8 +127,8 @@ public class ChatCompletionRequestTests {
|
||||
request = client.createRequest(new Prompt("Test message content",
|
||||
MiniMaxChatOptions.builder()
|
||||
.withFunctionCallbacks(List.of(FunctionCallback.builder()
|
||||
.description("Overridden function description")
|
||||
.function(TOOL_FUNCTION_NAME, new MockWeatherService())
|
||||
.description("Overridden function description")
|
||||
.inputType(MockWeatherService.Request.class)
|
||||
.build()))
|
||||
.build()),
|
||||
|
||||
Reference in New Issue
Block a user