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 6363 GenerateContentConfigDict ,
6464 GenerateContentResponse ,
6565 GenerationConfigDict ,
66+ GroundingMetadata ,
6667 GoogleSearchDict ,
6768 HttpOptionsDict ,
6869 MediaResolution ,
@@ -437,6 +438,7 @@ def _process_response(self, response: GenerateContentResponse) -> ModelResponse:
437438 response .model_version or self ._model_name ,
438439 self ._provider .name ,
439440 usage ,
441+ grounding_metadata = candidate .grounding_metadata ,
440442 vendor_id = vendor_id ,
441443 vendor_details = vendor_details ,
442444 finish_reason = finish_reason ,
@@ -683,6 +685,7 @@ def _process_response_from_parts(
683685 provider_name : str ,
684686 usage : usage .RequestUsage ,
685687 vendor_id : str | None ,
688+ grounding_metadata : GroundingMetadata | None ,
686689 vendor_details : dict [str , Any ] | None = None ,
687690 finish_reason : FinishReason | None = None ,
688691) -> ModelResponse :
@@ -724,6 +727,13 @@ def _process_response_from_parts(
724727 )
725728
726729 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+ ))
727737 return ModelResponse (
728738 parts = items ,
729739 model_name = model_name ,
You can’t perform that action at this time.
0 commit comments