prompty 0.1.17__py2.py3-none-any.whl → 0.1.18__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
prompty/core.py CHANGED
@@ -529,7 +529,9 @@ class PromptyStream(Iterator):
529
529
  # StopIteration is raised
530
530
  # contents are exhausted
531
531
  if len(self.items) > 0:
532
- with Tracer.start(f"{self.name}.PromptyStream") as trace:
532
+ with Tracer.start("PromptyStream") as trace:
533
+ trace("signature", f"{self.name}.PromptyStream")
534
+ trace("inputs", "None")
533
535
  trace("result", [to_dict(s) for s in self.items])
534
536
 
535
537
  raise StopIteration
prompty/tracer.py CHANGED
@@ -108,8 +108,21 @@ def _trace_sync(func: Callable = None, *, description: str = None) -> Callable:
108
108
  inputs = _inputs(func, args, kwargs)
109
109
  trace("inputs", inputs)
110
110
 
111
- result = func(*args, **kwargs)
112
- trace("result", _results(result))
111
+ try:
112
+ result = func(*args, **kwargs)
113
+ trace("result", _results(result))
114
+ except Exception as e:
115
+ trace(
116
+ "result",
117
+ {
118
+ "exception": {
119
+ "type": type(e).__name__,
120
+ "message": str(e),
121
+ "args": e.args,
122
+ }
123
+ },
124
+ )
125
+ raise e
113
126
 
114
127
  return result
115
128
 
@@ -129,9 +142,21 @@ def _trace_async(func: Callable = None, *, description: str = None) -> Callable:
129
142
 
130
143
  inputs = _inputs(func, args, kwargs)
131
144
  trace("inputs", inputs)
132
-
133
- result = await func(*args, **kwargs)
134
- trace("result", _results(result))
145
+ try:
146
+ result = await func(*args, **kwargs)
147
+ trace("result", _results(result))
148
+ except Exception as e:
149
+ trace(
150
+ "result",
151
+ {
152
+ "exception": {
153
+ "type": type(e).__name__,
154
+ "message": str(e),
155
+ "args": e.args,
156
+ }
157
+ },
158
+ )
159
+ raise e
135
160
 
136
161
  return result
137
162
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prompty
3
- Version: 0.1.17
3
+ Version: 0.1.18
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-Dist: pyyaml>=6.0.1
@@ -1,13 +1,13 @@
1
- prompty-0.1.17.dist-info/METADATA,sha256=Dxi-bayoYlgrg2ldnCK54K5sDT9KXKctpMDRPJ8_0Bw,8916
2
- prompty-0.1.17.dist-info/WHEEL,sha256=CuZGaXTwoRLAOVv0AcE3bCTxO5ejVuBEJkUBe9C-kvk,94
3
- prompty-0.1.17.dist-info/entry_points.txt,sha256=9y1lKPWUpPWRJzUslcVH-gMwbNoa2PzjyoZsKYLQqyw,45
4
- prompty-0.1.17.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
1
+ prompty-0.1.18.dist-info/METADATA,sha256=xQtpcI0HepyxgkqLN5BnUT9RrbcrTSrY68XeMnEe1MM,8916
2
+ prompty-0.1.18.dist-info/WHEEL,sha256=CuZGaXTwoRLAOVv0AcE3bCTxO5ejVuBEJkUBe9C-kvk,94
3
+ prompty-0.1.18.dist-info/entry_points.txt,sha256=9y1lKPWUpPWRJzUslcVH-gMwbNoa2PzjyoZsKYLQqyw,45
4
+ prompty-0.1.18.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
5
5
  prompty/__init__.py,sha256=XTUgJ3xT7HYJieuWW5PBItey0BWneg3G7iBBjIeNJZU,11628
6
6
  prompty/azure/__init__.py,sha256=ptGajCh68s_tugPv45Y4GJCyBToNFCExUzUh9yIBIfo,292
7
7
  prompty/azure/executor.py,sha256=x2ng2EbYUxbingjy8w27TFGWezs4QC0LHh_S0F0-E1U,3082
8
8
  prompty/azure/processor.py,sha256=e9CcKG665zvCLPeJfS91FM6c_W_6YY0mVENxinCo19A,2253
9
9
  prompty/cli.py,sha256=k8Rxm41fMFNvmnsX737UiN6v-7756tpoJPN4rPXMNcU,3726
10
- prompty/core.py,sha256=O_Kvj7XjaNG50_mWzpxf5xVOEOWGYBkwBXqPA__5kz0,17126
10
+ prompty/core.py,sha256=VzhOp2tulAKAF0I_5ULlII6QZ0thN1FRtPqPhwDpjPY,17226
11
11
  prompty/openai/__init__.py,sha256=16LxFrG_qGMg_Nx_BTMkCZupPEADsi8Gj234uFiXoZo,273
12
12
  prompty/openai/executor.py,sha256=5LXME0ACvbX3PSpSfh9ohDGWB50ZYBXLZG238wQiVGc,2212
13
13
  prompty/openai/processor.py,sha256=Cw-_O_r9B5QqiCsfIglI5lcJgKCStkse2iIDbPWxfhg,2169
@@ -16,5 +16,5 @@ prompty/renderers.py,sha256=RSHFQFx7AtKLUfsMLCXR0a56Mb7DL1NJNgjUqgg3IqU,776
16
16
  prompty/serverless/__init__.py,sha256=NPqoFATEMQ96G8OQkVcGxUWU4llIQCwxfJePPo8YFY8,279
17
17
  prompty/serverless/executor.py,sha256=fYCMV01iLBLpH2SQ9nxmrvY9ijAGpZezwkobZwUjSVQ,2781
18
18
  prompty/serverless/processor.py,sha256=pft1XGbPzo0MzQMbAt1VxsLsvRrjQO3B8MXEE2PfSA0,1982
19
- prompty/tracer.py,sha256=dwASxJsVnoUNIKLuBHtZAhD0JctbTCImBP5mjVGCnPo,8809
20
- prompty-0.1.17.dist-info/RECORD,,
19
+ prompty/tracer.py,sha256=tROL2gdDyjMi1WvyVzHXOsojGbPL2wvI2Dlnzt1VBcA,9628
20
+ prompty-0.1.18.dist-info/RECORD,,