semantic-kernel
semantic-kernel copied to clipboard
Copilot Chat - Bot portability
Motivation and Context
This change enables download/upload a bot in the Copilot Chat app. It is the first step to demonstrate the idea of "bots are documents". With Semantic Kernel memory and chat history, users can authorize/update/share bots with others, like write a document. We would like to inspire SK developers with this example and learn from their real-world use cases in order to take the idea further.
Description
- UX controls to trigger download/upload a bot file. Now we only support download/upload files from the user's computer.
- API endpoints to expose the upload/download functionality.
- Download: Export 1) chat message history from the given chat session (id: chat id), 2) embeddings from SK memory store.
- Upload: Import 1) chat message history to a new chat session, 3) embeddings to SK memory store. (Note: Copilot Chat messages are not linked to SK memory id.)
- Bot schema v1.0. It defines what is stored in a bot file - 1) schema version info (for compatibility), 2) chat history, 3) embeddings from the conversation, 4) the AI service information that generated the embeddings.
- Error handlings:
- If schema in the file and in the app config mismatch, the API throws exception. For embedding mismatches, further enhancement could be done to generate new embeddings.
- If import failed in any step, we throw an exception. A further work item here to revert changes in each store to make it transactional.
Contribution Checklist
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with
dotnet format
- [] ~All unit tests pass, and I have added new tests where possible~
- [x] I didn't break anyone :smile: