Azure-Samples / azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
https://azure.microsoft.com/products/search
MIT License
5.86k stars 4k forks source link

Bringing in history/capture from sample-app-aoai-chatGPT #1863

Open hfaouaz-rcg opened 1 month ago

hfaouaz-rcg commented 1 month ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

To Capture and maintain question/answers in cosmos. I was able to refactor current codebase and chatGPT code base to capture questions in cosmos. still some work needs to be done, but I am wondering if this feature is on the roadmap. Once I have a complete working solution, I will create a feature enhancement PR.

Build cosmos biceps <- done provide api for history capture/generate/list <- done capture question <-done capture answer session base/conversation base

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

azd version?

run azd version and copy paste here.

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

DuboisABB commented 1 month ago

This seems like a duplicate of #489. There is also a stale PR that implemented this (although probably not based on sample-app-aoai-chatGPT): #259 I'm also interested in this functionality. Do you have a public fork where I could follow your development? I might be able to contribute too, as I had also planned on doing this.

hfaouaz-rcg commented 1 month ago

This seems like a duplicate of #489. There is also a stale PR that implemented this (although probably not based on sample-app-aoai-chatGPT): #259 I'm also interested in this functionality. Do you have a public fork where I could follow your development? I might be able to contribute too, as I had also planned on doing this.

Hi @DuboisABB . I am currently developing it for a client. Let me see if I can create a fork minus clients changes. would love the help.

cloudhunnter commented 1 month ago

I also have a client asking for this kind of feature. @hfaouaz-rcg did you made any steps towards a working solution? What kind of services do you implement for this? i was thinking about cosmos db, but im fairly new to databases tbh.

DuboisABB commented 1 month ago

This request is pretty much the same: #1822

idrisfl commented 1 week ago

I'm also interested in this kind of feature for one of my clients. We are looking to implement a feedback loop on the responses, which would be stored in a Cosmos DB.

cloudhunnter commented 1 week ago

Yesterday, I was able to successfully store a full chat history in my CosmosDB for the first time. This was done from a local environment using my deployment user. I haven’t had the chance to further test and refine the implementation yet. Some adjustments and optimizations are definitely still needed. Additionally, I need to consider the exact timing of when the data should be stored. This has already been implemented within the scope of a client project, so it’s no longer very "general."

I largely based my work on this reference (https://github.com/Azure-Samples/azure-search-openai-demo/pull/259) and adapted the components necessary for my use case. My goal is simply to enable the evaluation of the chat histories in the background to determine whether the source data needs to be optimized. So, i almost skipped the whole frontend part for the user and only focused on the backend app.py, api and adjusted the bicep, so the cosmosdb is already been created with everything else. I also ran into a role problem, which took me a while to solve, because for querying a cosmosDB you need a role thats not been visible in the azure roles UI 😄

hfaouaz-rcg commented 1 week ago

Hello @idrisfl , @cloudhunnter and @DuboisABB . This is my fork that I created for a client. It will capture the question and answer json into cosmos. I also included the bicep to create the cosmos.

You may need to add the following enviornments

AZURE_OPENAI_MODEL="gpt-4o" AZURE_OPENAI_ENDPOINT="https://xxxxxxxx.openai.azure.com/" AZURE_COSMOSDB_ACCOUNT="cosmos-accountname" AZURE_COSMOSDB_DATABASE="db_conversation_history" AZURE_COSMOSDB_CONVERSATIONS_CONTAINER="conversations" AZURE_COSMOSDB_ACCOUNT_KEY="" APPLICATIONINSIGHTS_CONNECTION_STRING=""

@pamelafox please look into this to see if we can integrate it. I moved some code from the https://github.com/microsoft/sample-app-aoai-chatGPT/tree/main project and made it work within the Chat flow. I can help with integration if needed.

Fork repo: https://github.com/hfaouaz-rcg/azure-search-openai-demo

Note: two new api added. history/generate history/list

Hope this help.