prompty 1.0.0b2__py3-none-any.whl → 1.0.0b3__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/_version.py CHANGED
@@ -1 +1 @@
1
- VERSION = "1.0.0b2"
1
+ VERSION = "1.0.0b3"
prompty/cli.py CHANGED
@@ -99,6 +99,8 @@ def execute(prompt_path: str, inputs: Optional[dict[str, Any]] = None, raw=False
99
99
  print("\n", json.dumps(asdict(result), indent=4), "\n")
100
100
  elif isinstance(result, list):
101
101
  print("\n", json.dumps([asdict(item) for item in result], indent=4), "\n")
102
+ elif isinstance(result, dict):
103
+ print("\n", json.dumps(result, indent=4), "\n")
102
104
  else:
103
105
  print("\n", result, "\n")
104
106
  except Exception as e:
prompty/core.py CHANGED
@@ -206,13 +206,13 @@ class Prompty:
206
206
  # template
207
207
  template: TemplateProperty = field(default_factory=TemplateProperty)
208
208
 
209
- file: Union[str, Path] = field(default="")
209
+ # yaml based instructions
210
210
  instructions: str = field(default="")
211
211
  additional_instructions: str = field(default="")
212
- content: Union[str, list[str], dict] = field(default="")
213
- instructions = field(default="")
214
- additional_instructions = field(default="")
215
212
 
213
+ # internal properties
214
+ file: Union[str, Path] = field(default="")
215
+ content: Union[str, list[str], dict] = field(default="")
216
216
  slots: list[dict[str, str]] = field(default_factory=list)
217
217
 
218
218
  def get_input(self, name: str) -> Union[InputProperty, None]:
prompty/invoker.py CHANGED
@@ -180,6 +180,7 @@ class Renderer(Invoker):
180
180
  def __init__(self, prompty: Prompty) -> None:
181
181
  super().__init__(prompty)
182
182
 
183
+ @trace
183
184
  def run(self, data: typing.Any) -> typing.Any:
184
185
  """Method to run the invoker
185
186
 
@@ -201,6 +202,7 @@ class Renderer(Invoker):
201
202
 
202
203
  return self.invoke(data)
203
204
 
205
+ @trace
204
206
  async def run_async(self, data: typing.Any) -> typing.Any:
205
207
  """Method to run the invoker asynchronously
206
208
 
prompty/tracer.py CHANGED
@@ -107,7 +107,9 @@ def _name(func: Callable, args):
107
107
  signature = f"{func.__module__}.{func.__name__}"
108
108
 
109
109
  # core invoker gets special treatment prompty.invoker.Invoker
110
- core_invoker = signature.startswith("prompty.invoker.Invoker.run")
110
+ core_invoker = signature.startswith("prompty.invoker.") and (
111
+ signature.endswith("run") or signature.endswith("run_async")
112
+ )
111
113
  if core_invoker:
112
114
  name = type(args[0]).__name__
113
115
  if signature.endswith("async"):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prompty
3
- Version: 1.0.0b2
3
+ Version: 1.0.0b3
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,13 +1,13 @@
1
1
  prompty/__init__.py,sha256=v7ggLd334vKzxPcxf55DZolz3FuOmcoaK5dStcTrJ1Y,16617
2
- prompty/_version.py,sha256=6DOdjA8Flc2av1WYSDfNW5sNH1CmHEzYM3zJdb1qVwE,20
3
- prompty/cli.py,sha256=v6JJsxsAREu660PleFIosY9LUYfzKR7lXgr9aMTYnPU,5110
2
+ prompty/_version.py,sha256=LfvFiIn-1yF82peiMyebrCYRr7ht5uPtbgAQ7TLIl-k,20
3
+ prompty/cli.py,sha256=kW1JjPp9EXz135zDViWRVF4xQgm3jFQB2KJFR_V_Gxc,5217
4
4
  prompty/common.py,sha256=l9uYeJWwobinjcoubtUKZUGiVjBTiDuo0IjOJU5Zy4w,3061
5
- prompty/core.py,sha256=6hq_jGlvYssCLxOXP72Q5mGIPxuU7IGCzGBofR6EelM,28271
6
- prompty/invoker.py,sha256=M5jzIuxpaSaHw8aIXqfRMnpjv6OVZyBEqba2_BsdmKU,14805
5
+ prompty/core.py,sha256=ORQOFWZ7s0CPH48CkJG6K88IJIHN_Oemqt_Ghf1mEbs,28242
6
+ prompty/invoker.py,sha256=hbD3Yrs5-fHRQb_6fJgDe2bdqbQRZ1C_AJPu4dg4qjs,14827
7
7
  prompty/parsers.py,sha256=SiffgiCZw1PGA5g5cgrILKEesST3XtDwajm7kGDJkww,9049
8
8
  prompty/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  prompty/renderers.py,sha256=JQR_Z_IxrdLM7OfBwXL1mOFP81CQ6wYJXhLVO80Uj94,2457
10
- prompty/tracer.py,sha256=BBZTNElCjIJP_RipVav36ym-l9K2NNRrCoJHQMS6lmQ,11650
10
+ prompty/tracer.py,sha256=Rrgev4tPXEwv6-yIfa16U4Bdw-ET3K99M0IyJWuYQpo,11720
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=NoHlPGkT9s0pqLISleslvZPb7aYxPtwnXqGdxhXGkRY,18796
@@ -18,8 +18,8 @@ prompty/openai/processor.py,sha256=oG7E7lFbWw9p6A7YWt7U3NmyGmkoW0vghYX2ekBejSw,2
18
18
  prompty/serverless/__init__.py,sha256=szklP_c9ppNHITAngE-oFdd5BbAiyF2LZgg6J5sBjmc,298
19
19
  prompty/serverless/executor.py,sha256=eb1a_onIwf4gj_HflnKzWwzlj-50iJZiWYiMs24yMXs,9058
20
20
  prompty/serverless/processor.py,sha256=-XJScOBbKTnt_sJI_B4bMYaiKW3AI4Zgpo06e4MdM0s,3596
21
- prompty-1.0.0b2.dist-info/entry_points.txt,sha256=USBrLTMgXA_8CPMTAmqnD4uCCLTd0ZTOusmWipnLe7w,43
22
- prompty-1.0.0b2.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
23
- prompty-1.0.0b2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
- prompty-1.0.0b2.dist-info/METADATA,sha256=_Hnxy484gn-WP6f-Km0xo_PL_84uk4FW_P1GP_kFlMI,9956
25
- prompty-1.0.0b2.dist-info/RECORD,,
21
+ prompty-1.0.0b3.dist-info/entry_points.txt,sha256=USBrLTMgXA_8CPMTAmqnD4uCCLTd0ZTOusmWipnLe7w,43
22
+ prompty-1.0.0b3.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
23
+ prompty-1.0.0b3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
+ prompty-1.0.0b3.dist-info/METADATA,sha256=MatDqrRUGDygTiwrpO5ES35xYsuVglGoGwILgMNi_6A,9956
25
+ prompty-1.0.0b3.dist-info/RECORD,,