Skip to content

Commit 9a5ed0c

Browse files
authored
Added missing images and fixed formatting issues
1 parent 40b9e13 commit 9a5ed0c

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

aspnetcore/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,8 @@ items:
874874
displayName: signalr
875875
- name: Tutorials
876876
items:
877+
- name: AI-powered group chat
878+
uid: tutorials/ai-powered-group-chat
877879
- name: SignalR with JavaScript
878880
uid: tutorials/signalr
879881
- name: SignalR with TypeScript
46.8 KB
Loading

aspnetcore/tutorials/ai-powered-group-chat.md renamed to aspnetcore/tutorials/ai-powered-group-chat/ai-powered-group-chat.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
---
2-
title: Building AI-Powered Group Chat with SignalR and OpenAI
2+
title: Build an AI-Powered Group Chat with SignalR and OpenAI
33
author: kevinguo-ed
4-
description: ...
5-
ms.author: ...
4+
description: A tutorial explaining how SignalR and OpenAI are used together to build an AI-powered group chat
5+
ms.author: kevinguo
66
ms.date: 08/27/2024
7+
uid: tutorials/ai-powered-group-chat
78
---
89

910
## Overview
1011

11-
The integration of AI into applications is rapidly becoming a must-have for developers looking to help their users be more creative, productive and achieve their health goals. AI-powered features, such as intelligent chatbots, personalized recommendations, and contextual responses, add significant value to modern apps. The AI-powered apps that came out since Chat GPT captured our imagination are primarily between one user and one AI assistant. As developers get more comfortable with the capabilities of AI, they are exploring AI-powered apps in a team's context. They ask "what value can AI add to a team of collaborators"?
12+
The integration of AI into applications is rapidly becoming a must-have for developers looking to help their users be more creative, productive and achieve their health goals. AI-powered features, such as intelligent chatbots, personalized recommendations, and contextual responses, add significant value to modern apps. The AI-powered apps that came out since ChatGPT captured our imagination are primarily between one user and one AI assistant. As developers get more comfortable with the capabilities of AI, they are exploring AI-powered apps in a team's context. They ask "what value can AI add to a team of collaborators"?
1213

1314
This tutorial guides you through building a real-time group chat application. Among a group of human collaborators in a chat, there's an AI assistant which has access to the chat history and can be invited to help out by any collaborator when they start the message with `@gpt`. The finished app looks like this.
1415

15-
{{Chat interface missing...}}
16+
:::image type="content" source="./ai-powered-group-chat.jpg" alt-text="user interface for the AI-powered group chat":::
1617

17-
We use Open AI for generating intelligent, context-aware responses and SignalR for delivering the response to users in a group. You can find the complete code [in this repo](https://github.com/microsoft/SignalR-Samples-AI/tree/main/AIStreaming).
18+
We use OpenAI for generating intelligent, context-aware responses and SignalR for delivering the response to users in a group. You can find the complete code [in this repo](https://github.com/microsoft/SignalR-Samples-AI/tree/main/AIStreaming).
1819

1920
## Dependencies
20-
You can use either Azure Open AI or Open AI for this project. Make sure to update the `endpoint` and `key` in `appsetting.json`. `OpenAIExtensions` reads the configuration when the app starts and they are required to authenticate and use either service.
21+
You can use either Azure OpenAI or OpenAI for this project. Make sure to update the `endpoint` and `key` in `appsetting.json`. `OpenAIExtensions` reads the configuration when the app starts and they are required to authenticate and use either service.
2122

22-
# [Open AI](#tab/open-ai)
23+
# [OpenAI](#tab/open-ai)
2324
To build this application, you will need the following:
2425
* ASP.NET Core: To create the web application and host the SignalR hub.
2526
* [SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client): For real-time communication between clients and the server.
2627
* [OpenAI Client](https://www.nuget.org/packages/OpenAI/2.0.0-beta.10): To interact with OpenAI's API for generating AI responses.
2728

28-
# [Azure Open AI](#tab/azure-open-ai)
29+
# [Azure OpenAI](#tab/azure-open-ai)
2930
To build this application, you will need the following:
3031
* ASP.NET Core: To create the web application and host the SignalR hub.
3132
* [SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client): For real-time communication between clients and the server.
32-
* [Azure Open AI](https://www.nuget.org/packages/Azure.AI.OpenAI/2.0.0-beta.3): Azure.AI.OpenAI
33+
* [Azure OpenAI](https://www.nuget.org/packages/Azure.AI.OpenAI/2.0.0-beta.3): Azure.AI.OpenAI
3334
---
3435

3536
## Implementation
3637

3738
In this section, we'll walk through the key parts of the code that integrate SignalR with OpenAI to create an AI-enhanced group chat experience.
3839

39-
### SignalR Hub integration**
40+
### Data flow
41+
42+
:::image type="content" source="./sequence-diagram-ai-powered-group-chat.png" alt-text="sequence diagram for the AI-powered group chat":::
43+
44+
### SignalR Hub integration
4045

4146
The `GroupChatHub` class manages user connections, message broadcasting, and AI interactions. When a user sends a message starting with `@gpt`, the hub forwards it to OpenAI, which generates a response. The AI's response is streamed back to the group in real-time.
4247
```csharp
@@ -80,7 +85,7 @@ public void UpdateGroupHistoryForAssistant(string groupName, string message)
8085
}
8186
```
8287

83-
### Explore further
88+
## Explore further
8489

8590
This project opens up exciting possibilities for further enhancement:
8691
1. **Advanced AI features**: Leverage other OpenAI capabilities like sentiment analysis, translation, or summarization.
42.2 KB
Loading

0 commit comments

Comments
 (0)