Spaces:
Running
Running
File size: 890 Bytes
557ee65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | from typing import Optional, Any
class StructuredOutputError(Exception):
"""Exception raised when an LLM fails to produce valid structured output."""
def __init__(
self,
provider: str,
model: str,
prompt_id: str,
raw_output: str,
reason: str,
details: Optional[Any] = None,
):
self.provider = provider
self.model = model
self.prompt_id = prompt_id
self.raw_output = raw_output
self.reason = reason
self.details = details
message = (
f"Structured output failure for {provider}/{model} (Prompt: {prompt_id}). "
f"Reason: {reason}. Output snippet: {raw_output[:100]}..."
)
super().__init__(message)
class MissingCredentialError(Exception):
"""Raised when an LLM client cannot resolve required credentials."""
pass
|