-
Notifications
You must be signed in to change notification settings - Fork 211
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
Add Conversation AI to Java SDK #1235
base: master
Are you sure you want to change the base?
Add Conversation AI to Java SDK #1235
Conversation
68d30ee
to
9a8926e
Compare
@salaboy, @artur-ciocanu please let me know what you think. Working on integration and unit tests in the meanwhile |
Great contribution, thanks @siri-varma |
9a8926e
to
4cb6031
Compare
Signed-off-by: Siri Varma Vegiraju <[email protected]> Signed-off-by: sirivarma <[email protected]>
4cb6031
to
75f487f
Compare
this is great @siri-varma ! I will start reviewing soon! |
Signed-off-by: sirivarma <[email protected]>
bf70fd4
to
88fe015
Compare
For integration tests, we must spin up a mock for third party LLM endpoint. Do we have similar patterns in the current setup? (where dapr is talking to a third party api and receiving responses) |
import java.util.Map; | ||
import java.util.function.Consumer; | ||
|
||
public class DaprConversationClient implements AutoCloseable, DaprAiClient { |
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.
@siri-varma I assume that you know that we had a previewClient, why is this introducing a new separated client for the conversation API? I would assume that we want to include this in PreviewClient first. @yaron2 we might need your help here.
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.
and sorry for the confusion if the PreviewClient is an old thing that we are not supposed to use anymore. As the workflows now have their own separate client, this might be the way to go.
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.
Just to clarify, we are fine with current approach right ?
sdk-ai/pom.xml
Outdated
<artifactId>dapr-sdk-ai</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.15.0-SNAPSHOT</version> | ||
<name>dapr-sdk-ai</name> |
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.
@siri-varma should we call it conversation? instead of ai
? as ai
is too generic
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.
Changed to conversation
sdk-ai/pom.xml
Outdated
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> |
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.
@siri-varma please include the nexus plugin as shown in here: https://github.com/dapr/java-sdk/blob/master/dapr-spring/pom.xml#L95
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.
added the nexus plugin
@siri-varma this is looking good, I left some comments that basically highlight my doubts about some JDK general topics. But this is looking really good, are you planning to add integration tests inside the |
@salaboy I have tested the code by running it locally and using my OpenAI API Key.
Will get back to you on the integ tests |
Signed-off-by: sirivarma <[email protected]>
…om/siri-varma/java-sdk into users/svegiraju/conversation-api-2
Yeah check this https://java.testcontainers.org/modules/ollama/ |
@salaboy thank you for providing the testcontainer urls. Like how we have url overrides for Scheduler, I was looking one for conversation too because we will have to point dapr to the local llm model. But could not find any I tried looking in the below places and could not find anything. https://github.com/dapr/dapr/blob/2e7c61e933099b9d40fcdefbd57cc3e81069915a/pkg/injector/annotations/annotations.go#L73 |
@siri-varma thanks a lot for your contribution. I have reviewed your PR and I have a few comments similar to #1255:
|
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.
@siri-varma thanks a lot for your contribution, I have left a longer comment with some of my thoughts.
Please take a look and let me know what you think.
Signed-off-by: sirivarma <[email protected]>
115b5e7
to
842b0e7
Compare
Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>
@artur-ciocanu Addressed all the comments here as well. |
PR Overview: Conversation AI SDK Integration
This PR introduces the Conversation AI SDK with the Converse API. The implementation is structured into the following categories:
Core Logic
The core logic is implemented in a key class, as detailed below:
- Validates inputs and manages job execution.
API Contracts
The following is the method signature for the Dapr Converse API:
Dapr Converse API
This method interacts with the Dapr Converse API.
conversationComponentName
daprConversationInputs
contextId
scrubPii
temperature
DaprConversationResponse
Models
The SDK follows the builder pattern for constructing models, ensuring cleaner and more maintainable object creation.
Tests
The testing strategy includes:
Issue Reference
We ensure that all PRs are linked to a relevant issue where the problem or feature has been discussed before implementation.
This PR closes the following issue: #1101
Checklist ✅
Please confirm the following before merging: