Skip to content

Commit

Permalink
[C#] bump: dotnet to 1.10.0 (#2295)
Browse files Browse the repository at this point in the history
## Linked issues

closes: #minor

## Details
- Bump `Microsoft.Teams.AI` to version 1.10.0
- Update samples to point to this version.

**New Changes**
#2235
#2250
#2278
#2232

## Attestation Checklist

- [x] My code follows the style guidelines of this project

- I have checked for/fixed spelling, linting, and other errors
- I have commented my code for clarity
- I have made corresponding changes to the documentation (updating the
doc strings in the code is sufficient)
- My changes generate no new warnings
- I have added tests that validates my changes, and provides sufficient
test coverage. I have tested with:
  - Local testing
  - E2E testing in Teams
- New and existing unit tests pass locally with my changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Lily Du <[email protected]>
Co-authored-by: lilydu <[email protected]>
Co-authored-by: Tarek Mahmoud Sayed <[email protected]>
Co-authored-by: Steven Ickman <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Corina <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Alex Acebo <[email protected]>
Co-authored-by: Eric Zhu <[email protected]>
Co-authored-by: Peter <[email protected]>
  • Loading branch information
12 people authored Feb 4, 2025
1 parent d041e81 commit 7ad7e6b
Show file tree
Hide file tree
Showing 37 changed files with 553 additions and 210 deletions.
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

0 comments on commit 7ad7e6b

Please sign in to comment.