- Notifications
You must be signed in to change notification settings - Fork845
Add ChatMessage.CreatedAt#6657
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
We currently have it at the ChatResponse{Update} level, but for more agentic scenarios, it's helpful to have a timestamp per message.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR adds aCreatedAt timestamp property to theChatMessage class to support more granular timing information for individual messages, complementing the existing timestamp at theChatResponse level.
Key changes:
- Added
DateTimeOffset? CreatedAtproperty toChatMessageclass - Updated message construction in OpenAI and Azure AI Inference clients to populate the timestamp
- Modified response processing logic to handle per-message timestamps when converting between response formats
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatMessage.cs | AddedCreatedAt property and updated clone method |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs | ModifiedToChatResponseUpdates to use message timestamp with fallback to response timestamp |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseExtensions.cs | Updated message processing to handleCreatedAt property during update consolidation |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs | Set messageCreatedAt from OpenAI completion timestamp |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs | Set messageCreatedAt from OpenAI response timestamp |
| src/Libraries/Microsoft.Extensions.AI.AzureAIInference/AzureAIInferenceChatClient.cs | Set messageCreatedAt from Azure AI response timestamp |
| src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json | Added API surface entry for new property |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatMessageTests.cs | Added tests forCreatedAt property roundtrip behavior |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatResponseTests.cs | Updated and added tests for multi-message response conversion |
| test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatResponseUpdateExtensionsTests.cs | Added comprehensive test for message timestamp handling during update processing |
Comments suppressed due to low confidence (1)
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatMessage.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
7798311 intodotnet:mainUh oh!
There was an error while loading.Please reload this page.
Updated[Microsoft.Extensions.Http.Resilience](https://github.com/dotnet/extensions)from 9.7.0 to 9.8.0.<details><summary>Release notes</summary>_Sourced from [Microsoft.Extensions.Http.Resilience'sreleases](https://github.com/dotnet/extensions/releases)._## 9.8.0## What's Changed* Align EventId generation with M.E.Logging source-gen by @xakep139 indotnet/extensions#6566* Add resiliency mechanism to CPU and memory utilization checks by@amadeuszl indotnet/extensions#6528* Suppress flaky test until fixed by @joelverhagen indotnet/extensions#6568* Create a project template for an MCP server by @joelverhagen indotnet/extensions#6547* Use dnx instead of dotnet tool exec in MCP server template README by@joelverhagen indotnet/extensions#6571* Add reporting tests that show NLP results. by @peterwald indotnet/extensions#6574* Branding updates for 9.8.0 by @joperezr indotnet/extensions#6573* Fix `ConfigureEvaluationTests.ps1` script when `$ConfigRoot` is notsupplied by @peterwald indotnet/extensions#6575* Refactor Resource Monitoring by @evgenyfedorov2 indotnet/extensions#6554* Update McpServer template for 0.3.0-preview.2 by @stephentoub indotnet/extensions#6578* Add container.cpu.time metric by @evgenyfedorov2 indotnet/extensions#5806* Add netstandard2.0 compatibility toMicrosoft.Extensions.Diagnostics.Testing and dependencies by @bdovaz indotnet/extensions#6219* Add netstandard2.0 compatibility to Microsoft.Extensions.Telemetry anddependencies by @bdovaz indotnet/extensions#6218* Simplify Http.Diagnostics by @pentp indotnet/extensions#6174* Add netstandard2.0 compatibility toMicrosoft.Extensions.Http.Resilience and dependencies by @bdovaz indotnet/extensions#6582* Ingore null loggers returned by LogProviders in ELoggerFactory by@petrroll indotnet/extensions#6585* Merging changes from internal by @joperezr indotnet/extensions#6588* [Logging] Fixes LogProperties and LogPropertyIgnore attributes to workif an object being logged resides in a different assembly than thelogging method by @iliar-turdushev indotnet/extensions#6600* Add memory usage metric by @evgenyfedorov2 indotnet/extensions#6586* Add schema version to server.json in MCP template by @joelverhagen indotnet/extensions#6606* Merge release/9.7 into main by @joperezr indotnet/extensions#6589* Update MCP server template readme to show both VS Code and VisualStudio notes by @Copilot indotnet/extensions#6591* Update Azure Open AI package referenced by eval integration tests by@shyamnamboodiripad indotnet/extensions#6609* Target .NET 8 for more stable runtime requirement by @joelverhagen indotnet/extensions#6617* Add support for new Azure AI Foundry project type for Safety evals by@shyamnamboodiripad indotnet/extensions#6621* M.E.AI.AzureAIInference - Azure.AI.Inference Package Bump by@rogerbarreto indotnet/extensions#6624* Add DataContent.Name property by @stephentoub indotnet/extensions#6616* Fix handling of multiple responses messages by @stephentoub indotnet/extensions#6627* Expose additional chat model conversion helpers by @stephentoub indotnet/extensions#6629* [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot]indotnet/extensions#6633* [Http.Resilience] The DisableFor method should try to retrieve therequest object from the resilience context by @iliar-turdushev indotnet/extensions#6618* Bump Package validation baseline version to 9.7.0 by @Copilot indotnet/extensions#6650* Fix internal package version detection for project templates by@MackinnonBuck indotnet/extensions#6651* Remove `Microsoft.Extensions.AI.Ollama` by @MackinnonBuck indotnet/extensions#6655* Fix M.E.AI package refs by @stephentoub indotnet/extensions#6654* Add [Description] to DataContent.Uri by @stephentoub indotnet/extensions#6615* Fix duplicate solution file when creating an AI Chat Web app from VSby @MackinnonBuck indotnet/extensions#6653* Add ChatMessage.CreatedAt by @stephentoub indotnet/extensions#6657* Add TextContent.Annotations by @stephentoub indotnet/extensions#6619* Add FunctionInvokingChatClient.AdditionalTools by @stephentoub indotnet/extensions#6661* Fix unintentional test env var change by @stephentoub indotnet/extensions#6660* Add more openai conversion helpers by @stephentoub indotnet/extensions#6662* Add OriginalRepoCommitHash to assemblies by @BrennanConroy indotnet/extensions#6667* Include a trivial items keyword if missing. by @eiriktsarpalis indotnet/extensions#6669* Add resolution of function parameter level data annotation attributes.by @eiriktsarpalis indotnet/extensions#6671* Fix issue with NetSourceIndexStage1 for dependency conflict versionsby @joperezr indotnet/extensions#6672* Expose streaming conversion utility methods by @stephentoub indotnet/extensions#6636* Couple of fixes for MEAI.Evaluation by @shyamnamboodiripad indotnet/extensions#6673* Fix one more version conflict on the docs transport package by@joperezr indotnet/extensions#6675 ... (truncated)## 9.7.2## Packages Released* [Microsoft.Extensions.AI.Templates9.7.2-preview.3.25366.2](https://www.nuget.org/packages/Microsoft.Extensions.AI.Templates/9.7.2-preview.3.25366.2)## What's Changed* Target .NET 8 for more stable runtime requirement by @joelverhagen in#6617**Full Changelog**:dotnet/extensions@v9.7.1...v9.7.2## 9.7.1## Packages Released* [Microsoft.Extensions.AI9.7.1](https://www.nuget.org/packages/Microsoft.Extensions.AI/9.7.1)* [Microsoft.Extensions.AI.Abstractions9.7.1](https://www.nuget.org/packages/Microsoft.Extensions.AI.Abstractions/9.7.1)* [Microsoft.Extensions.AI.OpenAI9.7.1-preview.1.25365.4](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI/9.7.1-preview.1.25365.4)* [Microsoft.Extensions.AI.AzureAIInference9.7.1-preview.1.25365.4](https://www.nuget.org/packages/Microsoft.Extensions.AI.AzureAIInference/9.7.1-preview.1.25365.4)* [Microsoft.Extensions.AI.Templates9.7.1-preview.3.25365.4](https://www.nuget.org/packages/Microsoft.Extensions.AI.Templates/9.7.1-preview.3.25365.4)## What's Changed* Merging changes from internal by @joperezr in #6588* Bump FunctionInvokingChatClient.MaximumIterationsPerRequest from 10 to40 by @stephentoub in #6599* Expose M.E.AI.OpenAI input message conversions by @stephentoub in#6601* Add schema version to server.json in MCP template by @joelverhagen in#6606* Update MCP server template readme to show both VS Code and VisualStudio notes by @jeffhandley in #6591* Fix schema generation for Nullable<T> function parameters. by@eiriktsarpalis in #6596* Branding updates for 9.7.1 by @joperezr indotnet/extensions#6611* Add DelegatingAIFunction by @stephentoub indotnet/extensions#6565* Add FunctionInvokingChatClient.FunctionInvoker delegate by@stephentoub indotnet/extensions#6564* Enable specifying "strict" for OpenAI clients via ChatOptions by@stephentoub indotnet/extensions#6552* AIFunctionFactory: tolerate JSON string function parameters. by@eiriktsarpalis indotnet/extensions#6572* AIFunctionFactory: add test coverage for JSON comments. by@eiriktsarpalis indotnet/extensions#6576* Update M.E.AI.OpenAI for latest OpenAI release by @stephentoub indotnet/extensions#6577* Update OpenTelemetry semantic conventions version from 1.35 to 1.36 by@Copilot indotnet/extensions#6579* AIFunctionFactory: add a flag for disabling return schema generation.by @eiriktsarpalis indotnet/extensions#6551* Bump FunctionInvokingChatClient.MaximumIterationsPerRequest from 10 to40 by @stephentoub indotnet/extensions#6599* Expose M.E.AI.OpenAI input message conversions by @stephentoub indotnet/extensions#6601* Fix schema generation for Nullable<T> function parameters. by@eiriktsarpalis indotnet/extensions#6596**Full Changelog**:dotnet/extensions@v9.7.0...v9.7.1Commits viewable in [compareview](dotnet/extensions@v9.7.0...v9.8.0).</details>[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)Dependabot will resolve any conflicts with this PR as long as you don'talter it yourself. You can also trigger a rebase manually by commenting`@dependabot rebase`.[//]: # (dependabot-automerge-start)[//]: # (dependabot-automerge-end)---<details><summary>Dependabot commands and options</summary><br />You can trigger Dependabot actions by commenting on this PR:- `@dependabot rebase` will rebase this PR- `@dependabot recreate` will recreate this PR, overwriting any editsthat have been made to it- `@dependabot merge` will merge this PR after your CI passes on it- `@dependabot squash and merge` will squash and merge this PR afteryour CI passes on it- `@dependabot cancel merge` will cancel a previously requested mergeand block automerging- `@dependabot reopen` will reopen this PR if it is closed- `@dependabot close` will close this PR and stop Dependabot recreatingit. You can achieve the same result by closing it manually- `@dependabot show <dependency name> ignore conditions` will show allof the ignore conditions of the specified dependency- `@dependabot ignore this major version` will close this PR and stopDependabot creating any more for this major version (unless you reopenthe PR or upgrade to it yourself)- `@dependabot ignore this minor version` will close this PR and stopDependabot creating any more for this minor version (unless you reopenthe PR or upgrade to it yourself)- `@dependabot ignore this dependency` will close this PR and stopDependabot creating any more for this dependency (unless you reopen thePR or upgrade to it yourself)</details>Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
We currently have it at the ChatResponse{Update} level, but for more agentic scenarios, it's helpful to have a timestamp per message.
Microsoft Reviewers:Open in CodeFlow