File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ def _infer_mime_type_from_uri(uri: str) -> Optional[str]:
281281
282282def _looks_like_openai_file_id (file_uri : str ) -> bool :
283283 """Returns True when file_uri resembles an OpenAI/Azure file id."""
284- return file_uri .startswith ("file-" )
284+ return file_uri .startswith (( "file-" , "assistant-" ) )
285285
286286
287287def _is_http_url (uri : str ) -> bool :
Original file line number Diff line number Diff line change @@ -2943,6 +2943,20 @@ async def test_get_content_file_uri_file_id_required_preserves_file_id(
29432943 assert content == [{"type" : "file" , "file" : {"file_id" : "file-abc123" }}]
29442944
29452945
2946+ @pytest .mark .asyncio
2947+ async def test_get_content_file_uri_azure_preserves_assistant_file_id ():
2948+ parts = [
2949+ types .Part (
2950+ file_data = types .FileData (
2951+ file_uri = "assistant-abc123" ,
2952+ mime_type = "application/pdf" ,
2953+ )
2954+ )
2955+ ]
2956+ content = await _get_content (parts , provider = "azure" , model = "azure/gpt-4.1" )
2957+ assert content == [{"type" : "file" , "file" : {"file_id" : "assistant-abc123" }}]
2958+
2959+
29462960@pytest .mark .asyncio
29472961@pytest .mark .parametrize (
29482962 "provider,model" ,
You can’t perform that action at this time.
0 commit comments