Skip to content

Commit bd9227e

Browse files
committed
fix(llm): restore endpoint URL in LLMCallException via provider_url
The old _raise_llm_call_exception extracted endpoint URLs by checking BASE_URL_ATTRIBUTES on the raw LangChain LLM. This was lost in the rewrite. Restore it by using LLMModel.provider_url and implementing the attribute inspection in LangChainLLMAdapter.provider_url.
1 parent 6e581da commit bd9227e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

nemoguardrails/actions/llm/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,15 @@ def _raise_llm_call_exception(
277277
llm_call_info = llm_call_info_var.get()
278278
model_name = llm_call_info.llm_model_name if llm_call_info else model.model_name
279279
provider_name = llm_call_info.llm_provider_name if llm_call_info else model.provider_name
280+
endpoint_url = model.provider_url
280281

281282
context_parts = []
282283
if model_name:
283284
context_parts.append(f"model={model_name}")
284285
if provider_name:
285286
context_parts.append(f"provider={provider_name}")
287+
if endpoint_url:
288+
context_parts.append(f"endpoint={endpoint_url}")
286289

287290
if context_parts:
288291
detail = f"Error invoking LLM ({', '.join(context_parts)})"

nemoguardrails/integrations/langchain/llm_adapter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ def provider_name(self) -> Optional[str]:
130130

131131
@property
132132
def provider_url(self) -> Optional[str]:
133-
# temp: uses _BASE_URL_ATTRIBUTES which duplicates utils.py BASE_URL_ATTRIBUTES.
134-
# utils.py copy will be removed in stack-3 when it switches to model.provider_url.
135133
for attr in _BASE_URL_ATTRIBUTES:
136134
value = getattr(self._llm, attr, None)
137135
if value:

0 commit comments

Comments
 (0)