Skip to content

feat(langchain): forward provider-native modelSettings to chat models [PC-4672] - #119

Open
tudormatei1 wants to merge 6 commits into
mainfrom
feat/model-specific-settings
Open

feat(langchain): forward provider-native modelSettings to chat models [PC-4672]#119
tudormatei1 wants to merge 6 commits into
mainfrom
feat/model-specific-settings

Conversation

@tudormatei1

@tudormatei1 tudormatei1 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

agent.json can now carry settings.modelSettings, but nothing consumed it — this is the consumer side. UiPathBaseChatModel gets a model_settings field and get_chat_model a matching param; each key is applied verbatim, with no per-provider mapping, since discovery is the source of truth for the shape.

A key that names a native field (by name or alias, e.g. timeout -> request_timeout) is coerced to that field's declared type and set; anything else goes to model_kwargs; keys in disabled_params are dropped. Values arrive as untyped JSON, so a value the field can't accept fails at construction rather than coming back as a provider 400.

Two things worth a look: the coercion goes through a TypeAdapter instead of pydantic assignment validation, because re-running the validator chain lets LangChain's build_extra sweep cached non-field entries into model_kwargs. And UiPathChatBedrockConverse overrides the apply step — Converse ignores model_kwargs entirely, so non-field keys (plus output_config, which is a field but has to be nested anyway) go into additional_model_request_fields.

@tudormatei1
tudormatei1 force-pushed the feat/model-specific-settings branch from 76daab5 to 5520197 Compare August 18, 2026 08:29
@tudormatei1
tudormatei1 requested a balanced review from Copilot August 18, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces provider-native model_settings support so settings from agent.json can be forwarded through get_chat_model and applied during model construction (including Bedrock Converse-specific routing), with accompanying tests and a version bump.

Changes:

  • Add model_settings parameter to get_chat_model and forward it into the model constructor.
  • Apply model_settings on UiPathBaseChatModel post-construction with type coercion, plus Bedrock Converse passthrough partitioning.
  • Add/extend unit tests for forwarding, coercion, disabled params, alias handling, and Bedrock Converse mapping; bump version + changelog.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/langchain/features/test_factory_function.py Adds integration-style tests verifying model_settings forwarding and application semantics across providers.
tests/langchain/clients/bedrock/test_model_settings_mapping.py Adds pure unit tests for Bedrock Converse model_settings partitioning behavior.
packages/uipath_langchain_client/src/uipath_langchain_client/factory.py Adds model_settings param to factory and forwards it into constructor kwargs.
packages/uipath_langchain_client/src/uipath_langchain_client/clients/bedrock/chat_models.py Adds Bedrock Converse-specific routing of settings into additional_model_request_fields.
packages/uipath_langchain_client/src/uipath_langchain_client/base_client.py Adds model_settings field and post-init application logic with type coercion + alias resolution.
packages/uipath_langchain_client/src/uipath_langchain_client/version.py Bumps package version to 1.18.0.
packages/uipath_langchain_client/CHANGELOG.md Documents the new model_settings capability and behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/uipath_langchain_client/src/uipath_langchain_client/base_client.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants