File tree Expand file tree Collapse file tree
packages/nvidia_nat_langchain/src/nat/plugins/langchain Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,9 +169,20 @@ async def azure_openai_langchain(llm_config: AzureOpenAIModelConfig, _builder: B
169169async def nim_langchain (llm_config : NIMModelConfig , _builder : Builder ):
170170
171171 from langchain_nvidia_ai_endpoints import ChatNVIDIA
172+ from langchain_nvidia_ai_endpoints ._statics import MODEL_TABLE , Model
172173
173174 validate_no_responses_api (llm_config , LLMFrameworkEnum .LANGCHAIN )
174175
176+ # Pre-register unknown models so ChatNVIDIA skips the /v1/models API
177+ # call. This guards against upstream issues such as duplicate entries
178+ # in the API response that cause ChatNVIDIA to crash with AssertionError.
179+ if llm_config .model_name not in MODEL_TABLE :
180+ MODEL_TABLE [llm_config .model_name ] = Model (
181+ id = llm_config .model_name ,
182+ model_type = "chat" ,
183+ client = "ChatNVIDIA" ,
184+ )
185+
175186 # prefer max_completion_tokens over max_tokens
176187 # verify_ssl is a supported keyword parameter for the ChatNVIDIA client
177188 client = ChatNVIDIA (
You can’t perform that action at this time.
0 commit comments