Skip to content

Commit 1efbcef

Browse files
MarkDaoustmarkmcd
andauthored
Return full file details at the end of create. (#314)
* Return full file details at the end of create. * black fmt --------- Co-authored-by: Mark McDonald <[email protected]>
1 parent 8d8e410 commit 1efbcef

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

google/generativeai/client.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,7 @@ def create_file(
7373
request = self._discovery_api.media().upload(body={"file": file}, media_body=media)
7474
result = request.execute()
7575

76-
allowed_keys = set(glm.File.__annotations__)
77-
78-
return glm.File(
79-
{
80-
re.sub("[A-Z]", lambda ch: f"_{ch.group(0).lower()}", key): value
81-
for key, value in result["file"].items()
82-
if key in allowed_keys
83-
}
84-
)
76+
return self.get_file({"name": result["name"]})
8577

8678

8779
class FileServiceAsyncClient(glm.FileServiceAsyncClient):

0 commit comments

Comments
 (0)