langchain-dev-utils 1.2.3__py3-none-any.whl → 1.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_dev_utils/__init__.py +1 -1
- langchain_dev_utils/chat_models/base.py +26 -2
- {langchain_dev_utils-1.2.3.dist-info → langchain_dev_utils-1.2.4.dist-info}/METADATA +2 -1
- {langchain_dev_utils-1.2.3.dist-info → langchain_dev_utils-1.2.4.dist-info}/RECORD +6 -6
- {langchain_dev_utils-1.2.3.dist-info → langchain_dev_utils-1.2.4.dist-info}/WHEEL +1 -1
- {langchain_dev_utils-1.2.3.dist-info → langchain_dev_utils-1.2.4.dist-info}/licenses/LICENSE +0 -0
langchain_dev_utils/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.2.
|
|
1
|
+
__version__ = "1.2.4"
|
|
@@ -14,6 +14,7 @@ class ChatModelProvider(TypedDict):
|
|
|
14
14
|
provider_name: str
|
|
15
15
|
chat_model: ChatModelType
|
|
16
16
|
base_url: NotRequired[str]
|
|
17
|
+
provider_profile: NotRequired[dict[str, dict[str, Any]]]
|
|
17
18
|
provider_config: NotRequired[ProviderConfig]
|
|
18
19
|
|
|
19
20
|
|
|
@@ -94,6 +95,11 @@ def _load_chat_model_helper(
|
|
|
94
95
|
url_key = _get_base_url_field_name(chat_model)
|
|
95
96
|
if url_key:
|
|
96
97
|
kwargs.update({url_key: base_url})
|
|
98
|
+
if provider_profile := _MODEL_PROVIDERS_DICT[model_provider].get(
|
|
99
|
+
"provider_profile"
|
|
100
|
+
):
|
|
101
|
+
if model in provider_profile:
|
|
102
|
+
kwargs.update({"profile": provider_profile[model]})
|
|
97
103
|
return chat_model(model=model, **kwargs)
|
|
98
104
|
|
|
99
105
|
return _init_chat_model_helper(model, model_provider=model_provider, **kwargs)
|
|
@@ -103,6 +109,7 @@ def register_model_provider(
|
|
|
103
109
|
provider_name: str,
|
|
104
110
|
chat_model: ChatModelType,
|
|
105
111
|
base_url: Optional[str] = None,
|
|
112
|
+
provider_profile: Optional[dict[str, dict[str, Any]]] = None,
|
|
106
113
|
provider_config: Optional[ProviderConfig] = None,
|
|
107
114
|
):
|
|
108
115
|
"""Register a new model provider.
|
|
@@ -115,6 +122,7 @@ def register_model_provider(
|
|
|
115
122
|
provider_name: Name of the provider to register
|
|
116
123
|
chat_model: Either a BaseChatModel class or a string identifier for a supported provider
|
|
117
124
|
base_url: The API address of the model provider (optional, valid for both types of `chat_model`, but mainly used when `chat_model` is a string and is "openai-compatible")
|
|
125
|
+
provider_profile: Model provider's model configuration file (optional, valid for both types of `chat_model`); finally, it will read the corresponding model configuration parameters based on `model_name` and set them to `model.profile`.
|
|
118
126
|
provider_config: The configuration of the model provider (Optional parameter;effective only when `chat_model` is a string and is "openai-compatible".)
|
|
119
127
|
It can be configured to configure some related parameters of the provider, such as whether to support json_mode structured output mode, the list of supported tool_choice
|
|
120
128
|
Raises:
|
|
@@ -164,16 +172,30 @@ def register_model_provider(
|
|
|
164
172
|
"chat_model": chat_model,
|
|
165
173
|
"provider_config": provider_config,
|
|
166
174
|
"base_url": base_url,
|
|
175
|
+
"provider_profile": provider_profile,
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
)
|
|
170
179
|
else:
|
|
171
180
|
if base_url is not None:
|
|
172
181
|
_MODEL_PROVIDERS_DICT.update(
|
|
173
|
-
{
|
|
182
|
+
{
|
|
183
|
+
provider_name: {
|
|
184
|
+
"chat_model": chat_model,
|
|
185
|
+
"base_url": base_url,
|
|
186
|
+
"provider_profile": provider_profile,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
174
189
|
)
|
|
175
190
|
else:
|
|
176
|
-
_MODEL_PROVIDERS_DICT.update(
|
|
191
|
+
_MODEL_PROVIDERS_DICT.update(
|
|
192
|
+
{
|
|
193
|
+
provider_name: {
|
|
194
|
+
"chat_model": chat_model,
|
|
195
|
+
"provider_profile": provider_profile,
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
)
|
|
177
199
|
|
|
178
200
|
|
|
179
201
|
def batch_register_model_provider(
|
|
@@ -189,6 +211,7 @@ def batch_register_model_provider(
|
|
|
189
211
|
- provider_name: Name of the provider to register
|
|
190
212
|
- chat_model: Either a BaseChatModel class or a string identifier for a supported provider
|
|
191
213
|
- base_url: The API address of the model provider (optional, valid for both types of `chat_model`, but mainly used when `chat_model` is a string and is "openai-compatible")
|
|
214
|
+
- provider_profile: Model provider's model configuration file (optional, valid for both types of `chat_model`); finally, it will read the corresponding model configuration parameters based on `model_name` and set them to `model.profile`.
|
|
192
215
|
- provider_config: The configuration of the model provider(Optional parameter; effective only when `chat_model` is a string and is "openai-compatible".)
|
|
193
216
|
It can be configured to configure some related parameters of the provider, such as whether to support json_mode structured output mode, the list of supported tool_choice
|
|
194
217
|
|
|
@@ -222,6 +245,7 @@ def batch_register_model_provider(
|
|
|
222
245
|
provider["provider_name"],
|
|
223
246
|
provider["chat_model"],
|
|
224
247
|
provider.get("base_url"),
|
|
248
|
+
provider_profile=provider.get("provider_profile"),
|
|
225
249
|
provider_config=provider.get("provider_config"),
|
|
226
250
|
)
|
|
227
251
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-dev-utils
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
4
4
|
Summary: A practical utility library for LangChain and LangGraph development
|
|
5
5
|
Project-URL: Source Code, https://github.com/TBice123123/langchain-dev-utils
|
|
6
6
|
Project-URL: repository, https://github.com/TBice123123/langchain-dev-utils
|
|
@@ -62,6 +62,7 @@ Mainly consists of the following two functions:
|
|
|
62
62
|
- `provider_name`: Model provider name, used as an identifier for subsequent model loading
|
|
63
63
|
- `chat_model`: Chat model, can be a ChatModel or a string (currently supports "openai-compatible")
|
|
64
64
|
- `base_url`: The API address of the model provider (optional, valid for both types of `chat_model`, but mainly used when `chat_model` is a string and is "openai-compatible")
|
|
65
|
+
- `provider_profile`: Model provider's model configuration file (optional, valid for both types of `chat_model`); finally, it will read the corresponding model configuration parameters based on `model_name` and set them to `model.profile`.
|
|
65
66
|
- `provider_config`: Relevant configuration for the model provider (optional, valid when `chat_model` is a string and is "openai-compatible"), can configure some provider-related parameters, such as whether to support structured output in json_mode, list of supported tool_choices, etc.
|
|
66
67
|
|
|
67
68
|
`load_chat_model` parameter description:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
langchain_dev_utils/__init__.py,sha256=
|
|
1
|
+
langchain_dev_utils/__init__.py,sha256=XBKH8E1LmDxv06U39yqMBbXZapOERFgICEDYZs_kRso,22
|
|
2
2
|
langchain_dev_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
langchain_dev_utils/agents/__init__.py,sha256=e17SMQdJIQngbUCr2N1tY-yw0tD3tEnH7PSvyDmVPeQ,127
|
|
4
4
|
langchain_dev_utils/agents/factory.py,sha256=h4uAkid2NJMMs4qV6RYFexew-ixfhEvpa254eDeDEcU,3912
|
|
@@ -13,7 +13,7 @@ langchain_dev_utils/agents/middleware/summarization.py,sha256=BtWPJcQBssGAT0nb1c
|
|
|
13
13
|
langchain_dev_utils/agents/middleware/tool_emulator.py,sha256=u9rV24yUB-dyc1uUfUe74B1wOGVI3TZRwxkE1bvGm18,2025
|
|
14
14
|
langchain_dev_utils/agents/middleware/tool_selection.py,sha256=ZqdyK4Yhp2u3GM6B_D6U7Srca9vy1o7s6N_LrV24-dQ,3107
|
|
15
15
|
langchain_dev_utils/chat_models/__init__.py,sha256=YSLUyHrWEEj4y4DtGFCOnDW02VIYZdfAH800m4Klgeg,224
|
|
16
|
-
langchain_dev_utils/chat_models/base.py,sha256=
|
|
16
|
+
langchain_dev_utils/chat_models/base.py,sha256=emQs5biWgeqP9a8cEoovpOzn34w91-_SiTnytu-C5PM,12051
|
|
17
17
|
langchain_dev_utils/chat_models/types.py,sha256=FM_RyiGRTb1dy59MovhDYM4Kj9cpybt2BFha0e2u0qA,468
|
|
18
18
|
langchain_dev_utils/chat_models/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
langchain_dev_utils/chat_models/adapters/openai_compatible.py,sha256=wR7Uym9rQWsxhsBt8LrE30dayWcMnbsU8AXC4kOtnyI,19719
|
|
@@ -29,7 +29,7 @@ langchain_dev_utils/pipeline/types.py,sha256=T3aROKKXeWvd0jcH5XkgMDQfEkLfPaiOhhV
|
|
|
29
29
|
langchain_dev_utils/tool_calling/__init__.py,sha256=mu_WxKMcu6RoTf4vkTPbA1WSBSNc6YIqyBtOQ6iVQj4,322
|
|
30
30
|
langchain_dev_utils/tool_calling/human_in_the_loop.py,sha256=nbaON9806pv5tpMRQUA_Ch3HJA5HBFgzZR7kQRf6PiY,9819
|
|
31
31
|
langchain_dev_utils/tool_calling/utils.py,sha256=3cNv_Zx32KxdsGn8IkxjWUzxYEEwVJeJgTZTbfSg0pA,2751
|
|
32
|
-
langchain_dev_utils-1.2.
|
|
33
|
-
langchain_dev_utils-1.2.
|
|
34
|
-
langchain_dev_utils-1.2.
|
|
35
|
-
langchain_dev_utils-1.2.
|
|
32
|
+
langchain_dev_utils-1.2.4.dist-info/METADATA,sha256=1bYaEqoBkx54fvr35w355lth8_OwMz4g2OS1SWnzlag,16536
|
|
33
|
+
langchain_dev_utils-1.2.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
34
|
+
langchain_dev_utils-1.2.4.dist-info/licenses/LICENSE,sha256=AWAOzNEcsvCEzHOF0qby5OKxviVH_eT9Yce1sgJTico,1084
|
|
35
|
+
langchain_dev_utils-1.2.4.dist-info/RECORD,,
|
{langchain_dev_utils-1.2.3.dist-info → langchain_dev_utils-1.2.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|