Skip to content

Commit 062ee87

Browse files
authored
0.10.0 preview (#4)
* Finished Agents implementation (some agent orchestrations) * Added Transcription Service (Audio To Text, Video To Text) (still work-in-progress) * Added Vision Service (Image To Text, Document To Text, Video To Images, Document to Images) (still work-in-progress) * Added Null IAudioToText and IImageToText for orchestrations not supporting Transcription and Vision. * Minor improvements across the solution.
1 parent 9146699 commit 062ee87

File tree

94 files changed

+2573
-488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2573
-488
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- master
99
env:
1010
APP_NAME: Vivet.AI
11-
VERSION: 0.9.0-preview
11+
VERSION: 0.10.0-preview
1212
NUGET_HOST: https://api.nuget.org/v3/index.json
1313
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
1414
jobs:

.tests/IntegrationTests.Vivet.AI/Hosting/HealthChecks/ChatModelHealthCheckTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
using Microsoft.SemanticKernel;
88
using Microsoft.SemanticKernel.ChatCompletion;
99
using Microsoft.VisualStudio.TestTools.UnitTesting;
10-
using Vivet.AI.Extensions;
1110
using Vivet.AI.Extensions.Consts;
11+
using Vivet.AI.Hosting.HealthChecks.Extensions;
1212

1313
namespace IntegrationTests.Vivet.AI.Hosting.HealthChecks;
1414

.tests/IntegrationTests.Vivet.AI/Hosting/HealthChecks/EmbeddingModelHealthCheckTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Microsoft.Extensions.DependencyInjection;
77
using Microsoft.Extensions.Diagnostics.HealthChecks;
88
using Microsoft.VisualStudio.TestTools.UnitTesting;
9-
using Vivet.AI.Extensions;
109
using Vivet.AI.Extensions.Consts;
10+
using Vivet.AI.Hosting.HealthChecks.Extensions;
1111

1212
namespace IntegrationTests.Vivet.AI.Hosting.HealthChecks;
1313

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using Microsoft.Extensions.Diagnostics.HealthChecks;
7+
using Microsoft.SemanticKernel;
8+
using Microsoft.SemanticKernel.ImageToText;
9+
using Microsoft.VisualStudio.TestTools.UnitTesting;
10+
using Vivet.AI.Extensions.Consts;
11+
using Vivet.AI.Hosting.HealthChecks.Extensions;
12+
13+
namespace IntegrationTests.Vivet.AI.Hosting.HealthChecks;
14+
15+
[TestClass]
16+
public class ImageExtractionModelHealthCheckTests : BaseTests
17+
{
18+
private const string FAKE_IMAGE_EXTRACTION_SERVICE_ID = "FAKE_IMAGE_EXTRACTION_SERVICE";
19+
20+
private HealthCheckService HealthCheckService => this.ServiceProvider.GetRequiredService<HealthCheckService>();
21+
22+
[TestInitialize]
23+
public override void TestSetup()
24+
{
25+
base.TestSetup();
26+
27+
this.services
28+
.AddKeyedSingleton<IImageToTextService>(FAKE_IMAGE_EXTRACTION_SERVICE_ID, new FakeImageToTextService())
29+
.AddKeyedSingleton(FAKE_IMAGE_EXTRACTION_SERVICE_ID, new PromptExecutionSettings())
30+
.AddHealthChecks()
31+
.AddImageExtractionModelCheck(FAKE_IMAGE_EXTRACTION_SERVICE_ID, FAKE_IMAGE_EXTRACTION_SERVICE_ID);
32+
}
33+
34+
[TestMethod]
35+
public async Task CheckHealthWhenIsHealthyTest()
36+
{
37+
var healthReport = await this.HealthCheckService.CheckHealthAsync();
38+
39+
var entry = healthReport.Entries[ServiceIds.VISION_SERVICE_ID];
40+
Assert.AreEqual(HealthStatus.Healthy, entry.Status, entry.Description);
41+
}
42+
43+
[TestMethod]
44+
public async Task CheckHealthkWhenIsUnhealthyTest()
45+
{
46+
var report = await this.HealthCheckService.CheckHealthAsync();
47+
var entry = report.Entries[FAKE_IMAGE_EXTRACTION_SERVICE_ID];
48+
49+
Assert.AreEqual(HealthStatus.Unhealthy, entry.Status);
50+
}
51+
52+
53+
private sealed class FakeImageToTextService : IImageToTextService
54+
{
55+
// ReSharper disable NotNullOrRequiredMemberIsNotInitialized
56+
// ReSharper disable UnassignedGetOnlyAutoProperty
57+
public IReadOnlyDictionary<string, object> Attributes { get; }
58+
// ReSharper restore UnassignedGetOnlyAutoProperty
59+
// ReSharper restore NotNullOrRequiredMemberIsNotInitialized
60+
61+
public Task<IReadOnlyList<TextContent>> GetTextContentsAsync(ImageContent content, PromptExecutionSettings executionSettings = null, Kernel kernel = null, CancellationToken cancellationToken = default)
62+
{
63+
throw new NotImplementedException();
64+
}
65+
}
66+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using Microsoft.Extensions.Diagnostics.HealthChecks;
7+
using Microsoft.SemanticKernel;
8+
using Microsoft.SemanticKernel.AudioToText;
9+
using Microsoft.VisualStudio.TestTools.UnitTesting;
10+
using Vivet.AI.Extensions.Consts;
11+
using Vivet.AI.Hosting.HealthChecks.Extensions;
12+
13+
namespace IntegrationTests.Vivet.AI.Hosting.HealthChecks;
14+
15+
[TestClass]
16+
public class TranscriptionModelHealthCheckTests : BaseTests
17+
{
18+
private const string FAKE_TRANSCRIPTION_SERVICE_ID = "FAKE_TRANSCRIPTION_SERVICE";
19+
20+
private HealthCheckService HealthCheckService => this.ServiceProvider.GetRequiredService<HealthCheckService>();
21+
22+
[TestInitialize]
23+
public override void TestSetup()
24+
{
25+
base.TestSetup();
26+
27+
this.services
28+
.AddKeyedSingleton<IAudioToTextService>(FAKE_TRANSCRIPTION_SERVICE_ID, new FakeAudioToTextService())
29+
.AddKeyedSingleton(FAKE_TRANSCRIPTION_SERVICE_ID, new PromptExecutionSettings())
30+
.AddHealthChecks()
31+
.AddTranscriptionModelCheck(FAKE_TRANSCRIPTION_SERVICE_ID, FAKE_TRANSCRIPTION_SERVICE_ID);
32+
}
33+
34+
[TestMethod]
35+
public async Task CheckHealthWhenIsHealthyTest()
36+
{
37+
var healthReport = await this.HealthCheckService.CheckHealthAsync();
38+
39+
var entry = healthReport.Entries[ServiceIds.TRANSCRIPTION_SERVICE_ID];
40+
Assert.AreEqual(HealthStatus.Healthy, entry.Status, entry.Description);
41+
}
42+
43+
[TestMethod]
44+
public async Task CheckHealthkWhenIsUnhealthyTest()
45+
{
46+
var report = await this.HealthCheckService.CheckHealthAsync();
47+
var entry = report.Entries[FAKE_TRANSCRIPTION_SERVICE_ID];
48+
49+
Assert.AreEqual(HealthStatus.Unhealthy, entry.Status);
50+
}
51+
52+
53+
private sealed class FakeAudioToTextService : IAudioToTextService
54+
{
55+
// ReSharper disable NotNullOrRequiredMemberIsNotInitialized
56+
// ReSharper disable UnassignedGetOnlyAutoProperty
57+
public IReadOnlyDictionary<string, object> Attributes { get; }
58+
// ReSharper restore UnassignedGetOnlyAutoProperty
59+
// ReSharper restore NotNullOrRequiredMemberIsNotInitialized
60+
61+
public Task<IReadOnlyList<TextContent>> GetTextContentsAsync(AudioContent content, PromptExecutionSettings executionSettings = null, Kernel kernel = null, CancellationToken cancellationToken = default)
62+
{
63+
throw new NotImplementedException();
64+
}
65+
}
66+
}

.tests/IntegrationTests.Vivet.AI/Services/AgentsServiceTests.cs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using Microsoft.SemanticKernel;
32
using Microsoft.VisualStudio.TestTools.UnitTesting;
43
using System.Threading.Tasks;
54
using Vivet.AI.Services.Interfaces;
@@ -13,29 +12,29 @@ public class AgentsServiceTests : BaseTests
1312
{
1413
private IAgentsService AgentsService => this.ServiceProvider.GetRequiredService<IAgentsService>();
1514

16-
private sealed class OrderStatusPlugin
17-
{
18-
[KernelFunction]
19-
// ReSharper disable UnusedMember.Local
20-
public string CheckOrderStatus(string orderId) => $"Order {orderId} is shipped and will arrive in 2-3 days.";
21-
// ReSharper restore UnusedMember.Local
22-
}
15+
//private sealed class OrderStatusPlugin
16+
//{
17+
// [KernelFunction]
18+
// // ReSharper disable UnusedMember.Local
19+
// public string CheckOrderStatus(string orderId) => $"Order {orderId} is shipped and will arrive in 2-3 days.";
20+
// // ReSharper restore UnusedMember.Local
21+
//}
2322

24-
private sealed class OrderReturnPlugin
25-
{
26-
[KernelFunction]
27-
// ReSharper disable UnusedMember.Local
28-
public string ProcessReturn(string orderId, string reason) => $"Return for order {orderId} has been processed successfully. {reason}";
29-
// ReSharper restore UnusedMember.Local
30-
}
23+
//private sealed class OrderReturnPlugin
24+
//{
25+
// [KernelFunction]
26+
// // ReSharper disable UnusedMember.Local
27+
// public string ProcessReturn(string orderId, string reason) => $"Return for order {orderId} has been processed successfully. {reason}";
28+
// // ReSharper restore UnusedMember.Local
29+
//}
3130

32-
private sealed class OrderRefundPlugin
33-
{
34-
[KernelFunction]
35-
// ReSharper disable UnusedMember.Local
36-
public string ProcessReturn(string orderId, string reason) => $"Refund for order {orderId} has been processed successfully. {reason}";
37-
// ReSharper restore UnusedMember.Local
38-
}
31+
//private sealed class OrderRefundPlugin
32+
//{
33+
// [KernelFunction]
34+
// // ReSharper disable UnusedMember.Local
35+
// public string ProcessReturn(string orderId, string reason) => $"Refund for order {orderId} has been processed successfully. {reason}";
36+
// // ReSharper restore UnusedMember.Local
37+
//}
3938

4039
[TestMethod]
4140
public async Task InvokeWhenOrchestrationSequentialTest()

.tests/IntegrationTests.Vivet.AI/Services/ChatServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public async Task ChatWhenBlobsTest()
116116
Question = QUESTION,
117117
Blobs = new List<BaseBlobMetadata>
118118
{
119-
new ImageBlob
119+
new ImageBlobMetadata
120120
{
121121
Data = new BlobDataBase64
122122
{

.tests/IntegrationTests.Vivet.AI/Services/EmbeddingKnowledgeServiceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public async Task IndexImageTest()
197197
{
198198
TenantId = this.tenantId,
199199
ScopeId = scopeId,
200-
Blob = new ImageBlob
200+
Blob = new ImageBlobMetadata
201201
{
202202
Data = new BlobDataBase64
203203
{
@@ -251,7 +251,7 @@ public async Task IndexImageWhenMetadataRetievalTest()
251251
{
252252
TenantId = this.tenantId,
253253
ScopeId = scopeId,
254-
Blob = new ImageBlob
254+
Blob = new ImageBlobMetadata
255255
{
256256
Data = new BlobDataBase64
257257
{
@@ -837,7 +837,7 @@ public async Task SearchWhenBlobTest()
837837
{
838838
TenantId = this.tenantId,
839839
ScopeId = scopeId,
840-
Blob = new ImageBlob
840+
Blob = new ImageBlobMetadata
841841
{
842842
Data = new BlobDataBase64
843843
{

.tests/IntegrationTests.Vivet.AI/Services/EmbeddingMemoryServiceTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public async Task IndexWhenBlobImageTest()
270270
Language = this.language,
271271
Blobs = new List<BaseBlobMetadata>
272272
{
273-
new ImageBlob
273+
new ImageBlobMetadata
274274
{
275275
Data = new BlobDataBase64
276276
{
@@ -336,7 +336,7 @@ public async Task IndexWhenBlobImageAndMetadataTest()
336336
Language = this.language,
337337
Blobs = new List<BaseBlobMetadata>
338338
{
339-
new ImageBlob
339+
new ImageBlobMetadata
340340
{
341341
Data = new BlobDataBase64
342342
{
@@ -390,7 +390,7 @@ public async Task IndexWhenBlobImageAndUseMetadataRetievalIsFalseThrowsAiExcepti
390390
ThreadId = threadId,
391391
Blobs = new List<BaseBlobMetadata>
392392
{
393-
new ImageBlob
393+
new ImageBlobMetadata
394394
{
395395
Data = new BlobDataBase64
396396
{
@@ -793,7 +793,7 @@ public async Task SearchWhenBlobTest()
793793
Language = this.language,
794794
Blobs = new List<BaseBlobMetadata>
795795
{
796-
new ImageBlob
796+
new ImageBlobMetadata
797797
{
798798
Data = new BlobDataBase64
799799
{

.tests/IntegrationTests.Vivet.AI/Services/MetadataServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
using System.Text.RegularExpressions;
77
using System.Threading.Tasks;
88
using Vivet.AI.Services.Interfaces;
9+
using Vivet.AI.Services.Models.Blobs;
910
using Vivet.AI.Services.Models.Blobs.Data;
1011
using Vivet.AI.Services.Models.MimeTypes;
1112
using Vivet.AI.Services.Requests.Metadata;
12-
using Vivet.AI.Services.Requests.Metadata.Models;
1313

1414
namespace IntegrationTests.Vivet.AI.Services;
1515

0 commit comments

Comments
 (0)