promptbuilder 0.4.42__py3-none-any.whl → 0.4.43__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.
- promptbuilder/llm_client/base_client.py +12 -3
- {promptbuilder-0.4.42.dist-info → promptbuilder-0.4.43.dist-info}/METADATA +1 -1
- {promptbuilder-0.4.42.dist-info → promptbuilder-0.4.43.dist-info}/RECORD +6 -6
- {promptbuilder-0.4.42.dist-info → promptbuilder-0.4.43.dist-info}/WHEEL +1 -1
- {promptbuilder-0.4.42.dist-info → promptbuilder-0.4.43.dist-info}/licenses/LICENSE +0 -0
- {promptbuilder-0.4.42.dist-info → promptbuilder-0.4.43.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import json
|
|
3
|
+
import hjson
|
|
3
4
|
import os
|
|
4
5
|
import hashlib
|
|
5
6
|
import logging
|
|
@@ -58,7 +59,15 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
|
|
|
58
59
|
return self.provider + ":" + self.model
|
|
59
60
|
|
|
60
61
|
@staticmethod
|
|
61
|
-
|
|
62
|
+
@overload
|
|
63
|
+
def as_json(text: str, raise_on_error: Literal[True]) -> Json: ...
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
@overload
|
|
67
|
+
def as_json(text: str, raise_on_error: Literal[False]) -> Json | None: ...
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def as_json(text: str, raise_on_error: bool = True) -> Json | None:
|
|
62
71
|
# Remove markdown code block formatting if present
|
|
63
72
|
text = text.strip()
|
|
64
73
|
|
|
@@ -70,8 +79,8 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
|
|
|
70
79
|
text = match.group(1).strip()
|
|
71
80
|
|
|
72
81
|
try:
|
|
73
|
-
return
|
|
74
|
-
except
|
|
82
|
+
return hjson.loads(text, strict=False)
|
|
83
|
+
except hjson.HjsonDecodeError as e:
|
|
75
84
|
if raise_on_error:
|
|
76
85
|
raise ValueError(f"Failed to parse LLM response as JSON:\n{text}")
|
|
77
86
|
return None
|
|
@@ -9,7 +9,7 @@ promptbuilder/agent/utils.py,sha256=vTkphKw04v_QDIJtoB2JKK0RGY6iI1t_0LbmuStunzI,
|
|
|
9
9
|
promptbuilder/llm_client/__init__.py,sha256=wJ33cnRtZX_YPsbcGxEu3SEZMOhPX7-fHI59MEPUe7I,517
|
|
10
10
|
promptbuilder/llm_client/aisuite_client.py,sha256=8inY3UoH8o9yEOvRYP6a_8pjGQK0W_f9eV8MmHzpKTU,15641
|
|
11
11
|
promptbuilder/llm_client/anthropic_client.py,sha256=YR1Pc4Fj0WpG7qcQnPLkQMzDsvA7SMvWomFR1oCzMsk,28328
|
|
12
|
-
promptbuilder/llm_client/base_client.py,sha256=
|
|
12
|
+
promptbuilder/llm_client/base_client.py,sha256=5vY2g8VBt5yuv06LIQllq_pGxba5lDV9ia9ICeZjN98,40765
|
|
13
13
|
promptbuilder/llm_client/bedrock_client.py,sha256=IQt7Sv_Wt6mg5-bhuyr-Nwjx5Nxk2S8rKEVkfwvWqE0,28183
|
|
14
14
|
promptbuilder/llm_client/config.py,sha256=exQEm35wp7lK5SfXNpN5H9VZEb2LVa4pyZ-cxGt1U-U,1124
|
|
15
15
|
promptbuilder/llm_client/exceptions.py,sha256=t-X7r_a8B1jNu8eEavde1jXu5dz97yV3IG4YHOtgh0Y,4836
|
|
@@ -20,8 +20,8 @@ promptbuilder/llm_client/main.py,sha256=2Q7J5FwivX2YwvptzoSEtCfvfcI9p5HC55D3mMb2
|
|
|
20
20
|
promptbuilder/llm_client/openai_client.py,sha256=ulZZsHhyRbqG1WRdVJcNHk6r6MFBC5XLGJQ_2648AkA,28206
|
|
21
21
|
promptbuilder/llm_client/types.py,sha256=fnkSMFjK9ViaRQsD6LILpLz8R2_E1TI9efjy8VNO0RQ,8139
|
|
22
22
|
promptbuilder/llm_client/utils.py,sha256=EtJFghpn27eVUXR-rZj8inEk903tk3thM0r19QxWnBM,13496
|
|
23
|
-
promptbuilder-0.4.
|
|
24
|
-
promptbuilder-0.4.
|
|
25
|
-
promptbuilder-0.4.
|
|
26
|
-
promptbuilder-0.4.
|
|
27
|
-
promptbuilder-0.4.
|
|
23
|
+
promptbuilder-0.4.43.dist-info/licenses/LICENSE,sha256=fqXmInzgsvEOIaKSBgcrwKyYCGYF0MKErJ0YivtODcc,1096
|
|
24
|
+
promptbuilder-0.4.43.dist-info/METADATA,sha256=ohMlZKlGzmFIIrzSTfPlRQaf903GxYp0I-BeRe5ouBU,3824
|
|
25
|
+
promptbuilder-0.4.43.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
26
|
+
promptbuilder-0.4.43.dist-info/top_level.txt,sha256=UBVcYn4UgrPy3O3fmmnPEU_kieuplBMgheetIMei4EI,14
|
|
27
|
+
promptbuilder-0.4.43.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|