-
Notifications
You must be signed in to change notification settings - Fork 96
Add SK chat support #47
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
Conversation
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.
Can you rebase this with the new commits on the main. Furthermore make sure to synchronize with the last UI changes from john Oliver PR #44.
Other comments are inline.
app/backend/src/main/java/com/microsoft/openai/samples/rag/Application.java
Outdated
Show resolved
Hide resolved
...nai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java
Outdated
Show resolved
Hide resolved
...nai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java
Outdated
Show resolved
Hide resolved
.../openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelChainsChatApproach.java
Show resolved
Hide resolved
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.
PR looks good. 2 additional comments:
- I think you lost chat.tsx UI changes when you merged the last commits from main on your branch.
- Could you also add the streaming support
see this:
f51e6f5#diff-506debba46b93087dc46a916384e56392808bcc02a99d9291557f3e674d4ad6c
[https://avatars.githubusercontent.com/u/4893321?s=400&v=4]<https://github.com/Azure-Samples/azure-search-openai-demo-java/pull/47/commits/f51e6f57af4cf75a365b5c3e34c2b0d153d9668b#diff-506debba46b93087dc46a916384e56392808bcc02a99d9291557f3e674d4ad6c>
Add SK chat support by milderhc · Pull Request #47 · Azure-Samples/azure-search-openai-demo-java<f51e6f5#diff-506debba46b93087dc46a916384e56392808bcc02a99d9291557f3e674d4ad6c>
Purpose Adding chat using Semantic Kernel. Does this introduce a breaking change? [ ] Yes [x] No Pull Request Type What kind of change does this Pull Request introduce? [ ] Bugfix [x] Feature [...
github.com
…________________________________
From: Milder Hernandez ***@***.***>
Sent: Tuesday, October 31, 2023 6:52 PM
To: Azure-Samples/azure-search-openai-demo-java ***@***.***>
Cc: Davide Antelmo ***@***.***>; Mention ***@***.***>
Subject: Re: [Azure-Samples/azure-search-openai-demo-java] Add SK chat support (PR #47)
Ignore that last request review.
Could you point me to the first comment? I don't see this PR introducing any new changes to app/frontend/src/pages/chat/Chat.tsx.
—
Reply to this email directly, view it on GitHub<#47 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A2623W63ZVVBZ3I25PI2ZQ3YCE3GLAVCNFSM6AAAAAA6O7NTGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXG4YDKNBYHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hey @dantelmomsft , can you please review this carefuly? |
I added streaming to SK implementation, but as we don't support streaming on the SKFunctions, I'm returning the whole response in the Let me know if this is okay or would like to implement |
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.
String question = ChatGPTUtils.getLastUserQuestion(questionOrConversation.getMessages()); | ||
|
||
Kernel semanticKernel = buildSemanticKernel(options); | ||
|
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.
getSourcesFromCOnversation is missing. See what you've done here:
https://github.com/Azure-Samples/azure-search-openai-demo-java/pull/47/files#diff-b6597742f55dcf06e09eb19c789531ec2b2273fb3b56bd97fd929afbc451e5d5R77
Consider to refactor to one common method used both by the JavaSemanticKernelChainsChatApproach and JavaSemanticKernelWithMemoryChatApproach
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.
get sources using extract keywords is still missing in the new commit. Please review the previous comment.
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.
Thanks! Extracting keywords by using getSourcesFromConversation
only applies to SK with memory approach, as it only uses semantic functions. SK chaining uses both, native and semantic functions, so I instead added a new native function to CognitiveSearchPlugin
to search the keywords using that function. I moved the plugin to the retrieval
package as well.
Let me know what you think
I was not aware java SK didn't support streaming.. in this case I would just leave it as "Not Implemented" for the time being. .@johnoliver WDYT ? |
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.
If you agree with the strategy I've shared in my last comment, we should at least add a dedicated production environment and deploy the tagged release. After that we can start use CI + scheduled daily build pipelines on the current dev environment. Please bring back the infra validation CI pipeline.
@dantelmomsft I disabled streaming for SK approaches. I am also not sure if you meant the last comment for this PR. |
.../openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelChainsChatApproach.java
Outdated
Show resolved
Hide resolved
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Simple chat-read-retrieve-read java implementation, using the Cognitive Search and OpenAI APIs directly. |
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.
Please review the description looking at the the JavaSemanticKernelChainsApproach.
Please add this new approach to the implementations table in the README: https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/README.md#rag-implementation-options
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.
I'll update it once you agree with the last changes I added.
String question = ChatGPTUtils.getLastUserQuestion(questionOrConversation.getMessages()); | ||
|
||
Kernel semanticKernel = buildSemanticKernel(options); | ||
|
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.
get sources using extract keywords is still missing in the new commit. Please review the previous comment.
...nai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java
Show resolved
Hide resolved
@milderhc PR approved. before merging can you make sure to update the README with the new approaches as mentioned in my last comment. thanks and great work. |
Purpose
Adding chat using Semantic Kernel.
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Other Information