File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
pydantic_ai_slim/pydantic_ai/models Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 63
63
GenerateContentConfigDict ,
64
64
GenerateContentResponse ,
65
65
GenerationConfigDict ,
66
+ GroundingMetadata ,
66
67
GoogleSearchDict ,
67
68
HttpOptionsDict ,
68
69
MediaResolution ,
@@ -437,6 +438,7 @@ def _process_response(self, response: GenerateContentResponse) -> ModelResponse:
437
438
response .model_version or self ._model_name ,
438
439
self ._provider .name ,
439
440
usage ,
441
+ grounding_metadata = candidate .grounding_metadata ,
440
442
vendor_id = vendor_id ,
441
443
vendor_details = vendor_details ,
442
444
finish_reason = finish_reason ,
@@ -683,6 +685,7 @@ def _process_response_from_parts(
683
685
provider_name : str ,
684
686
usage : usage .RequestUsage ,
685
687
vendor_id : str | None ,
688
+ grounding_metadata : GroundingMetadata | None ,
686
689
vendor_details : dict [str , Any ] | None = None ,
687
690
finish_reason : FinishReason | None = None ,
688
691
) -> ModelResponse :
@@ -724,6 +727,13 @@ def _process_response_from_parts(
724
727
)
725
728
726
729
items .append (item )
730
+ if grounding_metadata :
731
+ items .append (BuiltinToolReturnPart (
732
+ provider_name = provider_name ,
733
+ tool_name = 'grounding_metadata' ,
734
+ content = grounding_metadata ,
735
+ tool_call_id = 'not_provided' ,
736
+ ))
727
737
return ModelResponse (
728
738
parts = items ,
729
739
model_name = model_name ,
You can’t perform that action at this time.
0 commit comments