REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.37 KB
Close
/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/integrations/openai_agents/patches/models.py
Text
Base64
from functools import wraps from sentry_sdk.integrations import DidNotEnable from ..spans import ai_client_span, update_ai_client_span from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Any, Callable try: import agents except ImportError: raise DidNotEnable("OpenAI Agents not installed") def _create_get_model_wrapper(original_get_model): # type: (Callable[..., Any]) -> Callable[..., Any] """ Wraps the agents.Runner._get_model method to wrap the get_response method of the model to create a AI client span. """ @wraps( original_get_model.__func__ if hasattr(original_get_model, "__func__") else original_get_model ) def wrapped_get_model(cls, agent, run_config): # type: (agents.Runner, agents.Agent, agents.RunConfig) -> agents.Model model = original_get_model(agent, run_config) original_get_response = model.get_response @wraps(original_get_response) async def wrapped_get_response(*args, **kwargs): # type: (*Any, **Any) -> Any with ai_client_span(agent, kwargs) as span: result = await original_get_response(*args, **kwargs) update_ai_client_span(span, agent, kwargs, result) return result model.get_response = wrapped_get_response return model return wrapped_get_model
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 6
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
5.64 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
error_tracing.py
2.57 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
models.py
1.37 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
runner.py
1.45 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
3.18 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
293 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).