Feature: Store chat history in Cosmos DB
Open
fujita-h
opened this issue 1 year ago
•
1 comments
Purpose
This PR extends the chat history feature added in #1988 to store chat history server-side (Cosmos DB) when user authentication is enabled.
Does this introduce a breaking change?
When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.
[ ] Yes
[x] No
Does this require changes to learn.microsoft.com docs?
This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.
[ ] Yes
[x] No
Type of change
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
Code quality checklist
See CONTRIBUTING.md for more details.
[x] The current tests all pass (python -m pytest).
[ ] I added tests that prove my fix is effective or that my feature works
[ ] I ran python -m pytest --cov to verify 100% coverage of added lines
[x] I ran python -m mypy to check for type errors
[x] I either used the pre-commit hooks or ran ruff and black manually on my code.
Woot! I know this is a very popular request, thanks for the PR, I'll review it this week. In the meantime, if anyone subscribed tries it out as well, please report on the PR with your feedback as well. I'll also ask Cosmos DB team to take a look.
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://aka.ms/entgptsearchblog2702 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure/ba-p/3956408274
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/azure-architecture-blog/azure-openai-landing-zone-reference-architecture/ba-p/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in/ba-p/3960809#:~:text=Integrated%20vectorization%20is%20a%20new%20feature%20of%20Azure,pull-indexers%2C%20and%20vectorization%20of%20text%20queries%20through%20vectorizers218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in/ba-p/3960809#:~:text=Integrated%20vectorization%20is%20a%20new%20feature%20of%20Azure,pull-indexers%2C%20and%20vectorization%20of%20text%20queries%20through%20vectorizers68
samples/data-ingestion/README.md
# Link Line Number 1 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in/ba-p/3960809#:~:text=Integrated%20vectorization%20is%20a%20new%20feature%20of%20Azure,pull-indexers%2C%20and%20vectorization%20of%20text%20queries%20through%20vectorizers88
samples/chat/README.md
# Link Line Number 1 https://aka.ms/entgptsearchblog2722 https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure/ba-p/3956408276
I'm reviewing now, have made a few cosmetic changes and added a test. I'll add a few more tests tomorrow and test my deploy. Have also asked a Cosmos DB colleague to review.
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w-azure-openai-and/37620872922 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure-ai-search/3956408296
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azurearchitectureblog/azure-openai-landing-zone-reference-architecture/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/3960809218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/396080978
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w-azure-openai-and/37620872922 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure-ai-search/3956408296
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azurearchitectureblog/azure-openai-landing-zone-reference-architecture/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/3960809218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/396080978
Update: I found an issue with the authentication decorator being used for the /items/id get and delete routes and have fixed it. It's working well for me locally now.
I'll add additional pytests tomorrow.
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w-azure-openai-and/37620872922 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure-ai-search/3956408296
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azurearchitectureblog/azure-openai-landing-zone-reference-architecture/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/3960809218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/396080978
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w-azure-openai-and/37620872922 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure-ai-search/3956408296
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azurearchitectureblog/azure-openai-landing-zone-reference-architecture/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/3960809218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/396080978
@fujita-h I added pytest for 97% coverage of CosmosDB. While adding the tests, I made a few changes:
400 instead of 405 for CosmosDB feature disabled (I think 405 is meant to specifically indicate that a different HTTP method would have worked, but none would work in this case)
204 instead of 200 for successful item deletion, as that seems to be the web convention
Removed the check in the "/item_id" paths for "if not item_id" as I don't think there's any possible way to reach that code path- if no item_id is specified, it won't match the route and will 404 instead.
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/revolutionize-your-enterprise-data-with-chatgpt-next-gen-apps-w-azure-openai-and/37620872922 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/access-control-in-generative-ai-applications-with-azure-ai-search/3956408296
docs/deploy_lowcost.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/392916743
docs/customization.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid-retrieval-and-ranking-ca/3929167120
docs/productionizing.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azurearchitectureblog/azure-openai-landing-zone-reference-architecture/388210286
docs/deploy_features.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/3960809218
docs/data_ingestion.md
# Link Line Number 1 https://techcommunity.microsoft.com/blog/azure-ai-services-blog/announcing-the-public-preview-of-integrated-vectorization-in-azure-ai-search/396080978
@pamelafox Thank you for adding the test, I have read and understood your corrections.
Check Broken URLs
We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.
Check the file paths and associated broken URLs inside them. For more details, check our Contributing Guide .
File Full Path
Issues
README.md
# Link Line Number 1 https://azure.microsoft.com/pricing/details/app-service/linux/902 https://azure.microsoft.com/pricing/details/search/93
I looked at the Bicep validation error but I think that is an unrelated issue, likely due to a newer version of Bicep that's stricter.