promptlayer 1.0.5__tar.gz → 1.0.6__tar.gz
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-1.0.5 → promptlayer-1.0.6}/PKG-INFO +1 -1
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/utils.py +20 -2
- {promptlayer-1.0.5 → promptlayer-1.0.6}/pyproject.toml +1 -1
- {promptlayer-1.0.5 → promptlayer-1.0.6}/LICENSE +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/README.md +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/__init__.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/groups/__init__.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/groups/groups.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/promptlayer.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/templates.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/track/__init__.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/track/track.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/types/__init__.py +0 -0
- {promptlayer-1.0.5 → promptlayer-1.0.6}/promptlayer/types/prompt_template.py +0 -0
|
@@ -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 [
|
|
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])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|