-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Spring AI🍃Tool Calling #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "spring-ai\u{1F343}tools"
Conversation
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Outdated
Show resolved
Hide resolved
orchestration/src/test/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModelTest.java
Show resolved
Hide resolved
| val message = SingleChatMessage.create().role(role).content(""); | ||
|
|
||
| val maps = toolCalls().stream().map(ToolCall::map).toList(); | ||
| message.setCustomField("tool_calls", maps); |
There was a problem hiding this comment.
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 😄
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Outdated
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java
Show resolved
Hide resolved
| @Override | ||
| public ChatMessage createChatMessage() { | ||
| if (toolCalls() != null) { | ||
| // content shouldn't be required for tool calls 🤷 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Minor)
Please remove emoji
orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java
Show resolved
Hide resolved
orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java
Outdated
Show resolved
Hide resolved
…g/OrchestrationChatModel.java Co-authored-by: Alexander Dümont <[email protected]>
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