René's URL Explorer Experiment


Title: Make ChatHistory thread safe by dsgrieve · Pull Request #162 · microsoft/semantic-kernel-java · GitHub

Open Graph Title: Make ChatHistory thread safe by dsgrieve · Pull Request #162 · microsoft/semantic-kernel-java

X Title: Make ChatHistory thread safe by dsgrieve · Pull Request #162 · microsoft/semantic-kernel-java

Description: Motivation and Context With Agents API, ChatHistory might be modified by multiple agents running in their own threads. Description Used java.util.concurrent.ConcurrentLinkedQueue in place of ArrayList. One consequence of this is that messages from one agent could be interspresed with messages from other agents in the chat history. I don't think this should be a problem. Note that one of the APIs in the agents space is an async receive (AgentChannel#receiveAsync) that will update the ChatHistory. Depending on the implementation of the Agent that uses this AgentChannel API, the messages could be received in bulk or streamed, so it seems the concurrent approach fits the use-case. The alternative is to use a Collections.synchronizeList(). Contribution Checklist The code builds clean without any errors or warnings The PR follows the SK Contribution Guidelines and the pre-submission formatting script raises no violations All unit tests pass, and I have added new tests where possible I didn't break anyone 😄

Open Graph Description: Motivation and Context With Agents API, ChatHistory might be modified by multiple agents running in their own threads. Description Used java.util.concurrent.ConcurrentLinkedQueue in place of Arra...

X Description: Motivation and Context With Agents API, ChatHistory might be modified by multiple agents running in their own threads. Description Used java.util.concurrent.ConcurrentLinkedQueue in place of Arra...

Opengraph URL: https://github.com/microsoft/semantic-kernel-java/pull/162

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:159a511b-c129-c401-9361-f2a7f7ab35fc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDAE0:6DCFF:27AF16F:3918529:6A4D22BF
html-safe-nonce23b9d33d2cbe2aa52eed9e8bef0c0d33bb0bd65272c215a4a5d6824374267a89
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUUwOjZEQ0ZGOjI3QUYxNkY6MzkxODUyOTo2QTREMjJCRiIsInZpc2l0b3JfaWQiOiI3NjkwODI1NzE0ODM3MDM3NzU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7a71011407d083f70f393d9ac0e980d21ea0fbef6e927715108792151c35d822
hovercard-subject-tagpull_request:2006812809
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/semantic-kernel-java/pull/162/files
twitter:imagehttps://avatars.githubusercontent.com/u/4412658?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4412658?s=400&v=4
og:image:altMotivation and Context With Agents API, ChatHistory might be modified by multiple agents running in their own threads. Description Used java.util.concurrent.ConcurrentLinkedQueue in place of Arra...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/semantic-kernel-java git https://github.com/microsoft/semantic-kernel-java.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id814249293
octolytics-dimension-repository_nwomicrosoft/semantic-kernel-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id814249293
octolytics-dimension-repository_network_root_nwomicrosoft/semantic-kernel-java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release93f17a978ee60bc4668e1d7b90e6bd2d622261fd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/semantic-kernel-java/pull/162/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fsemantic-kernel-java%2Fpull%2F162%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fsemantic-kernel-java%2Fpull%2F162%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fsemantic-kernel-java
Reloadhttps://github.com/microsoft/semantic-kernel-java/pull/162/files
Reloadhttps://github.com/microsoft/semantic-kernel-java/pull/162/files
Reloadhttps://github.com/microsoft/semantic-kernel-java/pull/162/files
Please reload this pagehttps://github.com/microsoft/semantic-kernel-java/pull/162/files
microsoft https://github.com/microsoft
semantic-kernel-javahttps://github.com/microsoft/semantic-kernel-java
Notifications https://github.com/login?return_to=%2Fmicrosoft%2Fsemantic-kernel-java
Fork 55 https://github.com/login?return_to=%2Fmicrosoft%2Fsemantic-kernel-java
Star 270 https://github.com/login?return_to=%2Fmicrosoft%2Fsemantic-kernel-java
Code https://github.com/microsoft/semantic-kernel-java
Issues 48 https://github.com/microsoft/semantic-kernel-java/issues
Pull requests 5 https://github.com/microsoft/semantic-kernel-java/pulls
Actions https://github.com/microsoft/semantic-kernel-java/actions
Projects https://github.com/microsoft/semantic-kernel-java/projects
Models https://github.com/microsoft/semantic-kernel-java/models
Security and quality 0 https://github.com/microsoft/semantic-kernel-java/security
Insights https://github.com/microsoft/semantic-kernel-java/pulse
Code https://github.com/microsoft/semantic-kernel-java
Issues https://github.com/microsoft/semantic-kernel-java/issues
Pull requests https://github.com/microsoft/semantic-kernel-java/pulls
Actions https://github.com/microsoft/semantic-kernel-java/actions
Projects https://github.com/microsoft/semantic-kernel-java/projects
Models https://github.com/microsoft/semantic-kernel-java/models
Security and quality https://github.com/microsoft/semantic-kernel-java/security
Insights https://github.com/microsoft/semantic-kernel-java/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fsemantic-kernel-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fsemantic-kernel-java%2Fissues%2Fnew%2Fchoose
johnoliverhttps://github.com/johnoliver
microsoft:mainhttps://github.com/microsoft/semantic-kernel-java/tree/main
Conversation 2 https://github.com/microsoft/semantic-kernel-java/pull/162
Commits 5 https://github.com/microsoft/semantic-kernel-java/pull/162/commits
Checks 0 https://github.com/microsoft/semantic-kernel-java/pull/162/checks
Files changed https://github.com/microsoft/semantic-kernel-java/pull/162/files
Please reload this pagehttps://github.com/microsoft/semantic-kernel-java/pull/162/files
Make ChatHistory thread safe https://github.com/microsoft/semantic-kernel-java/pull/162/files#top
Show all changes 5 commits https://github.com/microsoft/semantic-kernel-java/pull/162/files
78911cf make ChatHistory thread safe Aug 6, 2024 https://github.com/microsoft/semantic-kernel-java/pull/162/commits/78911cf268452df1804355bc5138743ac973a13c
59b1fc8 Merge branch 'main' of github.com:dsgrieve/semantic-kernel-java Aug 6, 2024 https://github.com/microsoft/semantic-kernel-java/pull/162/commits/59b1fc8da2c258e7608a45ff03e14d0c15ebf5ad
1257fee Log message if formOpenAiToolCalls throws exception dsgrieve Aug 7, 2024 https://github.com/microsoft/semantic-kernel-java/pull/162/commits/1257fee6250582d36aa48e3d24ac30a6042bf10d
8d8d5df Remove Mono from private getChatMessageContentsAsync Aug 7, 2024 https://github.com/microsoft/semantic-kernel-java/pull/162/commits/8d8d5df3b3de90571defe0ec8661ce3206278a62
4b729df Merge branch 'main' of github.com:dsgrieve/semantic-kernel-java Aug 7, 2024 https://github.com/microsoft/semantic-kernel-java/pull/162/commits/4b729dfb2cc66fdebd1799470d3b042085a0944d
Clear filters https://github.com/microsoft/semantic-kernel-java/pull/162/files
Please reload this pagehttps://github.com/microsoft/semantic-kernel-java/pull/162/files
Please reload this pagehttps://github.com/microsoft/semantic-kernel-java/pull/162/files
OpenAIChatCompletion.java https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
OpenAIChatMessageContent.java https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-891d287cbd53af5b176601a589ef1b1bb46155b1b07e445585e618c40605e20c
ChatHistory.java https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
...a/com/microsoft/semantickernel/aiservices/openai/chatcompletion/OpenAIChatCompletion.javahttps://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
View file https://github.com/microsoft/semantic-kernel-java/blob/4b729dfb2cc66fdebd1799470d3b042085a0944d/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/OpenAIChatCompletion.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/semantic-kernel-java/pull/162/{{ revealButtonHref }}
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
Please reload this pagehttps://github.com/microsoft/semantic-kernel-java/pull/162/files
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-71a01d2461a2c52b45252d39fb2aac2d5865264513ea3816bf73f898586c12a2
...m/microsoft/semantickernel/aiservices/openai/chatcompletion/OpenAIChatMessageContent.javahttps://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-891d287cbd53af5b176601a589ef1b1bb46155b1b07e445585e618c40605e20c
View file https://github.com/microsoft/semantic-kernel-java/blob/4b729dfb2cc66fdebd1799470d3b042085a0944d/aiservices/openai/src/main/java/com/microsoft/semantickernel/aiservices/openai/chatcompletion/OpenAIChatMessageContent.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/semantic-kernel-java/pull/162/{{ revealButtonHref }}
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-891d287cbd53af5b176601a589ef1b1bb46155b1b07e445585e618c40605e20c
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-891d287cbd53af5b176601a589ef1b1bb46155b1b07e445585e618c40605e20c
...l-api/src/main/java/com/microsoft/semantickernel/services/chatcompletion/ChatHistory.javahttps://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
View file https://github.com/microsoft/semantic-kernel-java/blob/4b729dfb2cc66fdebd1799470d3b042085a0944d/semantickernel-api/src/main/java/com/microsoft/semantickernel/services/chatcompletion/ChatHistory.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/semantic-kernel-java/pull/162/{{ revealButtonHref }}
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com/microsoft/semantic-kernel-java/pull/162/files#diff-d115343111709f46c1aa2a0ab5cb7cd94828c589f070ecace860d839130b3267
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.