Skip to content

Commit b1f0b9b

Browse files
authored
Remove 3rd party patterns from the sdk (#1047)
* Nuked third party, openai transffered to first party * fix tests * fix
1 parent 8910449 commit b1f0b9b

File tree

28 files changed

+1819
-2877
lines changed

28 files changed

+1819
-2877
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Configuration for OpenAI instrumentation.
2+
3+
This module provides a global configuration object that can be used to customize
4+
the behavior of OpenAI instrumentation across all components.
5+
"""
6+
7+
from typing import Callable, Optional, Dict
8+
from typing_extensions import Protocol
9+
10+
11+
class UploadImageCallable(Protocol):
12+
"""Protocol for the upload_base64_image function."""
13+
14+
async def __call__(self, trace_id: str, span_id: str, image_name: str, base64_string: str) -> str:
15+
"""Upload a base64 image and return the URL."""
16+
...
17+
18+
19+
class Config:
20+
"""Global configuration for OpenAI instrumentation.
21+
22+
Attributes:
23+
enrich_token_usage: Whether to calculate token usage for streaming responses
24+
enrich_assistant: Whether to enrich assistant responses with additional data
25+
exception_logger: Optional function to log exceptions
26+
get_common_metrics_attributes: Function to get common attributes for metrics
27+
upload_base64_image: Optional async function to upload base64 images
28+
enable_trace_context_propagation: Whether to propagate trace context in headers
29+
"""
30+
31+
enrich_token_usage: bool = True
32+
enrich_assistant: bool = True
33+
exception_logger: Optional[Callable[[Exception], None]] = None
34+
get_common_metrics_attributes: Callable[[], Dict[str, str]] = lambda: {}
35+
upload_base64_image: Optional[UploadImageCallable] = None
36+
enable_trace_context_propagation: bool = True

0 commit comments

Comments
 (0)