Skip to content

Commit 0d6e486

Browse files
committed
Add placeholder for handling UploadedFile in bedrock/gemini/huggingface
1 parent ffa6a57 commit 0d6e486

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

pydantic_ai_slim/pydantic_ai/models/bedrock.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
ThinkingPart,
3636
ToolCallPart,
3737
ToolReturnPart,
38+
UploadedFile,
3839
UserPromptPart,
3940
VideoUrl,
4041
)
@@ -577,6 +578,8 @@ async def _map_user_prompt(part: UserPromptPart, document_count: Iterator[int])
577578
content.append({'video': video})
578579
elif isinstance(item, AudioUrl): # pragma: no cover
579580
raise NotImplementedError('Audio is not supported yet.')
581+
elif isinstance(item, UploadedFile):
582+
raise NotImplementedError('Uploaded files are not supported yet.')
580583
else:
581584
assert_never(item)
582585
return [{'role': 'user', 'content': content}]

pydantic_ai_slim/pydantic_ai/models/gemini.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
ThinkingPart,
3434
ToolCallPart,
3535
ToolReturnPart,
36+
UploadedFile,
3637
UserPromptPart,
3738
VideoUrl,
3839
)
@@ -368,6 +369,8 @@ async def _map_user_prompt(self, part: UserPromptPart) -> list[_GeminiPartUnion]
368369
else: # pragma: lax no cover
369370
file_data = _GeminiFileDataPart(file_data={'file_uri': item.url, 'mime_type': item.media_type})
370371
content.append(file_data)
372+
elif isinstance(item, UploadedFile):
373+
raise NotImplementedError('Uploaded files are not supported for GeminiModel.')
371374
else:
372375
assert_never(item) # pragma: lax no cover
373376
return content

pydantic_ai_slim/pydantic_ai/models/huggingface.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
ThinkingPart,
3333
ToolCallPart,
3434
ToolReturnPart,
35+
UploadedFile,
3536
UserPromptPart,
3637
VideoUrl,
3738
)
@@ -424,6 +425,8 @@ async def _map_user_prompt(part: UserPromptPart) -> ChatCompletionInputMessage:
424425
raise NotImplementedError('DocumentUrl is not supported for Hugging Face')
425426
elif isinstance(item, VideoUrl):
426427
raise NotImplementedError('VideoUrl is not supported for Hugging Face')
428+
elif isinstance(item, UploadedFile):
429+
raise NotImplementedError('Uploaded files are not supported for Hugging Face')
427430
else:
428431
assert_never(item)
429432
return ChatCompletionInputMessage(role='user', content=content) # type: ignore

0 commit comments

Comments
 (0)