prompty 0.1.36__py3-none-any.whl → 0.1.37__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
prompty/tracer.py CHANGED
@@ -28,6 +28,10 @@ def sanitize(key: str, value: Any) -> Any:
28
28
  class Tracer:
29
29
  _tracers: Dict[str, Callable[[str], Iterator[Callable[[str, Any], None]]]] = {}
30
30
 
31
+ SIGNATURE = "signature"
32
+ INPUTS = "inputs"
33
+ RESULT = "result"
34
+
31
35
  @classmethod
32
36
  def add(
33
37
  cls, name: str, tracer: Callable[[str], Iterator[Callable[[str, Any], None]]]
@@ -40,11 +44,17 @@ class Tracer:
40
44
 
41
45
  @classmethod
42
46
  @contextlib.contextmanager
43
- def start(cls, name: str) -> Iterator[Callable[[str, Any], None]]:
47
+ def start(cls, name: str, attributes: Dict[str, Any] = None) -> Iterator[Callable[[str, Any], None]]:
44
48
  with contextlib.ExitStack() as stack:
45
49
  traces = [
46
50
  stack.enter_context(tracer(name)) for tracer in cls._tracers.values()
47
51
  ]
52
+
53
+ if attributes:
54
+ for trace in traces:
55
+ for key, value in attributes.items():
56
+ trace(key, value)
57
+
48
58
  yield lambda key, value: [
49
59
  # normalize and sanitize any trace values
50
60
  trace(key, sanitize(key, to_dict(value)))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prompty
3
- Version: 0.1.36
3
+ Version: 0.1.37
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
  License: MIT
@@ -1,7 +1,7 @@
1
- prompty-0.1.36.dist-info/METADATA,sha256=hkRNP31HOI6NKNO8EW3juLAZOOc1EPhrV-XTE6CtjYA,9164
2
- prompty-0.1.36.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- prompty-0.1.36.dist-info/entry_points.txt,sha256=a3i7Kvf--3DOkkv9VQpstwaNKgsnXwDGaPL18lPpKeI,60
4
- prompty-0.1.36.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
1
+ prompty-0.1.37.dist-info/METADATA,sha256=q2jDy8mc-b5UPlsKAkel1SzCP8XPwspLr0mfcZA5OlQ,9164
2
+ prompty-0.1.37.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ prompty-0.1.37.dist-info/entry_points.txt,sha256=a3i7Kvf--3DOkkv9VQpstwaNKgsnXwDGaPL18lPpKeI,60
4
+ prompty-0.1.37.dist-info/licenses/LICENSE,sha256=KWSC4z9cfML_t0xThoQYjzTdcZQj86Y_mhXdatzU-KM,1052
5
5
  prompty/__init__.py,sha256=HCAvInBgNcIDO54rR4-RDIF4KUmGVQ2TRam_dS7xHEk,16561
6
6
  prompty/azure/__init__.py,sha256=WI8qeNWfxqggj21bznL-mxGUS-v67bUrunX0Lf2hsI8,295
7
7
  prompty/azure/executor.py,sha256=RJXMB0W7KcVvQ7l3xJaau7YM8PqOCQwuN4IwIe0sTLg,7930
@@ -19,6 +19,6 @@ prompty/renderers.py,sha256=80HNtCp3osgaLfhKxkG4j1kiRhJ727ITzT_yL5JLjEQ,1104
19
19
  prompty/serverless/__init__.py,sha256=xoXOTRXO8C631swNKaa-ek5_R3X-87bJpTm0z_Rsg6A,282
20
20
  prompty/serverless/executor.py,sha256=PUDJsYcJLQx9JSTh-R3HdJd0ehEC6w2Ch5OEqz52uVI,8395
21
21
  prompty/serverless/processor.py,sha256=ZSL9y8JC-G4qbtWOSbQAqEcFMWEaLskyOr5VjLthelU,3660
22
- prompty/tracer.py,sha256=WUR7PsvhBLQf7WcnKQPOeLeii9l4xPKB2owjvJ50d0E,10907
22
+ prompty/tracer.py,sha256=7z9IsJgOyE3tJkRIAhbo3QRSKrjFjH0-ZoN5fKIT_9w,11181
23
23
  prompty/utils.py,sha256=jm7HEzOGk3zz8d5aquXK3zWIQWuDpBpJTzlz5sswtdg,2836
24
- prompty-0.1.36.dist-info/RECORD,,
24
+ prompty-0.1.37.dist-info/RECORD,,