agentle 0.9.30__py3-none-any.whl → 0.9.31__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.
- agentle/agents/apis/object_schema.py +6 -6
- agentle/agents/apis/params/boolean_param.py +4 -4
- agentle/agents/apis/params/number_param.py +4 -4
- agentle/agents/conversations/callback_conversation_store.py +1 -7
- agentle/agents/conversations/conversation_store.py +9 -2
- agentle/agents/conversations/firebase_conversation_store.py +6 -1
- agentle/agents/whatsapp/whatsapp_bot.py +1 -1
- agentle/utils/parse_streaming_json.py +7 -5
- {agentle-0.9.30.dist-info → agentle-0.9.31.dist-info}/METADATA +1 -1
- {agentle-0.9.30.dist-info → agentle-0.9.31.dist-info}/RECORD +12 -12
- {agentle-0.9.30.dist-info → agentle-0.9.31.dist-info}/WHEEL +0 -0
- {agentle-0.9.30.dist-info → agentle-0.9.31.dist-info}/licenses/LICENSE +0 -0
|
@@ -46,20 +46,20 @@ class ObjectSchema(BaseModel):
|
|
|
46
46
|
) -> ObjectSchema | ArraySchema | PrimitiveSchema:
|
|
47
47
|
"""
|
|
48
48
|
Recursively convert a JSON Schema definition to Agentle schema types.
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
This method handles deeply nested objects, arrays, and primitives,
|
|
51
51
|
making it easy to convert complex JSON Schema definitions.
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
Args:
|
|
54
54
|
schema: JSON Schema definition (dict with 'type', 'properties', etc.)
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
Returns:
|
|
57
57
|
Appropriate schema type (ObjectSchema, ArraySchema, or PrimitiveSchema)
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
Example:
|
|
60
60
|
```python
|
|
61
61
|
from agentle.agents.apis.object_schema import ObjectSchema
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
json_schema = {
|
|
64
64
|
"type": "object",
|
|
65
65
|
"properties": {
|
|
@@ -79,7 +79,7 @@ class ObjectSchema(BaseModel):
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
schema = ObjectSchema.from_json_schema(json_schema)
|
|
84
84
|
```
|
|
85
85
|
"""
|
|
@@ -11,21 +11,21 @@ def boolean_param(
|
|
|
11
11
|
location: ParameterLocation = ParameterLocation.QUERY,
|
|
12
12
|
) -> EndpointParameter:
|
|
13
13
|
"""Create a boolean parameter.
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
Args:
|
|
16
16
|
name: Parameter name
|
|
17
17
|
description: Parameter description
|
|
18
18
|
required: Whether the parameter is required
|
|
19
19
|
default: Default value for the parameter
|
|
20
20
|
location: Where the parameter should be placed in the request
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
Returns:
|
|
23
23
|
EndpointParameter configured for boolean values
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
Example:
|
|
26
26
|
```python
|
|
27
27
|
from agentle.agents.apis.params.boolean_param import boolean_param
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
boolean_param(
|
|
30
30
|
name="enabled",
|
|
31
31
|
description="Enable feature",
|
|
@@ -14,7 +14,7 @@ def number_param(
|
|
|
14
14
|
format: str | None = None,
|
|
15
15
|
) -> EndpointParameter:
|
|
16
16
|
"""Create a number (float/decimal) parameter.
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
Args:
|
|
19
19
|
name: Parameter name
|
|
20
20
|
description: Parameter description
|
|
@@ -24,14 +24,14 @@ def number_param(
|
|
|
24
24
|
default: Default value for the parameter
|
|
25
25
|
location: Where the parameter should be placed in the request
|
|
26
26
|
format: Format hint (e.g., 'float', 'double', 'decimal')
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
Returns:
|
|
29
29
|
EndpointParameter configured for number values
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
Example:
|
|
32
32
|
```python
|
|
33
33
|
from agentle.agents.apis.params.number_param import number_param
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
number_param(
|
|
36
36
|
name="price",
|
|
37
37
|
description="Product price",
|
|
@@ -81,13 +81,7 @@ class CallbackConversationStore(ConversationStore):
|
|
|
81
81
|
self,
|
|
82
82
|
get_callback: Callable[
|
|
83
83
|
[str],
|
|
84
|
-
Awaitable[
|
|
85
|
-
Sequence[
|
|
86
|
-
DeveloperMessage
|
|
87
|
-
| UserMessage
|
|
88
|
-
| AssistantMessage
|
|
89
|
-
]
|
|
90
|
-
],
|
|
84
|
+
Awaitable[Sequence[DeveloperMessage | UserMessage | AssistantMessage]],
|
|
91
85
|
],
|
|
92
86
|
add_callback: Callable[
|
|
93
87
|
[
|
|
@@ -4,7 +4,9 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
from agentle.generations.models.messages.assistant_message import AssistantMessage
|
|
6
6
|
from agentle.generations.models.messages.developer_message import DeveloperMessage
|
|
7
|
-
from agentle.generations.models.messages.generated_assistant_message import
|
|
7
|
+
from agentle.generations.models.messages.generated_assistant_message import (
|
|
8
|
+
GeneratedAssistantMessage,
|
|
9
|
+
)
|
|
8
10
|
from agentle.generations.models.messages.user_message import UserMessage
|
|
9
11
|
|
|
10
12
|
|
|
@@ -45,7 +47,12 @@ class ConversationStore(abc.ABC):
|
|
|
45
47
|
|
|
46
48
|
@abc.abstractmethod
|
|
47
49
|
async def add_message_async[T = Any](
|
|
48
|
-
self,
|
|
50
|
+
self,
|
|
51
|
+
chat_id: str,
|
|
52
|
+
message: DeveloperMessage
|
|
53
|
+
| UserMessage
|
|
54
|
+
| AssistantMessage
|
|
55
|
+
| GeneratedAssistantMessage[T],
|
|
49
56
|
) -> None: ...
|
|
50
57
|
|
|
51
58
|
@abc.abstractmethod
|
|
@@ -32,7 +32,12 @@ class FirebaseConversationStore(ConversationStore):
|
|
|
32
32
|
|
|
33
33
|
@override
|
|
34
34
|
async def add_message_async[T = Any](
|
|
35
|
-
self,
|
|
35
|
+
self,
|
|
36
|
+
chat_id: str,
|
|
37
|
+
message: DeveloperMessage
|
|
38
|
+
| UserMessage
|
|
39
|
+
| AssistantMessage
|
|
40
|
+
| GeneratedAssistantMessage[T],
|
|
36
41
|
) -> None:
|
|
37
42
|
from google.cloud import firestore
|
|
38
43
|
|
|
@@ -2285,7 +2285,7 @@ class WhatsAppBot[T_Schema: WhatsAppResponseBase = WhatsAppResponseBase](BaseMod
|
|
|
2285
2285
|
... )
|
|
2286
2286
|
"""
|
|
2287
2287
|
response_text = ""
|
|
2288
|
-
|
|
2288
|
+
|
|
2289
2289
|
if isinstance(response, GeneratedAssistantMessage):
|
|
2290
2290
|
# Check if we have structured output (parsed)
|
|
2291
2291
|
if response.parsed:
|
|
@@ -101,12 +101,12 @@ def parse_streaming_json[T: BaseModel](potential_json: str | None, model: type[T
|
|
|
101
101
|
in_string = False
|
|
102
102
|
escape_next = False
|
|
103
103
|
last_quote_pos = -1
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
for i, char in enumerate(json_str):
|
|
106
106
|
if escape_next:
|
|
107
107
|
escape_next = False
|
|
108
108
|
continue
|
|
109
|
-
if char ==
|
|
109
|
+
if char == "\\":
|
|
110
110
|
escape_next = True
|
|
111
111
|
continue
|
|
112
112
|
if char == '"':
|
|
@@ -141,7 +141,7 @@ def parse_streaming_json[T: BaseModel](potential_json: str | None, model: type[T
|
|
|
141
141
|
# Pattern: "key": "value..." - capture everything until the next unescaped quote or EOF
|
|
142
142
|
string_pattern = r'["\']([\w]+)["\']:\s*["\']([^"\']*?)(?:["\']|$)'
|
|
143
143
|
string_matches = re.findall(string_pattern, json_str, re.DOTALL)
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
# Also try to capture very long strings that span multiple lines
|
|
146
146
|
# This catches incomplete strings during streaming
|
|
147
147
|
long_string_pattern = r'["\']([\w_]+)["\']:\s*["\'](.+?)(?:["\'],?\s*["}]|$)'
|
|
@@ -149,12 +149,14 @@ def parse_streaming_json[T: BaseModel](potential_json: str | None, model: type[T
|
|
|
149
149
|
|
|
150
150
|
for key, value in string_matches:
|
|
151
151
|
data[key] = value
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
# Prefer long_matches for fields that might be truncated in string_matches
|
|
154
154
|
for key, value in long_matches:
|
|
155
155
|
# Only override if the long match has more content
|
|
156
156
|
existing = data.get(key, "")
|
|
157
|
-
if key not in data or (
|
|
157
|
+
if key not in data or (
|
|
158
|
+
isinstance(existing, str) and len(value) > len(existing)
|
|
159
|
+
):
|
|
158
160
|
data[key] = value
|
|
159
161
|
|
|
160
162
|
# Extract string key-value pairs with unquoted keys
|
|
@@ -87,7 +87,7 @@ agentle/agents/apis/http_method.py,sha256=QhiUJvftOaVJXIMDzhdOnvrPxrwrjikOePm664
|
|
|
87
87
|
agentle/agents/apis/no_authentication.py,sha256=s8q5sE6VyUhBmtPAuH18fkc0Dhu-fA_a2jjfvPOF1aE,654
|
|
88
88
|
agentle/agents/apis/oauth2_authentication.py,sha256=ql-wUfD5sWPy5WqbrMO7k7d7l12z14qf8OGnHgQCOD8,3959
|
|
89
89
|
agentle/agents/apis/oauth2_grant_type.py,sha256=rx2LvkqMZ32-zzJrKyJZofdii9u4E2cIHeQXoX0MuRM,271
|
|
90
|
-
agentle/agents/apis/object_schema.py,sha256=
|
|
90
|
+
agentle/agents/apis/object_schema.py,sha256=1p01VbRGTFX7v6eFSJToAtfOJuOEkjJKp9Injulk-hs,4531
|
|
91
91
|
agentle/agents/apis/object_serialization_style.py,sha256=sHt23Spp6TH0KLDH7WuGL7hvLnz-B_NnTkJQboewt4o,482
|
|
92
92
|
agentle/agents/apis/parameter_location.py,sha256=k4vSvrljwsxorV_sf2Ch_OP4zvIGvhHDXonxrg-32eg,283
|
|
93
93
|
agentle/agents/apis/primitive_schema.py,sha256=fmDiMrXxtixORKIDvg8dx_h7w1AqPXpFOK8q_XxS_UQ,705
|
|
@@ -99,9 +99,9 @@ agentle/agents/apis/response_cache.py,sha256=l-Ec_YVf1phhaTKWNdAORBDWZS3pXK_BBUH
|
|
|
99
99
|
agentle/agents/apis/retry_strategy.py,sha256=_W8ZXXmA0kPFLJ0uwwV9ZycmSnj4dsicisFrbN8FtAU,219
|
|
100
100
|
agentle/agents/apis/params/__init__.py,sha256=7aXlrfQTXpGT2GxuyugnFsF74l4AszSkFgxb0keyPRE,383
|
|
101
101
|
agentle/agents/apis/params/array_param.py,sha256=dHcKGNdsYnze0AdMKGuxidM81Hwydb264JFdLhJEVeA,1036
|
|
102
|
-
agentle/agents/apis/params/boolean_param.py,sha256=
|
|
102
|
+
agentle/agents/apis/params/boolean_param.py,sha256=POQb-qM6w85RiEstgPt-xSfJlK0gb0P1s5CI0ulJ3pk,1273
|
|
103
103
|
agentle/agents/apis/params/integer_param.py,sha256=DEEOoOmLVzTFAQOJnLAr2MTcgLFYbavBDrf4CJ_-P_E,788
|
|
104
|
-
agentle/agents/apis/params/number_param.py,sha256=
|
|
104
|
+
agentle/agents/apis/params/number_param.py,sha256=KYYS7cH1hYQQnpy9LFd3pEkVbw9cIgkdhuDgu5WXYdo,1655
|
|
105
105
|
agentle/agents/apis/params/object_param.py,sha256=_zR7t4aQoK7NSRH0yS3-iZqMeKzHCc2vtKqDRfdDp1M,1044
|
|
106
106
|
agentle/agents/apis/params/string_param.py,sha256=0cLqPLsljw_7AHYXESib9mtJRRLOreH3-4ObJR8CFUk,710
|
|
107
107
|
agentle/agents/asgi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -109,9 +109,9 @@ agentle/agents/asgi/blacksheep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
|
109
109
|
agentle/agents/asgi/blacksheep/agent_to_blacksheep_application_adapter.py,sha256=EI-0TBWlL8wewFuOtNoTeY7T1BTbj3GVQjUmkuPrv74,12080
|
|
110
110
|
agentle/agents/asgi/blacksheep/agent_to_blacksheep_route_handler_adapter.py,sha256=kAX3_W6Gj8JI9yjXm6bnWvzq4YH8E4RD_jPy-Z_RtoA,25124
|
|
111
111
|
agentle/agents/conversations/__init__.py,sha256=8XNgbcRauHDWbaiwKzoQkMbA4v3IOB1rtKGPfjReHPY,573
|
|
112
|
-
agentle/agents/conversations/callback_conversation_store.py,sha256=
|
|
113
|
-
agentle/agents/conversations/conversation_store.py,sha256=
|
|
114
|
-
agentle/agents/conversations/firebase_conversation_store.py,sha256=
|
|
112
|
+
agentle/agents/conversations/callback_conversation_store.py,sha256=zamvaWLu-C0MiVhUetiN5OjS7aktlYIlmhq_UrxrXaE,8283
|
|
113
|
+
agentle/agents/conversations/conversation_store.py,sha256=w4NG_1rzFXQrwBLsLu_AB0IRutapul8wDwcUktwsqiM,2039
|
|
114
|
+
agentle/agents/conversations/firebase_conversation_store.py,sha256=dsQnRf9OQsb_8IhmbNFUaMGgwQZ9RFNosphDcTz5LI8,4364
|
|
115
115
|
agentle/agents/conversations/json_file_conversation_store.py,sha256=NvUGXzxKU_ozoNM4rodqKtrDR1r7WeUvTUDm3eYXkkM,9544
|
|
116
116
|
agentle/agents/conversations/local_conversation_store.py,sha256=cPFQcCieZ9d0K3fc0MvfzcUucnL8KPMK9K8IhOEn28Y,2432
|
|
117
117
|
agentle/agents/conversations/mysql_conversation_store.py,sha256=XKlURkjRQpHcotRyhQHneqzzZXehyR2IJtIqh4kyEgM,11501
|
|
@@ -137,7 +137,7 @@ agentle/agents/ui/__init__.py,sha256=IjHRV0k2DNwvFrEHebmsXiBvmITE8nQUnsR07h9tVkU
|
|
|
137
137
|
agentle/agents/ui/streamlit.py,sha256=9afICL0cxtG1o2pWh6vH39-NdKiVfADKiXo405F2aB0,42829
|
|
138
138
|
agentle/agents/whatsapp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
139
139
|
agentle/agents/whatsapp/human_delay_calculator.py,sha256=BGCDeoNTPsMn4d_QYmG0BWGCG8SiUJC6Fk295ulAsAk,18268
|
|
140
|
-
agentle/agents/whatsapp/whatsapp_bot.py,sha256=
|
|
140
|
+
agentle/agents/whatsapp/whatsapp_bot.py,sha256=8AkP6VncI04s0KEpJ_ykkZsHUoUpF1PYxXyLRWA8EW4,161954
|
|
141
141
|
agentle/agents/whatsapp/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
142
|
agentle/agents/whatsapp/models/audio_message.py,sha256=kUqG1HdNW6DCYD-CqscJ6WHlAyv9ufmTSKMdjio9XWk,2705
|
|
143
143
|
agentle/agents/whatsapp/models/context_info.py,sha256=sk80KuNE36S6VRnLh7n6UXmzZCXIB4E4lNxnRyVizg8,563
|
|
@@ -971,7 +971,7 @@ agentle/utils/file_validation.py,sha256=Rv6y_ylBrDoslscCk2lkfr3LRMarY0J8qWhKJjZj
|
|
|
971
971
|
agentle/utils/fix_base64_padding.py,sha256=IWBlMP3FYcWs17Y72tVxG7w1lzEKnstaDC9HRKmI56Y,1109
|
|
972
972
|
agentle/utils/make_fields_optional.py,sha256=pu2u-jJ1pNyoQRyGQzxwXnYbWSzZ2G4ssebJvjYsH8A,7800
|
|
973
973
|
agentle/utils/needs.py,sha256=JRTVvgVP0w0bpq1_w2Jly2lxXiONdHOYAYMvReFQcJM,5110
|
|
974
|
-
agentle/utils/parse_streaming_json.py,sha256=
|
|
974
|
+
agentle/utils/parse_streaming_json.py,sha256=u4Rmfug_Uh3V8Enwqu7ccn0Xa9oYDtNN6Cxysh907Ng,31896
|
|
975
975
|
agentle/utils/raise_error.py,sha256=EYX6WJS5gzJxgTyFYYOFHc-klEyU0tP20N5k_-ze5nQ,138
|
|
976
976
|
agentle/utils/safe_b64decode.py,sha256=2nkdwUzkeVgtf3kb_zypjJY2KHe7dlLwa4ynjY2Yy1E,1272
|
|
977
977
|
agentle/utils/safe_dill_dumps.py,sha256=yXQ51P05uSiWnREKJ6UWVjCKnRQTjgPVzoE1nylBbJI,237
|
|
@@ -1018,7 +1018,7 @@ agentle/web/actions/scroll.py,sha256=WqVVAORNDK3BL1oASZBPmXJYeSVkPgAOmWA8ibYO82I
|
|
|
1018
1018
|
agentle/web/actions/viewport.py,sha256=KCwm88Pri19Qc6GLHC69HsRxmdJz1gEEAODfggC_fHo,287
|
|
1019
1019
|
agentle/web/actions/wait.py,sha256=IKEywjf-KC4ni9Gkkv4wgc7bY-hk7HwD4F-OFWlyf2w,571
|
|
1020
1020
|
agentle/web/actions/write_text.py,sha256=9mxfHcpKs_L7BsDnJvOYHQwG8M0GWe61SRJAsKk3xQ8,748
|
|
1021
|
-
agentle-0.9.
|
|
1022
|
-
agentle-0.9.
|
|
1023
|
-
agentle-0.9.
|
|
1024
|
-
agentle-0.9.
|
|
1021
|
+
agentle-0.9.31.dist-info/METADATA,sha256=Bxiq2rY_WhZ3w98ZCshLt6UM_CfWuIUuJtK53Zq9aPw,86849
|
|
1022
|
+
agentle-0.9.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
1023
|
+
agentle-0.9.31.dist-info/licenses/LICENSE,sha256=T90S9vqRS6qP-voULxAcvwEs558wRRo6dHuZrjgcOUI,1085
|
|
1024
|
+
agentle-0.9.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|