agentle 0.9.22__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/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.22.dist-info → agentle-0.9.23.dist-info}/METADATA +1 -1
- {agentle-0.9.22.dist-info → agentle-0.9.23.dist-info}/RECORD +6 -6
- {agentle-0.9.22.dist-info → agentle-0.9.23.dist-info}/WHEEL +0 -0
- {agentle-0.9.22.dist-info → agentle-0.9.23.dist-info}/licenses/LICENSE +0 -0
|
@@ -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
|
|
|
@@ -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
|