@@ -121,6 +121,7 @@ def get_chat_model(
121121 vendor_type = vendor_type ,
122122 )
123123 is_uipath_owned = model_info .get ("modelSubscriptionType" ) == "UiPathOwned"
124+ model_family = model_info .get ("modelFamily" , "" ).lower ()
124125 if not is_uipath_owned :
125126 client_settings .validate_byo_model (model_info )
126127
@@ -165,47 +166,31 @@ def get_chat_model(
165166 ** model_kwargs ,
166167 )
167168 case VendorType .VERTEXAI :
168- if is_uipath_owned :
169- if "claude" in model_name :
170- from uipath_langchain_client .clients .anthropic .chat_models import (
171- UiPathChatAnthropic ,
172- )
173-
174- return UiPathChatAnthropic (
175- model = model_name ,
176- settings = client_settings ,
177- vendor_type = discovered_vendor ,
178- byo_connection_id = byo_connection_id ,
179- ** model_kwargs ,
180- )
181- elif "gemini" in model_name :
182- from uipath_langchain_client .clients .google .chat_models import (
183- UiPathChatGoogleGenerativeAI ,
184- )
185-
186- return UiPathChatGoogleGenerativeAI (
187- model = model_name ,
188- settings = client_settings ,
189- byo_connection_id = byo_connection_id ,
190- ** model_kwargs ,
191- )
192- else :
193- raise ValueError (
194- f"We don't have a client that currently supports this model: { model_name } on vendor: { discovered_vendor } "
195- )
196- else :
197- from uipath_langchain_client .clients .google .chat_models import (
198- UiPathChatGoogleGenerativeAI ,
169+ if model_family == "anthropicclaude" :
170+ from uipath_langchain_client .clients .anthropic .chat_models import (
171+ UiPathChatAnthropic ,
199172 )
200173
201- return UiPathChatGoogleGenerativeAI (
174+ return UiPathChatAnthropic (
202175 model = model_name ,
203176 settings = client_settings ,
177+ vendor_type = discovered_vendor ,
204178 byo_connection_id = byo_connection_id ,
205179 ** model_kwargs ,
206180 )
181+
182+ from uipath_langchain_client .clients .google .chat_models import (
183+ UiPathChatGoogleGenerativeAI ,
184+ )
185+
186+ return UiPathChatGoogleGenerativeAI (
187+ model = model_name ,
188+ settings = client_settings ,
189+ byo_connection_id = byo_connection_id ,
190+ ** model_kwargs ,
191+ )
207192 case VendorType .AWSBEDROCK :
208- if "claude" in model_name :
193+ if model_family == "anthropicclaude" and api_flavor is None :
209194 from uipath_langchain_client .clients .bedrock .chat_models import (
210195 UiPathChatAnthropicBedrock ,
211196 )
0 commit comments