Adds a static UserAgentManager which manages environment level SDK user agent information. User agent component registration and full user agent string retrieval is encapsulated by this new class rather than being registered and computed at the CustomSkill layer.
The manager does not allow for duplicate user agent components and only computes an updated user agent string once per valid component addition. At request time, the precomputed value is used rather than the existing approach which required reconstruction per request.
Motivation and Context
The primary motivation for this change is to allow other frameworks that are designed for use with the SDK, but may not directly be configured on the SDK instance itself, to register themselves with user agent components. With this singleton manager approach, such components can directly append a user agent component at runtime/request execution.
Testing
Added tests for the UserAgentManager and an additional test for CustomSkill. Existing tests continue to pass.
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Docs(Add new document content)
[ ] Translate Docs(Translate document content)
Checklist
[x] My code follows the code style of this project
[ ] My change requires a change to the documentation
Description
Adds a static UserAgentManager which manages environment level SDK user agent information. User agent component registration and full user agent string retrieval is encapsulated by this new class rather than being registered and computed at the CustomSkill layer.
The manager does not allow for duplicate user agent components and only computes an updated user agent string once per valid component addition. At request time, the precomputed value is used rather than the existing approach which required reconstruction per request.
Motivation and Context
The primary motivation for this change is to allow other frameworks that are designed for use with the SDK, but may not directly be configured on the SDK instance itself, to register themselves with user agent components. With this singleton manager approach, such components can directly append a user agent component at runtime/request execution.
Testing
Added tests for the UserAgentManager and an additional test for CustomSkill. Existing tests continue to pass.
Types of changes
Checklist
License