Skip to content

Commit 044a036

Browse files
committed
Update input to upload_link endpoint
1 parent a0b4e23 commit 044a036

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

weco/client.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,12 @@ def build(self, task_description: str, multimodal: bool = False) -> Tuple[str, i
247247
"""
248248
return self._build(task_description=task_description, multimodal=multimodal, is_async=False)
249249

250-
def _upload_image(self, fn_name: str, version_number: int, upload_id: str, image_info: Dict[str, Any]) -> str:
250+
def _upload_image(self, image_info: Dict[str, Any]) -> str:
251251
"""
252252
Uploads an image to an S3 bucket and returns the URL of the uploaded image.
253253
254254
Parameters
255255
----------
256-
fn_name : str
257-
The name of the function for which the image is being uploaded.
258-
version_number : int
259-
The version number of the function for which the image is being uploaded.
260-
upload_id: str
261-
A unique identifier for the image upload.
262256
image_info : Dict[str, Any]
263257
A dictionary containing the image metadata.
264258
@@ -291,7 +285,7 @@ def _upload_image(self, fn_name: str, version_number: int, upload_id: str, image
291285

292286
# Request a presigned URL from the server
293287
endpoint = "upload_link"
294-
request_data = {"fn_name": fn_name, "version_number": version_number, "upload_id": upload_id, "file_type": file_type}
288+
request_data = {"file_type": file_type}
295289
# This needs to be a synchronous request since we need the presigned URL to upload the image
296290
response = self._make_request(endpoint=endpoint, data=request_data, is_async=False)
297291

@@ -431,10 +425,9 @@ def _query(
431425

432426
# Create links for all images that are not public URLs and upload images
433427
image_urls = []
434-
upload_id = generate_random_base16_code()
435428
for i, info in enumerate(image_info):
436429
if info["source"] == "url" or info["source"] == "base64" or info["source"] == "local":
437-
url = self._upload_image(fn_name=fn_name, version_number=version_number, upload_id=upload_id, image_info=info)
430+
url = self._upload_image(image_info=info)
438431
else:
439432
raise ValueError(f"Image at index {i} must be a public URL or a path to a local image file.")
440433
image_urls.append(url)

0 commit comments

Comments
 (0)