prompty 1.0.0a1__py3-none-any.whl → 1.0.0a2__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.
- prompty/__init__.py +4 -4
- prompty/_version.py +1 -1
- prompty/azure/processor.py +4 -4
- prompty/core.py +8 -1
- {prompty-1.0.0a1.dist-info → prompty-1.0.0a2.dist-info}/METADATA +1 -1
- {prompty-1.0.0a1.dist-info → prompty-1.0.0a2.dist-info}/RECORD +9 -9
- {prompty-1.0.0a1.dist-info → prompty-1.0.0a2.dist-info}/WHEEL +0 -0
- {prompty-1.0.0a1.dist-info → prompty-1.0.0a2.dist-info}/entry_points.txt +0 -0
- {prompty-1.0.0a1.dist-info → prompty-1.0.0a2.dist-info}/licenses/LICENSE +0 -0
prompty/__init__.py
CHANGED
@@ -482,7 +482,7 @@ async def run_async(
|
|
482
482
|
|
483
483
|
@trace(description="Execute a prompty")
|
484
484
|
def execute(
|
485
|
-
prompt: Union[str, Prompty],
|
485
|
+
prompt: Union[str, Path, Prompty],
|
486
486
|
connection: dict[str, typing.Any] = {},
|
487
487
|
options: dict[str, typing.Any] = {},
|
488
488
|
inputs: dict[str, typing.Any] = {},
|
@@ -525,7 +525,7 @@ def execute(
|
|
525
525
|
# get caller's path (take into account trace frame)
|
526
526
|
caller = Path(traceback.extract_stack()[-3].filename)
|
527
527
|
path = Path(caller.parent / path).resolve().absolute()
|
528
|
-
prompt = load(path, config_name)
|
528
|
+
prompt = load(str(path), config_name)
|
529
529
|
|
530
530
|
# prepare content
|
531
531
|
content = prepare(prompt, inputs, merge_sample)
|
@@ -538,7 +538,7 @@ def execute(
|
|
538
538
|
|
539
539
|
@trace(description="Execute a prompty")
|
540
540
|
async def execute_async(
|
541
|
-
prompt: Union[str, Prompty],
|
541
|
+
prompt: Union[str, Path, Prompty],
|
542
542
|
connection: dict[str, typing.Any] = {},
|
543
543
|
options: dict[str, typing.Any] = {},
|
544
544
|
inputs: dict[str, typing.Any] = {},
|
@@ -581,7 +581,7 @@ async def execute_async(
|
|
581
581
|
# get caller's path (take into account trace frame)
|
582
582
|
caller = Path(traceback.extract_stack()[-3].filename)
|
583
583
|
path = Path(caller.parent / path).resolve().absolute()
|
584
|
-
prompt = await load_async(path, config_name)
|
584
|
+
prompt = await load_async(str(path), config_name)
|
585
585
|
|
586
586
|
# prepare content
|
587
587
|
content = await prepare_async(prompt, inputs, merge_sample)
|
prompty/_version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "1.0.
|
1
|
+
VERSION = "1.0.0a2"
|
prompty/azure/processor.py
CHANGED
@@ -94,12 +94,12 @@ class AzureOpenAIProcessor(Invoker):
|
|
94
94
|
elif isinstance(data, ImagesResponse):
|
95
95
|
item: ImagesResponse = data
|
96
96
|
|
97
|
-
if len(
|
97
|
+
if item.data is None or len(item.data) == 0:
|
98
98
|
raise ValueError("Invalid data")
|
99
|
-
elif len(
|
100
|
-
return
|
99
|
+
elif len(item.data) == 1:
|
100
|
+
return item.data[0].url if item.data[0].url else item.data[0].b64_json
|
101
101
|
else:
|
102
|
-
return [
|
102
|
+
return [i.url if i.url else i.b64_json for i in item.data]
|
103
103
|
|
104
104
|
elif isinstance(data, Iterator):
|
105
105
|
|
prompty/core.py
CHANGED
@@ -371,7 +371,14 @@ class Prompty:
|
|
371
371
|
default: Union[Callable[[], dict[str, typing.Any]], None] = None,
|
372
372
|
) -> dict[str, typing.Any]:
|
373
373
|
|
374
|
-
if isinstance(value, dict)
|
374
|
+
if isinstance(value, dict):
|
375
|
+
# check for minimal set of properties
|
376
|
+
if "type" not in value:
|
377
|
+
if "sample" in value:
|
378
|
+
# if sample is present, type is not required
|
379
|
+
value["type"] = get_json_type(type(value["sample"]))
|
380
|
+
else:
|
381
|
+
raise ValueError(f"{cls.__name__} type is required or must be inferred from sample")
|
375
382
|
return {**value}
|
376
383
|
else:
|
377
384
|
if default is not None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: prompty
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0a2
|
4
4
|
Summary: Prompty is a new asset class and format for LLM prompts that aims to provide observability, understandability, and portability for developers. It includes spec, tooling, and a runtime. This Prompty runtime supports Python
|
5
5
|
Author-email: Seth Juarez <seth.juarez@microsoft.com>
|
6
6
|
Requires-Python: >=3.9
|
@@ -1,8 +1,8 @@
|
|
1
|
-
prompty/__init__.py,sha256=
|
2
|
-
prompty/_version.py,sha256=
|
1
|
+
prompty/__init__.py,sha256=v7ggLd334vKzxPcxf55DZolz3FuOmcoaK5dStcTrJ1Y,16617
|
2
|
+
prompty/_version.py,sha256=hyATfK79pCyCZzz-IcAnlwvGTRpaZYpynyocFUoRWAM,20
|
3
3
|
prompty/cli.py,sha256=v6JJsxsAREu660PleFIosY9LUYfzKR7lXgr9aMTYnPU,5110
|
4
4
|
prompty/common.py,sha256=wfLLN3cIgODEFjxnWFAwno5v5iobJsW9_M5m_cWqBik,2224
|
5
|
-
prompty/core.py,sha256=
|
5
|
+
prompty/core.py,sha256=MtOOmeG9ZmsHdW6EceXuIH4B6crn42kZR7x-Owc8bKc,27673
|
6
6
|
prompty/invoker.py,sha256=sd1tCWO41_ILqmD2g9wRhVWyTN0w9yfuy0T01eGuh5w,14879
|
7
7
|
prompty/parsers.py,sha256=SiffgiCZw1PGA5g5cgrILKEesST3XtDwajm7kGDJkww,9049
|
8
8
|
prompty/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -11,7 +11,7 @@ prompty/tracer.py,sha256=BBZTNElCjIJP_RipVav36ym-l9K2NNRrCoJHQMS6lmQ,11650
|
|
11
11
|
prompty/utils.py,sha256=_SY0sdfrWJjsEq34HchlJ6cwUXIzkO4w00tq9txSh0M,3711
|
12
12
|
prompty/azure/__init__.py,sha256=6WFrY3uaaK4bNki4WKhR-s3aK3IOfxZdQAKDWXiHZi0,297
|
13
13
|
prompty/azure/executor.py,sha256=DRWhPhLzgXbH6WryfP2pwlna2RE3daSw4WCxywUyp-s,16493
|
14
|
-
prompty/azure/processor.py,sha256=
|
14
|
+
prompty/azure/processor.py,sha256=tVQRuaZVxNpJ_mQ4EKrNlpwashl66Bi5-l0TNzdRxCw,7095
|
15
15
|
prompty/azure_beta/__init__.py,sha256=C7yLNTg3GSACbn87remrnEf5nYlBI6LF1WRqaTQlKdI,363
|
16
16
|
prompty/azure_beta/executor.py,sha256=0Gq4R6L61sXY7YdNdNwtJZwa1W8bbNkC_FdBkODVW6o,10544
|
17
17
|
prompty/openai/__init__.py,sha256=ahW5UM56rFpRZ0EWYRE34cKUy9GKD8zWdMsMlataCdg,289
|
@@ -20,8 +20,8 @@ prompty/openai/processor.py,sha256=oG7E7lFbWw9p6A7YWt7U3NmyGmkoW0vghYX2ekBejSw,2
|
|
20
20
|
prompty/serverless/__init__.py,sha256=szklP_c9ppNHITAngE-oFdd5BbAiyF2LZgg6J5sBjmc,298
|
21
21
|
prompty/serverless/executor.py,sha256=eb1a_onIwf4gj_HflnKzWwzlj-50iJZiWYiMs24yMXs,9058
|
22
22
|
prompty/serverless/processor.py,sha256=-XJScOBbKTnt_sJI_B4bMYaiKW3AI4Zgpo06e4MdM0s,3596
|
23
|
-
prompty-1.0.
|
24
|
-
prompty-1.0.
|
25
|
-
prompty-1.0.
|
26
|
-
prompty-1.0.
|
27
|
-
prompty-1.0.
|
23
|
+
prompty-1.0.0a2.dist-info/entry_points.txt,sha256=USBrLTMgXA_8CPMTAmqnD4uCCLTd0ZTOusmWipnLe7w,43
|
24
|
+
prompty-1.0.0a2.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
|
25
|
+
prompty-1.0.0a2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
26
|
+
prompty-1.0.0a2.dist-info/METADATA,sha256=8xFFSwB_hSPkEcwkMXhYiL_X324tH8Veavvm4saUnS0,9956
|
27
|
+
prompty-1.0.0a2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|