Skip to content

Commit 76acdc4

Browse files
committed
Formatted to fix the linter
1 parent e252f8c commit 76acdc4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pydantic_ai_slim/pydantic_ai/models/google.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
'Please install `google-genai` to use the Google model, '
9292
'you can use the `google` optional group — `pip install "pydantic-ai-slim[google]"`'
9393
) from _import_error
94-
94+
9595
LatestGoogleModelNames = Literal[
9696
'gemini-2.0-flash',
9797
'gemini-2.0-flash-lite',
@@ -575,7 +575,7 @@ async def _map_user_prompt(self, part: UserPromptPart) -> list[PartDict]:
575575
media_type=item.media_type,
576576
identifier=item.identifier,
577577
)
578-
)
578+
)
579579
else:
580580
inline_data_dict: BlobDict = {'data': item.data, 'mime_type': item.media_type}
581581
part_dict: PartDict = {'inline_data': inline_data_dict}
@@ -607,7 +607,7 @@ async def _map_user_prompt(self, part: UserPromptPart) -> list[PartDict]:
607607
if item.vendor_metadata: # pragma: no branch
608608
part_dict['video_metadata'] = cast(VideoMetadataDict, item.vendor_metadata)
609609
content.append(part_dict)
610-
610+
611611
elif isinstance(item, FileUrl):
612612
if item.force_download or (
613613
# google-gla does not support passing file urls directly, except for youtube videos
@@ -626,7 +626,7 @@ async def _map_user_prompt(self, part: UserPromptPart) -> list[PartDict]:
626626
content.append({'file_data': file_data_dict}) # pragma: lax no cover
627627
else:
628628
assert_never(item)
629-
629+
630630
return content
631631

632632
@staticmethod
@@ -641,15 +641,15 @@ def _is_text_like_media_type(media_type: str) -> bool:
641641
)
642642

643643
@staticmethod
644-
def _inline_text_file_part(text: str, *, media_type: str, identifier: str) -> ChatCompletionContentPartTextParam:
644+
def _inline_text_file_part(text: str, *, media_type: str, identifier: str):
645645
text = '\n'.join(
646646
[
647647
f'-----BEGIN FILE id="{identifier}" type="{media_type}"-----',
648648
text,
649649
f'-----END FILE id="{identifier}"-----',
650650
]
651651
)
652-
return {"text": text}
652+
return {'text': text}
653653

654654
def _map_response_schema(self, o: OutputObjectDefinition) -> dict[str, Any]:
655655
response_schema = o.json_schema.copy()

tests/models/test_google.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,17 +778,19 @@ async def test_google_model_text_document_url_input(allow_model_requests: None,
778778
'The main content of the TXT file is an explanation of the placeholder name "John Doe" (and related variations) and its usage in legal contexts, popular culture, and other situations where the identity of a person is unknown or needs to be withheld. The document also includes the purpose of the file and other file type information.\n'
779779
)
780780

781+
781782
async def test_google_model_json_document_url_input(allow_model_requests: None, google_provider: GoogleProvider):
782783
m = GoogleModel('gemini-2.5-pro', provider=google_provider)
783784
agent = Agent(m, system_prompt='You are a helpful chatbot.')
784785

785786
json_document_url = DocumentUrl(url='https://kamalscraping-collab.github.io/sample-data/sample_transcript.json')
786-
787+
787788
result = await agent.run(['What is the main content of this document?', json_document_url])
788789
assert result.output == snapshot(
789-
"Based on the JSON data provided, the document contains the log of a conversation between a user and an AI assistant.\n"
790+
'Based on the JSON data provided, the document contains the log of a conversation between a user and an AI assistant.\n'
790791
)
791792

793+
792794
async def test_google_model_text_as_binary_content_input(allow_model_requests: None, google_provider: GoogleProvider):
793795
m = GoogleModel('gemini-2.0-flash', provider=google_provider)
794796
agent = Agent(m, system_prompt='You are a helpful chatbot.')

0 commit comments

Comments
 (0)