add functionCallbackWrapper direct function to register a function at client
Comment From: xixingya
the issue is https://github.com/spring-projects/spring-ai/issues/1052
Comment From: xixingya
@tzolov Could you review this pull request?
Comment From: tzolov
partially resolved by feb036d2f6534505ad0bdac12925f93a52737e73, there rest will be submitted in a separate PR.
Comment From: xixingya
partially resolved by feb036d, there rest will be submitted in a separate PR.
Thank you, we really need this function. We're looking forward to seeing it added to the codebase.
Comment From: xixingya
partially resolved by feb036d, there rest will be submitted in a separate PR.
we need register the functionWrapper direct at DefaultChatClientRequestSpec. maybe not azure openai?
Comment From: tzolov
sorry i closed wrong PR
Comment From: xixingya
@tzolov Could you review this pull request?
Comment From: tzolov
@xixingya thank you for the update. Could you please add and integration tests, for example extend the https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/client/OpenAiChatClientIT.java or similar that demo and tests your usecase: https://github.com/spring-projects/spring-ai/issues/1052#issuecomment-2230395585
Comment From: xixingya
@xixingya thank you for the update. Could you please add and integration tests, for example extend the https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/client/OpenAiChatClientIT.java or similar that demo and tests your usecase: #1052 (comment)
@tzolov I have add test case at OpenAiChatClientIT, please take a look
Comment From: tzolov
@xixingya after exploring your use-case/test I realized that what you actually need is ability to provide the input type explicitly in case of Lambda Functions. It seems that Java doesn't retains the generic types for Lambda function definitions, which means that we can not infer those types from the function instance itself. The simplest solution was to extend the functions definition with additional input type argument: https://github.com/spring-projects/spring-ai/blob/6270d627f1248768b2d9a226b835ec6d83e9db94/spring-ai-core/src/main/java/org/springframework/ai/chat/client/DefaultChatClient.java#L616
This part of the 6270d627f1248768b2d9a226b835ec6d83e9db94 commit (added you as a co-author) and it resolves the provided ITs: https://github.com/spring-projects/spring-ai/blob/6270d627f1248768b2d9a226b835ec6d83e9db94/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/client/OpenAiChatClientMultipleFunctionCallsIT.java#L130
Also i will commit shortly some utils to help creating Functions from Methods with random list of input arguments.
Comment From: tzolov
Replaced by 6270d627f1248768b2d9a226b835ec6d83e9db94