1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16- import pytest
1716from typing import cast
17+ from unittest .mock import AsyncMock
18+
19+ import pytest
1820from langchain_core .language_models import BaseLanguageModel
1921from langchain_core .messages import AIMessage
20- from unittest .mock import AsyncMock
2122
2223from nemoguardrails .actions .llm .utils import (
2324 _extract_reasoning_from_additional_kwargs ,
2728 _infer_provider_from_module ,
2829 _store_reasoning_traces ,
2930 _store_tool_calls ,
31+ llm_call ,
3032)
3133from nemoguardrails .context import reasoning_trace_var , tool_calls_var
3234from nemoguardrails .exceptions import LLMCallException
@@ -581,6 +583,7 @@ def test_store_tool_calls_with_real_aimessage_multiple_tool_calls():
581583 assert tool_calls [0 ]["name" ] == "foo"
582584 assert tool_calls [1 ]["name" ] == "bar"
583585
586+
584587@pytest .mark .asyncio
585588async def test_llm_call_exception_enrichment_with_model_and_endpoint ():
586589 """Test that LLM invocation errors include model and endpoint context."""
@@ -663,4 +666,4 @@ async def test_llm_call_exception_extracts_nested_client_base_url():
663666 exc_str = str (exc_info .value )
664667 assert "https://custom.endpoint.com/v1" in exc_str
665668 assert "gpt-4-turbo" in exc_str
666- assert "Client error" in exc_str
669+ assert "Client error" in exc_str
0 commit comments