feat: Spring AI🍃Tool Calling#320
Merged
CharlesDuboisSAP merged 43 commits intomainfrom Feb 21, 2025
Hidden character warning
The head ref may contain hidden characters: "spring-ai\ud83c\udf43tools"
Merged
Conversation
newtork
reviewed
Feb 5, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 5, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 5, 2025
orchestration/src/test/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModelTest.java
Show resolved
Hide resolved
MatKuhr
reviewed
Feb 6, 2025
| val message = SingleChatMessage.create().role(role).content(""); | ||
|
|
||
| val maps = toolCalls().stream().map(ToolCall::map).toList(); | ||
| message.setCustomField("tool_calls", maps); |
Member
There was a problem hiding this comment.
maybe create a small follow-up BLI to update this once fixed in the spec so that we don't forget 😄
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolCall.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Outdated
Show resolved
Hide resolved
| 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 |
Member
There was a problem hiding this comment.
how is ensured that the recursion terminates?
Contributor
Author
There was a problem hiding this comment.
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
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
| @Override | ||
| public ChatMessage createChatMessage() { | ||
| if (toolCalls() != null) { | ||
| // content shouldn't be required for tool calls 🤷 |
Contributor
There was a problem hiding this comment.
(Minor)
Please remove emoji
newtork
reviewed
Feb 19, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Feb 19, 2025
…g/OrchestrationChatModel.java Co-authored-by: Alexander Dümont <22489773+newtork@users.noreply.github.com>
newtork
approved these changes
Feb 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Definition of Done
Aligned changes with the JavaScript SDK