agentle 0.9.21__py3-none-any.whl → 0.9.23__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/__init__.py +5 -5
- agentle/agents/apis/request_config.py +3 -20
- agentle/generations/providers/google/adapters/generate_generate_content_response_to_generation_adapter.py +9 -6
- agentle/generations/providers/google/google_generation_provider.py +35 -5
- {agentle-0.9.21.dist-info → agentle-0.9.23.dist-info}/METADATA +1 -1
- {agentle-0.9.21.dist-info → agentle-0.9.23.dist-info}/RECORD +8 -8
- {agentle-0.9.21.dist-info → agentle-0.9.23.dist-info}/WHEEL +0 -0
- {agentle-0.9.21.dist-info → agentle-0.9.23.dist-info}/licenses/LICENSE +0 -0
agentle/agents/apis/__init__.py
CHANGED
|
@@ -22,14 +22,14 @@ from agentle.agents.apis.object_serialization_style import ObjectSerializationSt
|
|
|
22
22
|
from agentle.agents.apis.parameter_location import ParameterLocation
|
|
23
23
|
from agentle.agents.apis.request_config import (
|
|
24
24
|
CacheStrategy,
|
|
25
|
-
CircuitBreaker,
|
|
26
|
-
CircuitBreakerError,
|
|
27
|
-
RateLimiter,
|
|
28
25
|
RequestConfig,
|
|
29
|
-
ResponseCache,
|
|
30
26
|
RetryStrategy,
|
|
31
|
-
RateLimitError,
|
|
32
27
|
)
|
|
28
|
+
from agentle.agents.apis.circuit_breaker import CircuitBreaker
|
|
29
|
+
from agentle.agents.apis.rate_limiter import RateLimiter
|
|
30
|
+
from agentle.agents.apis.response_cache import ResponseCache
|
|
31
|
+
from agentle.agents.apis.circuit_breaker_error import CircuitBreakerError
|
|
32
|
+
from agentle.agents.apis.rate_limit_error import RateLimitError
|
|
33
33
|
from agentle.agents.apis.request_hook import RequestHook
|
|
34
34
|
from agentle.agents.apis.object_schema import ObjectSchema
|
|
35
35
|
from agentle.agents.apis.array_schema import ArraySchema
|
|
@@ -12,33 +12,16 @@ from rsb.models.base_model import BaseModel
|
|
|
12
12
|
from rsb.models.field import Field
|
|
13
13
|
|
|
14
14
|
from agentle.agents.apis.cache_strategy import CacheStrategy
|
|
15
|
-
from agentle.agents.apis.circuit_breaker import CircuitBreaker
|
|
16
|
-
from agentle.agents.apis.circuit_breaker_error import CircuitBreakerError
|
|
17
|
-
from agentle.agents.apis.rate_limiter import RateLimiter
|
|
18
|
-
from agentle.agents.apis.rate_limit_error import RateLimitError
|
|
19
|
-
from agentle.agents.apis.response_cache import ResponseCache
|
|
20
15
|
from agentle.agents.apis.retry_strategy import RetryStrategy
|
|
21
16
|
|
|
22
|
-
# Re-export for backward compatibility
|
|
23
|
-
__all__ = [
|
|
24
|
-
"RequestConfig",
|
|
25
|
-
"RetryStrategy",
|
|
26
|
-
"CacheStrategy",
|
|
27
|
-
"CircuitBreaker",
|
|
28
|
-
"RateLimiter",
|
|
29
|
-
"ResponseCache",
|
|
30
|
-
"CircuitBreakerError",
|
|
31
|
-
"RateLimitError",
|
|
32
|
-
]
|
|
33
|
-
|
|
34
17
|
|
|
35
18
|
class RequestConfig(BaseModel):
|
|
36
19
|
"""
|
|
37
20
|
Enhanced configuration for HTTP requests.
|
|
38
|
-
|
|
21
|
+
|
|
39
22
|
This configuration can be set at both API-level and per-endpoint level.
|
|
40
23
|
Endpoint-level configs override API-level configs.
|
|
41
|
-
|
|
24
|
+
|
|
42
25
|
Example:
|
|
43
26
|
```python
|
|
44
27
|
# API-level config (applies to all endpoints)
|
|
@@ -47,7 +30,7 @@ class RequestConfig(BaseModel):
|
|
|
47
30
|
max_retries=3,
|
|
48
31
|
enable_caching=True
|
|
49
32
|
)
|
|
50
|
-
|
|
33
|
+
|
|
51
34
|
# Per-endpoint override
|
|
52
35
|
endpoint_config = RequestConfig(
|
|
53
36
|
timeout=60.0, # Override for this specific endpoint
|
|
@@ -253,16 +253,19 @@ class GenerateGenerateContentResponseToGenerationAdapter[T](
|
|
|
253
253
|
_all_parts.extend(_parts)
|
|
254
254
|
|
|
255
255
|
if _optional_model is not None:
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
# Parse streaming JSON and update final_parsed
|
|
257
|
+
accumulated_json_text = "".join([str(p.text) for p in _all_parts])
|
|
258
|
+
parsed_optional_model = parse_streaming_json(
|
|
259
|
+
accumulated_json_text,
|
|
258
260
|
model=_optional_model,
|
|
259
261
|
)
|
|
260
|
-
|
|
262
|
+
# Cast the optional model back to T for use in the generation
|
|
263
|
+
final_parsed = cast(T, parsed_optional_model)
|
|
261
264
|
else:
|
|
262
|
-
|
|
265
|
+
final_parsed = None
|
|
263
266
|
|
|
264
|
-
#
|
|
265
|
-
|
|
267
|
+
# Also check if chunk has parsed attribute from Google API
|
|
268
|
+
elif hasattr(chunk, "parsed") and chunk.parsed is not None:
|
|
266
269
|
final_parsed = cast(T | None, chunk.parsed)
|
|
267
270
|
|
|
268
271
|
# Extract usage (usually only in final chunk)
|
|
@@ -182,6 +182,37 @@ class GoogleGenerationProvider(GenerationProvider):
|
|
|
182
182
|
"""
|
|
183
183
|
return "google"
|
|
184
184
|
|
|
185
|
+
@overload
|
|
186
|
+
def stream_async[T](
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
model: str | ModelKind | None = None,
|
|
190
|
+
messages: Sequence[Message],
|
|
191
|
+
response_schema: type[T],
|
|
192
|
+
generation_config: GenerationConfig | GenerationConfigDict | None = None,
|
|
193
|
+
) -> AsyncGenerator[Generation[T], None]: ...
|
|
194
|
+
|
|
195
|
+
@overload
|
|
196
|
+
def stream_async(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
model: str | ModelKind | None = None,
|
|
200
|
+
messages: Sequence[Message],
|
|
201
|
+
response_schema: None = None,
|
|
202
|
+
generation_config: GenerationConfig | GenerationConfigDict | None = None,
|
|
203
|
+
tools: Sequence[Tool],
|
|
204
|
+
) -> AsyncGenerator[Generation[WithoutStructuredOutput], None]: ...
|
|
205
|
+
|
|
206
|
+
@overload
|
|
207
|
+
def stream_async(
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
model: str | ModelKind | None = None,
|
|
211
|
+
messages: Sequence[Message],
|
|
212
|
+
response_schema: None = None,
|
|
213
|
+
generation_config: GenerationConfig | GenerationConfigDict | None = None,
|
|
214
|
+
) -> AsyncGenerator[Generation[WithoutStructuredOutput], None]: ...
|
|
215
|
+
|
|
185
216
|
async def stream_async[T = WithoutStructuredOutput](
|
|
186
217
|
self,
|
|
187
218
|
*,
|
|
@@ -190,7 +221,7 @@ class GoogleGenerationProvider(GenerationProvider):
|
|
|
190
221
|
response_schema: type[T] | None = None,
|
|
191
222
|
generation_config: GenerationConfig | GenerationConfigDict | None = None,
|
|
192
223
|
tools: Sequence[Tool] | None = None,
|
|
193
|
-
) -> AsyncGenerator[Generation[
|
|
224
|
+
) -> AsyncGenerator[Generation[T], None]:
|
|
194
225
|
from google.genai import types
|
|
195
226
|
|
|
196
227
|
if self._normalize_generation_config(generation_config).n > 1:
|
|
@@ -260,6 +291,7 @@ class GoogleGenerationProvider(GenerationProvider):
|
|
|
260
291
|
tools=_tools,
|
|
261
292
|
max_output_tokens=_generation_config.max_output_tokens,
|
|
262
293
|
response_schema=response_schema if bool(response_schema) else None,
|
|
294
|
+
response_mime_type="application/json" if bool(response_schema) else None,
|
|
263
295
|
automatic_function_calling=types.AutomaticFunctionCallingConfig(
|
|
264
296
|
disable=disable_function_calling,
|
|
265
297
|
maximum_remote_calls=maximum_remote_calls,
|
|
@@ -295,10 +327,8 @@ class GoogleGenerationProvider(GenerationProvider):
|
|
|
295
327
|
raise
|
|
296
328
|
|
|
297
329
|
# Create the response
|
|
298
|
-
response = GenerateGenerateContentResponseToGenerationAdapter[
|
|
299
|
-
|
|
300
|
-
](
|
|
301
|
-
response_schema=None,
|
|
330
|
+
response = GenerateGenerateContentResponseToGenerationAdapter[T](
|
|
331
|
+
response_schema=response_schema,
|
|
302
332
|
model=used_model,
|
|
303
333
|
).adapt(generate_content_response_stream)
|
|
304
334
|
|
|
@@ -62,7 +62,7 @@ agentle/agents/a2a/tasks/task_status_update_event.py,sha256=vF9WFfQV5nNmQpSKPU91
|
|
|
62
62
|
agentle/agents/a2a/tasks/managment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
63
|
agentle/agents/a2a/tasks/managment/in_memory.py,sha256=_G5VuXqEPBMtE6XJg1d7WmqFr1qzd0-99FoqM_qMwAE,23841
|
|
64
64
|
agentle/agents/a2a/tasks/managment/task_manager.py,sha256=rBCuzu4DqIs55xDnwXY0w5Rs9ybv6OJpgpugAQLhtoU,3112
|
|
65
|
-
agentle/agents/apis/__init__.py,sha256=
|
|
65
|
+
agentle/agents/apis/__init__.py,sha256=PX7oAe0hRGvyLB295DrBF1VBsqgp5ZmGI4BCZvLUozo,2811
|
|
66
66
|
agentle/agents/apis/api.py,sha256=dl146HQwawq4ll8lEcWl7ZM46-FBBgmX_TXEopY-Le8,25709
|
|
67
67
|
agentle/agents/apis/api_key_authentication.py,sha256=MtMA4qkCjM3ou42a1fDgKI4u3NQkB_Zr-gEA5_oysZ0,1311
|
|
68
68
|
agentle/agents/apis/api_key_location.py,sha256=0pj_8rTkd0pkUJ2eP_Kur3AvT3JD8JpFIxQsWDzeg_c,188
|
|
@@ -93,7 +93,7 @@ agentle/agents/apis/parameter_location.py,sha256=k4vSvrljwsxorV_sf2Ch_OP4zvIGvhH
|
|
|
93
93
|
agentle/agents/apis/primitive_schema.py,sha256=fmDiMrXxtixORKIDvg8dx_h7w1AqPXpFOK8q_XxS_UQ,705
|
|
94
94
|
agentle/agents/apis/rate_limit_error.py,sha256=9ukRInSwf6PPEg5fPLm-eq4xfgYOExraOgGCRKzVbQk,116
|
|
95
95
|
agentle/agents/apis/rate_limiter.py,sha256=EZ-39YMDNeotygdvxP3B735cJexSk0-20zO0pxaGKiU,1842
|
|
96
|
-
agentle/agents/apis/request_config.py,sha256=
|
|
96
|
+
agentle/agents/apis/request_config.py,sha256=vHKtoW9uxh2lTsuuZ38B2_EMcrLmOtUvVhL8VkOxjZY,4850
|
|
97
97
|
agentle/agents/apis/request_hook.py,sha256=C9p6obF0myGkHoIScWuJTMp2RZlg3eEsbn80mDlE_sw,369
|
|
98
98
|
agentle/agents/apis/response_cache.py,sha256=l-Ec_YVf1phhaTKWNdAORBDWZS3pXK_BBUHGP-oQkqQ,1617
|
|
99
99
|
agentle/agents/apis/retry_strategy.py,sha256=_W8ZXXmA0kPFLJ0uwwV9ZycmSnj4dsicisFrbN8FtAU,219
|
|
@@ -316,10 +316,10 @@ agentle/generations/providers/failover/__init__.py,sha256=VBv_ZZlBFwwBRD2PZUEKi2
|
|
|
316
316
|
agentle/generations/providers/failover/failover_generation_provider.py,sha256=ixZk1zAP_Gu3HTf6nSo_ZDTl91U6x8vR0AyNHKB2b8k,24562
|
|
317
317
|
agentle/generations/providers/google/__init__.py,sha256=6H9LKSrN7Xyz5ZJ3PI4DIwOsAi8A84YoLSO9ms67cYI,105
|
|
318
318
|
agentle/generations/providers/google/function_calling_config.py,sha256=5ZL1FDCfeVVe9a04BpHC0_nBlLhmWg9nGoHVvCXNcI4,1226
|
|
319
|
-
agentle/generations/providers/google/google_generation_provider.py,sha256=
|
|
319
|
+
agentle/generations/providers/google/google_generation_provider.py,sha256=9Dl8D7npzpHL7qwO7Mgqiu6fzmWzPh-7jfvB6ZuUdYI,25590
|
|
320
320
|
agentle/generations/providers/google/adapters/__init__.py,sha256=sUwLR-CDzvWHn6hwqSsHYztws6DGx6ZiKp32vYeVMfk,1003
|
|
321
321
|
agentle/generations/providers/google/adapters/agentle_tool_to_google_tool_adapter.py,sha256=XQM_aL5zVfrRbNwtO_lDwXqvT8iX83trDNbEPSjZLmI,28482
|
|
322
|
-
agentle/generations/providers/google/adapters/generate_generate_content_response_to_generation_adapter.py,sha256=
|
|
322
|
+
agentle/generations/providers/google/adapters/generate_generate_content_response_to_generation_adapter.py,sha256=Z9v7c3NnnUFb-sqXQJHe_3ERb-o0eYzO_1JIGa2bRIM,17197
|
|
323
323
|
agentle/generations/providers/google/adapters/google_content_to_generated_assistant_message_adapter.py,sha256=4sOcT9VLr58YfEnkOm392odhNzzmbTspnnmrz5K6bHc,7829
|
|
324
324
|
agentle/generations/providers/google/adapters/google_part_to_part_adapter.py,sha256=infqHs_LVjpzIOipIVbRHQesXTKoOHVLiTUFaPhaBV8,6520
|
|
325
325
|
agentle/generations/providers/google/adapters/message_to_google_content_adapter.py,sha256=sJ6MEn_R-KkLTEsNhxmKhBDbzlKwOUYqinydag6hqi4,6071
|
|
@@ -1007,7 +1007,7 @@ agentle/web/actions/scroll.py,sha256=WqVVAORNDK3BL1oASZBPmXJYeSVkPgAOmWA8ibYO82I
|
|
|
1007
1007
|
agentle/web/actions/viewport.py,sha256=KCwm88Pri19Qc6GLHC69HsRxmdJz1gEEAODfggC_fHo,287
|
|
1008
1008
|
agentle/web/actions/wait.py,sha256=IKEywjf-KC4ni9Gkkv4wgc7bY-hk7HwD4F-OFWlyf2w,571
|
|
1009
1009
|
agentle/web/actions/write_text.py,sha256=9mxfHcpKs_L7BsDnJvOYHQwG8M0GWe61SRJAsKk3xQ8,748
|
|
1010
|
-
agentle-0.9.
|
|
1011
|
-
agentle-0.9.
|
|
1012
|
-
agentle-0.9.
|
|
1013
|
-
agentle-0.9.
|
|
1010
|
+
agentle-0.9.23.dist-info/METADATA,sha256=OQxUrAm6kxfo2dh5nIh5rkJ2ZYconQ_QzC5D7AgSFqQ,86849
|
|
1011
|
+
agentle-0.9.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
1012
|
+
agentle-0.9.23.dist-info/licenses/LICENSE,sha256=T90S9vqRS6qP-voULxAcvwEs558wRRo6dHuZrjgcOUI,1085
|
|
1013
|
+
agentle-0.9.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|