promptlayer 1.0.5__py3-none-any.whl → 1.0.6__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.

Potentially problematic release.


This version of promptlayer might be problematic. Click here for more details.

promptlayer/utils.py CHANGED
@@ -41,7 +41,12 @@ def promptlayer_api_handler(
41
41
  isinstance(response, types.GeneratorType)
42
42
  or isinstance(response, types.AsyncGeneratorType)
43
43
  or type(response).__name__
44
- in ["Stream", "AsyncStream", "AsyncMessageStreamManager"]
44
+ in [
45
+ "Stream",
46
+ "AsyncStream",
47
+ "AsyncMessageStreamManager",
48
+ "MessageStreamManager",
49
+ ]
45
50
  ):
46
51
  return GeneratorProxy(
47
52
  response,
@@ -356,6 +361,19 @@ class GeneratorProxy:
356
361
  self.api_key,
357
362
  )
358
363
 
364
+ def __enter__(self):
365
+ api_request_arguments = self.api_request_arugments
366
+ if hasattr(self.generator, "_MessageStreamManager__api_request"):
367
+ stream = self.generator.__enter__()
368
+ return GeneratorProxy(
369
+ stream,
370
+ api_request_arguments,
371
+ self.api_key,
372
+ )
373
+
374
+ def __exit__(self, exc_type, exc_val, exc_tb):
375
+ pass
376
+
359
377
  async def __aexit__(self, exc_type, exc_val, exc_tb):
360
378
  pass
361
379
 
@@ -458,7 +476,7 @@ class GeneratorProxy:
458
476
  hasattr(result.choices[0].delta, "content")
459
477
  and result.choices[0].delta.content is not None
460
478
  ):
461
- response[
479
+ response["content"] = response[
462
480
  "content"
463
481
  ] = f"{response['content']}{result.choices[0].delta.content}"
464
482
  final_result = deepcopy(self.results[-1])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: promptlayer
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: PromptLayer is a platform for prompt engineering and tracks your LLM requests.
5
5
  License: Apache-2.0
6
6
  Author: Magniv
@@ -7,8 +7,8 @@ promptlayer/track/__init__.py,sha256=VheO_Au0lffGlPKYYPQwkv8ci16wSXABCVSNRoFWu_w
7
7
  promptlayer/track/track.py,sha256=XNEZT9yNiRBPp9vaDZo_f0dP_ldOu8q1qafpVfS5Ze8,1610
8
8
  promptlayer/types/__init__.py,sha256=ulWSyCrk5hZ_PI-nKGpd6GPcRaK8lqP4wFl0LPNUYWk,61
9
9
  promptlayer/types/prompt_template.py,sha256=1iqwH0f7MIITjUEH0BMnSKzMh2BbcB7W8rCmQEaUhQ0,4284
10
- promptlayer/utils.py,sha256=pVRLCAIikoCn1p95otxZYn0xMFN-cnDBJyN1fbT58tE,27305
11
- promptlayer-1.0.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- promptlayer-1.0.5.dist-info/METADATA,sha256=Yh49bWt30Wo_kzVVy-VGlt-jsN2_wO9zoor0d-x9V9c,4506
13
- promptlayer-1.0.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
14
- promptlayer-1.0.5.dist-info/RECORD,,
10
+ promptlayer/utils.py,sha256=vourOtK8UnTAMKw9jjXhXR4zR3XYJsdLBBF31A3yW2w,27824
11
+ promptlayer-1.0.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ promptlayer-1.0.6.dist-info/METADATA,sha256=0nb2ghDvKr2sm9GR-o0EE-_ZQGpDKliiEg9051J6Rog,4506
13
+ promptlayer-1.0.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
14
+ promptlayer-1.0.6.dist-info/RECORD,,