Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] bump: dotnet to 1.10.0 #2295

Merged
merged 31 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d4ac6c4
[C#] feat: O1 model support (#2111)
singhk97 Oct 17, 2024
a56fec2
[C#] fix: When streaming operation failed the exception is suppressed…
singhk97 Oct 17, 2024
b006d89
[C#] fix: content safety public preview deprecation (#2138)
singhk97 Oct 23, 2024
0c7375f
[C#] feat: Generated by AI Label, Feedback Loop, Streaming Buffer, Er…
lilyydu Oct 23, 2024
ca9b71c
[C#] feat: Streaming - Citations & Sensitivity Label (#2147)
lilyydu Oct 30, 2024
92d4aef
[C#] fix: Map tokens config to `max_tokens` when non-o1 model is used…
singhk97 Oct 31, 2024
437dbbe
[C#] bump: dotnet to 1.8.0 (#2157)
singhk97 Oct 31, 2024
a338eec
Merge branch 'main' into dotnet-dev
singhk97 Oct 31, 2024
9bcd35f
Update manifest.json
singhk97 Oct 31, 2024
804ff05
[C#] fix: update streamType enum conversion to string (#2178)
lilyydu Nov 11, 2024
2c65184
bump to v1.8.1
singhk97 Nov 12, 2024
2416a20
merge main
singhk97 Nov 12, 2024
1c7d9c9
[C#] fix: Upgrade tokenizers library to the GA version 1.0.0 (#2210)
tarekgh Dec 2, 2024
2ba12e3
[C#] feat: Implemented basic changes needed to support streaming tool…
Stevenic Dec 9, 2024
0e3ce84
mere'
singhk97 Dec 10, 2024
bc4c3a5
[C#] fix: failure to load prompt due to json serialization error (#2227)
singhk97 Dec 10, 2024
f40dbc9
Merge branch 'dotnet-dev' of https://github.com/microsoft/teams-ai in…
singhk97 Dec 10, 2024
852a523
[C#] bump: dotnet to v1.9.0 (#2229)
singhk97 Dec 10, 2024
df94bb1
remove weird addition
singhk97 Dec 11, 2024
68aa670
revert bracket style init
singhk97 Dec 11, 2024
ba4f6b7
editor style change
singhk97 Dec 11, 2024
be7eeca
merge main
singhk97 Dec 11, 2024
5091d51
fix warnings
singhk97 Dec 11, 2024
b7c8bd0
Merge branch 'dotnet-dev' of https://github.com/microsoft/teams-ai in…
singhk97 Dec 30, 2024
87232fa
[C#] fix: Typing indicator is "stuck" (#2250)
singhk97 Jan 6, 2025
7f92562
[C#] fix: streaming - citations and duplicate typing activity (#2202)
lilyydu Jan 6, 2025
6ee2b26
Merge branch 'main' into dotnet-dev
singhk97 Jan 23, 2025
30bc60d
[C#] feat: custom feedback form + citation changes (#2278)
singhk97 Feb 3, 2025
f8d92f3
Merge branch 'main' into dotnet-dev
singhk97 Feb 4, 2025
409a728
bump versions
singhk97 Feb 4, 2025
67bfcbf
fixes
singhk97 Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Bot.Connector;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Schema.Teams;
using Microsoft.Teams.AI.Application;
using Microsoft.Teams.AI.State;
using Microsoft.Teams.AI.Tests.TestUtils;
using Moq;
Expand Down Expand Up @@ -1946,6 +1947,58 @@ void CaptureSend(Activity[] arg)
Assert.Equivalent(expectedInvokeResponse, activitiesToSend[0].Value);
}

[Fact]
public async Task Test_OnMessageFetchTask()
{
// Arrange
Activity[]? activitiesToSend = null;
void CaptureSend(Activity[] arg)
{
activitiesToSend = arg;
}
var adapter = new SimpleAdapter(CaptureSend);
var activity1 = new Activity
{
Type = ActivityTypes.Invoke,
Name = "message/fetchTask",
ChannelId = Channels.Msteams,
Recipient = new() { Id = "recipientId" },
Conversation = new() { Id = "conversationId" },
From = new() { Id = "fromId" },
};
var turnContext1 = new TurnContext(adapter, activity1);
var messageFetchTaskResponse = new Mock<MessageFetchTaskResponse>();
var expectedInvokeResponse = new InvokeResponse()
{
Status = 200,
Body = messageFetchTaskResponse.Object
};
var turnState = TurnStateConfig.GetTurnStateWithConversationStateAsync(turnContext1);
var app = new Application<TurnState>(new()
{
RemoveRecipientMention = false,
StartTypingTimer = false,
TurnStateFactory = () => turnState.Result,
});
var names = new List<string>();
app.OnMessageFetchTask((turnContext, _, _, _) =>
{
names.Add(turnContext.Activity.Name);
return Task.FromResult(messageFetchTaskResponse.Object);
});

// Act
await app.OnTurnAsync(turnContext1);

// Assert
Assert.Single(names);
Assert.Equal("message/fetchTask", names[0]);
Assert.NotNull(activitiesToSend);
Assert.Single(activitiesToSend);
Assert.Equal("invokeResponse", activitiesToSend[0].Type);
Assert.Equivalent(expectedInvokeResponse, activitiesToSend[0].Value);
}

[Fact]
public async Task Test_OnConfigSubmit()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ void CaptureSend(Activity[] arg)
StreamingResponse streamer = new(turnContext);
List<Citation> citations = new List<Citation>();
citations.Add(new Citation(content: "test-content", title: "test", url: "https://example.com"));
streamer.QueueTextChunk("first", citations);
streamer.SetCitations(citations);
streamer.QueueTextChunk("first");
await streamer.WaitForQueue();
streamer.QueueTextChunk("second");
await streamer.WaitForQueue();
Expand All @@ -229,6 +230,10 @@ void CaptureSend(Activity[] arg)
streamer.SensitivityLabel = new SensitivityUsageInfo() { Name= "Sensitivity"};
await streamer.EndStream();
Assert.Equal(2, streamer.UpdatesSent());
if (streamer.Citations != null)
{
Assert.Single(streamer.Citations);
}
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0-beta.1" />
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.23.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="OpenAI" Version="2.1.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.TeamsAI\Microsoft.Teams.AI.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0-beta.1" />
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.23.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="OpenAI" Version="2.1.0-beta.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.TeamsAI\Microsoft.Teams.AI.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public AI(AIOptions<TState> options, ILoggerFactory? loggerFactory = null)
_actions = new ActionCollection<TState>();

// Import default actions
ImportActions(new DefaultActions<TState>(options.EnableFeedbackLoop, loggerFactory));
ImportActions(new DefaultActions<TState>(options.EnableFeedbackLoop, options.FeedbackLoopType, loggerFactory));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public sealed class AIOptions<TState> where TState : TurnState
/// </summary>
public bool EnableFeedbackLoop { get; set; } = false;

/// <summary>
/// Represents the type of feedback loop. Set to "default" by default. It can be set to one of "default" or "custom".
/// The <see cref="AIOptions{TState}.EnableFeedbackLoop"/> property should be set to true to use this property.
/// </summary>
public string FeedbackLoopType { get; set; } = "default";

/// <summary>
/// Initializes a new instance of the <see cref="AIOptions{TState}"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class ClientCitation
/// Required. Number and position of the citation.
/// </summary>
[JsonProperty(PropertyName = "position")]
public string Position { get; set; } = string.Empty;
public int Position { get; set; }

/// <summary>
/// The citation's appearance.
Expand All @@ -88,7 +88,7 @@ public class ClientCitationAppearance
public string AtType = "DigitalDocument";

/// <summary>
/// Name of the document.
/// Name of the document (max length 80).
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; } = string.Empty;
Expand All @@ -106,13 +106,14 @@ public class ClientCitationAppearance
public string? Url { get; set; }

/// <summary>
/// Content of the citation. Must be clipped if longer than 480 characters.
/// Extract of the referenced content (max length 160).
/// </summary>
[JsonProperty(PropertyName = "abstract")]
public string Abstract { get; set; } = string.Empty;

/// <summary>
/// Optional. Encoding format of the `citation.appearance.text` field.
/// Optional. Encoding format of the `citation.appearance.text` field.
/// It should be one of "text/html" or "application/vnd.microsoft.card.adaptive".
/// </summary>
[JsonProperty(PropertyName = "encodingFormat")]
public string? EncodingFormat { get; set; }
Expand All @@ -121,7 +122,7 @@ public class ClientCitationAppearance
/// The icon provided in the citation ui.
/// </summary>
[JsonProperty(PropertyName = "image")]
public string? Image { get; set; }
public AppearanceImage? Image { get; set; }

/// <summary>
/// Optional. Set the keywords.
Expand Down Expand Up @@ -207,4 +208,123 @@ public class SensitivityUsageInfoPattern
[JsonProperty(PropertyName = "termCode")]
public string? TermCode { get; set; }
}

/// <summary>
/// Represents how the citation will be rendered.
/// </summary>
public class AppearanceImage
{
/// <summary>
/// Required. Must be "ImageObject".
/// </summary>
[JsonProperty(PropertyName = "@type")]
public string Type { get; set; } = "ImageObject";

/// <summary>
/// The image/icon name. It should be one of <see cref="ClientCitationIconName"/>
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; } = string.Empty;
}

/// <summary>
/// Represents the different possible values for the client citation icon name.
/// </summary>
public static class ClientCitationIconName
{
/// <summary>
/// Represents the Microsoft Word icon name.
/// </summary>
public static readonly string MicrosoftWord = "Microsoft Word";

/// <summary>
/// Represents the Microsoft Excel icon name.
/// </summary>
public static readonly string MicrosoftExcel = "Microsoft Excel";

/// <summary>
/// Represents the Microsoft PowerPoint icon name.
/// </summary>
public static readonly string MicrosoftPowerPoint = "Microsoft PowerPoint";

/// <summary>
/// Represents the Microsoft Visio icon name.
/// </summary>
public static readonly string MicrosoftVisio = "Microsoft Visio";

/// <summary>
/// Represents the Microsoft Loop icon name.
/// </summary>
public static readonly string MicrosoftLoop = "Microsoft Loop";

/// <summary>
/// Represents the Microsoft Whiteboard icon name.
/// </summary>
public static readonly string MicrosoftWhiteboard = "Microsoft Whiteboard";

/// <summary>
/// Represents the Adobe Illustrator icon name.
/// </summary>
public static readonly string AdobeIllustrator = "Adobe Illustrator";

/// <summary>
/// Represents the Adobe Photoshop icon name.
/// </summary>
public static readonly string AdobePhotoshop = "Adobe Photoshop";

/// <summary>
/// Represents the Adobe InDesign icon name.
/// </summary>
public static readonly string AdobeInDesign = "Adobe InDesign";

/// <summary>
/// Represents the Adobe Flash icon name.
/// </summary>
public static readonly string AdobeFlash = "Adobe Flash";

/// <summary>
/// Represents the Sketch icon name.
/// </summary>
public static readonly string Sketch = "Sketch";

/// <summary>
/// Represents the Source Code icon name.
/// </summary>
public static readonly string SourceCode = "Source Code";

/// <summary>
/// Represents the Image icon name.
/// </summary>
public static readonly string Image = "Image";

/// <summary>
/// Represents the GIF icon name.
/// </summary>
public static readonly string GIF = "GIF";

/// <summary>
/// Represents the Video icon name.
/// </summary>
public static readonly string Video = "Video";

/// <summary>
/// Represents the Sound icon name.
/// </summary>
public static readonly string Sound = "Sound";

/// <summary>
/// Represents the ZIP icon name.
/// </summary>
public static readonly string ZIP = "ZIP";

/// <summary>
/// Represents the Text icon name.
/// </summary>
public static readonly string Text = "Text";

/// <summary>
/// Represents the PDF icon name.
/// </summary>
public static readonly string PDF = "PDF";
}
}
Loading
Loading