Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/pdl/pdl_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path
from typing import Any, Generator, Optional, Sequence, TypeVar

import httpx
import litellm
import yaml
from jinja2 import (
Expand Down Expand Up @@ -1140,8 +1141,15 @@ def get_transformed_inputs(kwargs):
if block.modelResponse is not None:
scope = scope | {block.modelResponse: raw_result}
return result, background, scope, trace
except httpx.RequestError as exc:
message = f"model '{block.model}' encountered {repr(exc)} trying to {exc.request.method} against {exc.request.url}"
raise PDLRuntimeError(
message,
loc=loc,
trace=ErrorBlock(msg=message, location=loc, program=concrete_block),
) from exc
except Exception as exc:
message = f"Error during model call: {repr(exc)}"
message = f"Error during '{block.model}' model call: {repr(exc)}"
raise PDLRuntimeError(
message,
loc=loc,
Expand Down
Loading