promptlayer 1.0.14__py3-none-any.whl → 1.0.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- promptlayer/__init__.py +1 -1
- promptlayer/promptlayer.py +3 -12
- promptlayer/span_exporter.py +1 -3
- {promptlayer-1.0.14.dist-info → promptlayer-1.0.15.dist-info}/METADATA +1 -1
- {promptlayer-1.0.14.dist-info → promptlayer-1.0.15.dist-info}/RECORD +7 -7
- {promptlayer-1.0.14.dist-info → promptlayer-1.0.15.dist-info}/LICENSE +0 -0
- {promptlayer-1.0.14.dist-info → promptlayer-1.0.15.dist-info}/WHEEL +0 -0
promptlayer/__init__.py
CHANGED
promptlayer/promptlayer.py
CHANGED
|
@@ -61,7 +61,6 @@ class PromptLayer:
|
|
|
61
61
|
self,
|
|
62
62
|
api_key: str = None,
|
|
63
63
|
enable_tracing: bool = False,
|
|
64
|
-
workspace_id: int = None,
|
|
65
64
|
):
|
|
66
65
|
if api_key is None:
|
|
67
66
|
api_key = os.environ.get("PROMPTLAYER_API_KEY")
|
|
@@ -72,15 +71,11 @@ class PromptLayer:
|
|
|
72
71
|
"Please set the PROMPTLAYER_API_KEY environment variable or pass the api_key parameter."
|
|
73
72
|
)
|
|
74
73
|
|
|
75
|
-
if enable_tracing and not workspace_id:
|
|
76
|
-
raise ValueError("Please set a workspace_id to enable tracing.")
|
|
77
|
-
|
|
78
74
|
self.api_key = api_key
|
|
79
75
|
self.templates = TemplateManager(api_key)
|
|
80
76
|
self.group = GroupManager(api_key)
|
|
81
|
-
self.tracer = self._initialize_tracer(api_key, enable_tracing
|
|
77
|
+
self.tracer = self._initialize_tracer(api_key, enable_tracing)
|
|
82
78
|
self.track = TrackManager(api_key)
|
|
83
|
-
self.workspace_id = workspace_id
|
|
84
79
|
|
|
85
80
|
def __getattr__(
|
|
86
81
|
self,
|
|
@@ -140,17 +135,13 @@ class PromptLayer:
|
|
|
140
135
|
return self.templates.get(prompt_name, template_params)
|
|
141
136
|
|
|
142
137
|
@staticmethod
|
|
143
|
-
def _initialize_tracer(
|
|
144
|
-
api_key: str = None, enable_tracing: bool = False, workspace_id: int = None
|
|
145
|
-
):
|
|
138
|
+
def _initialize_tracer(api_key: str = None, enable_tracing: bool = False):
|
|
146
139
|
if enable_tracing:
|
|
147
140
|
resource = Resource(
|
|
148
141
|
attributes={ResourceAttributes.SERVICE_NAME: "prompt-layer-library"}
|
|
149
142
|
)
|
|
150
143
|
tracer_provider = TracerProvider(resource=resource)
|
|
151
|
-
promptlayer_exporter = PromptLayerSpanExporter(
|
|
152
|
-
api_key=api_key, workspace_id=workspace_id
|
|
153
|
-
)
|
|
144
|
+
promptlayer_exporter = PromptLayerSpanExporter(api_key=api_key)
|
|
154
145
|
span_processor = BatchSpanProcessor(promptlayer_exporter)
|
|
155
146
|
tracer_provider.add_span_processor(span_processor)
|
|
156
147
|
trace.set_tracer_provider(tracer_provider)
|
promptlayer/span_exporter.py
CHANGED
|
@@ -8,10 +8,9 @@ from promptlayer.utils import URL_API_PROMPTLAYER
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class PromptLayerSpanExporter(SpanExporter):
|
|
11
|
-
def __init__(self, api_key: str = None
|
|
11
|
+
def __init__(self, api_key: str = None):
|
|
12
12
|
self.api_key = api_key
|
|
13
13
|
self.url = f"{URL_API_PROMPTLAYER}/spans-bulk"
|
|
14
|
-
self.workspace_id = workspace_id
|
|
15
14
|
|
|
16
15
|
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
|
|
17
16
|
request_data = []
|
|
@@ -65,7 +64,6 @@ class PromptLayerSpanExporter(SpanExporter):
|
|
|
65
64
|
},
|
|
66
65
|
json={
|
|
67
66
|
"spans": request_data,
|
|
68
|
-
"workspace_id": self.workspace_id,
|
|
69
67
|
},
|
|
70
68
|
)
|
|
71
69
|
response.raise_for_status()
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
promptlayer/__init__.py,sha256=
|
|
1
|
+
promptlayer/__init__.py,sha256=8vxeHBU5BPTZdU-ySNdUQd3julW-3KLrIt26tKuCdOA,102
|
|
2
2
|
promptlayer/groups/__init__.py,sha256=-xs-2cn0nc0D_5YxZr3nC86iTdRVZmBhEpOKDJXE-sQ,224
|
|
3
3
|
promptlayer/groups/groups.py,sha256=yeO6T0TM3qB0ondZRiHhcH8G06YygrpFoM8b9RmoIao,165
|
|
4
|
-
promptlayer/promptlayer.py,sha256=
|
|
4
|
+
promptlayer/promptlayer.py,sha256=uN2kN_JagtMJcutmUDo9gKHhvW9MrVeItibCBkgUNjk,15217
|
|
5
5
|
promptlayer/promptlayer_base.py,sha256=sev-EZehRXJSZSmJtMkqmAUK1345pqbDY_lNjPP5MYA,7158
|
|
6
|
-
promptlayer/span_exporter.py,sha256=
|
|
6
|
+
promptlayer/span_exporter.py,sha256=zIJNsb3Fe6yb5wKLDmkoPF2wqFjk1p39E0jWHD2plzI,2658
|
|
7
7
|
promptlayer/templates.py,sha256=aY_-BCrL0AgIdYEUE28pi0AP_avTVAgwv5hgzrh75vo,717
|
|
8
8
|
promptlayer/track/__init__.py,sha256=VheO_Au0lffGlPKYYPQwkv8ci16wSXABCVSNRoFWu_w,945
|
|
9
9
|
promptlayer/track/track.py,sha256=XNEZT9yNiRBPp9vaDZo_f0dP_ldOu8q1qafpVfS5Ze8,1610
|
|
10
10
|
promptlayer/types/__init__.py,sha256=ulWSyCrk5hZ_PI-nKGpd6GPcRaK8lqP4wFl0LPNUYWk,61
|
|
11
11
|
promptlayer/types/prompt_template.py,sha256=QbxYSeIubrwp8KmDKdt9syAwzONFPh_So9yr4H73ANQ,4429
|
|
12
12
|
promptlayer/utils.py,sha256=-p0qapUvkZYJd_Dfat3c8LANXWU1JN0bJB91IyjB8iA,29656
|
|
13
|
-
promptlayer-1.0.
|
|
14
|
-
promptlayer-1.0.
|
|
15
|
-
promptlayer-1.0.
|
|
16
|
-
promptlayer-1.0.
|
|
13
|
+
promptlayer-1.0.15.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
+
promptlayer-1.0.15.dist-info/METADATA,sha256=Dv-uyrjmYJcGqbHMfC3IbXVmTz6jW9I_MR28NZdz0Hc,4609
|
|
15
|
+
promptlayer-1.0.15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
16
|
+
promptlayer-1.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|