Skip to content

Conversation

@CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Feb 4, 2025

Context

AI/ai-sdk-java-backlog#162.

Tool calling are supported by the Orchestration Spring AI integration
Tool execution is not yet supported by orchestration

Feature scope:

  • Added support for tool calls in Spring AI

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Feb 4, 2025
@CharlesDuboisSAP CharlesDuboisSAP changed the title feat: Spring AI🍃tool calls feat: Spring AI🍃Function Calling (tool calls) Feb 5, 2025
val message = SingleChatMessage.create().role(role).content("");

val maps = toolCalls().stream().map(ToolCall::map).toList();
message.setCustomField("tool_calls", maps);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe create a small follow-up BLI to update this once fixed in the spec so that we don't forget 😄

if (!isProxyToolCalls(prompt, options)
&& isToolCall(response, Set.of("tool_calls", "stop"))) {
val toolCallConversation = handleToolCalls(prompt, response);
// Recursively call the call method with the tool call message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is ensured that the recursion terminates?

Copy link
Contributor Author

@CharlesDuboisSAP CharlesDuboisSAP Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can neither ensure proper LLM answers or proper customer defined functions 🤷
Note: an infinite loop would be a function that returns a question about itself

@CharlesDuboisSAP CharlesDuboisSAP changed the title feat: Spring AI🍃Function Calling (tool calls) feat: Spring AI🍃Tool Calling Feb 19, 2025
@CharlesDuboisSAP CharlesDuboisSAP added the please-review Request to review a pull-request label Feb 19, 2025
@newtork newtork requested a review from rpanackal February 19, 2025 13:53
@Override
public ChatMessage createChatMessage() {
if (toolCalls() != null) {
// content shouldn't be required for tool calls 🤷
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor)

Please remove emoji

@CharlesDuboisSAP CharlesDuboisSAP merged commit 6ba9954 into main Feb 21, 2025
6 checks passed
@CharlesDuboisSAP CharlesDuboisSAP deleted the spring-ai🍃tools branch February 21, 2025 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please-review Request to review a pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants