Commit 9c1396d
authored
feat: AI Chat and embeddings (#763)
A bunch of files were just deleted :)
Fixes #168
Fixes IntelliTect-dev/EssentialCSharp.Tooling#901
<details>
<summary>PR Summary</summary>
This pull request introduces significant enhancements to integrate Azure
OpenAI services and vector search capabilities into the project. Key
changes include adding dependencies for AI and vector search tools,
creating new services for AI chat and search functionality, and defining
models and configurations to support these features.
### Dependency and Configuration Updates:
*
[`Directory.Packages.props`](diffhunk://#diff-5baf5f9e448ad54ab25a091adee0da05d4d228481c9200518fcb1b53a65d4156R39-R47):
Added new package dependencies, including `Microsoft.SemanticKernel`,
`ModelContextProtocol`, and `System.CommandLine`, to enable AI and
vector search functionality.
*
[`EssentialCSharp.Chat.Common.csproj`](diffhunk://#diff-f4e3de9b154fa0162fee1cd9a75b70d7ffff3b3ca7b34028a3a36b2345a0bca8R1-R20):
Configured project properties and added package references for Azure
OpenAI and vector search integration.
### AI Service Implementation:
*
[`EssentialCSharp.Chat.Shared/Services/AIChatService.cs`](diffhunk://#diff-2e3a8204c3630d2aad08cd1583dd37bb97b89bebdb390cd9684fbdd60615f710R1-R348):
Introduced `AIChatService`, which handles AI chat completions using
Azure OpenAI. It supports both single and streaming responses,
contextual prompt enrichment via vector search, and function call
execution.
*
[`EssentialCSharp.Chat.Shared/Services/AISearchService.cs`](diffhunk://#diff-ab2dec801c787671ce9cf9e09dec9932c670b5f54e02f866a094bccc27e399a8R1-R27):
Added `AISearchService` to execute vector searches on book content
chunks using embeddings generated by the `EmbeddingService`.
### Data Models and Extensions:
*
[`EssentialCSharp.Chat.Shared/Models/BookContentChunk.cs`](diffhunk://#diff-6c4785393661a1f777dce26db779b2c20341b7a0eb8b1bd954d157d3c669d82cR1-R54):
Defined `BookContentChunk` to represent chunks of book content for
vector search, including metadata and vector embeddings.
*
[`EssentialCSharp.Chat.Shared/Models/AIOptions.cs`](diffhunk://#diff-66e64dc8790347f86e8ebce8a3e7fc8b25a9694ddb514ea3f90522bb81310395R1-R34):
Created `AIOptions` to centralize configuration for Azure OpenAI
services and PostgreSQL vector store.
*
[`EssentialCSharp.Chat.Shared/Extensions/ServiceCollectionExtensions.cs`](diffhunk://#diff-44e37562fe51903c9f707ccc04677a25b2e37691b1a7dead5d62cc2f76004d83R1-R80):
Added extension methods to register Azure OpenAI services and PostgreSQL
vector store in the dependency injection container.
</details>
Screenshot:
<img width="1342" height="1144" alt="image"
src="https://github.com/user-attachments/assets/71dbf972-7ff4-45ed-b161-f80e9c342ff2"
/>1 parent 9d25818 commit 9c1396d
63 files changed
Lines changed: 3667 additions & 55003 deletions
File tree
- .github/workflows
- EssentialCSharp.Chat.Tests
- EssentialCSharp.Chat
- Properties
- EssentialCSharp.Web
- Controllers
- Services
- wwwroot
- css
- js
- lib/vue
- compiler-sfc
- dist
- server-renderer
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
154 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | | - | |
| 163 | + | |
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
| |||
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
236 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
240 | | - | |
| 250 | + | |
| 251 | + | |
241 | 252 | | |
242 | 253 | | |
243 | | - | |
| 254 | + | |
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | | - | |
| 54 | + | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 85 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments