REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.22 KB
Close
/opt/hc_python/lib64/python3.12/site-packages/sentry_sdk/integrations/pydantic_ai/patches/model_request.py
Text
Base64
from functools import wraps from typing import TYPE_CHECKING from sentry_sdk.integrations import DidNotEnable try: from pydantic_ai import models # type: ignore except ImportError: raise DidNotEnable("pydantic-ai not installed") from ..spans import ai_client_span, update_ai_client_span if TYPE_CHECKING: from typing import Any def _patch_model_request(): # type: () -> None """ Patches model request execution to create AI client spans. In pydantic-ai, model requests are handled through the Model interface. We need to patch the request method on models to create spans. """ # Patch the base Model class's request method if hasattr(models, "Model"): original_request = models.Model.request @wraps(original_request) async def wrapped_request(self, messages, *args, **kwargs): # type: (Any, Any, *Any, **Any) -> Any # Pass all messages (full conversation history) with ai_client_span(messages, None, self, None) as span: result = await original_request(self, messages, *args, **kwargs) update_ai_client_span(span, result) return result models.Model.request = wrapped_request
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
agent_run.py
7.27 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
graph_nodes.py
3.75 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
model_request.py
1.22 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tools.py
2.88 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
229 B
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).