Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/mixedbread/resources/vector_stores/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def poll(
self,
file_id: str,
*,
vector_store_id: str,
vector_store_identifier: str,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
poll_timeout_ms: float | NotGiven = NOT_GIVEN,
**kwargs: Any,
Expand All @@ -349,7 +349,7 @@ def poll(
Poll for a file's status until it reaches a terminal state.
Args:
file_id: The ID of the file to poll
vector_store_id: The ID of the vector store
vector_store_identifier: The ID of the vector store
poll_interval_ms: The interval between polls in milliseconds
poll_timeout_ms: The maximum time to poll for in milliseconds
Returns:
Expand All @@ -358,7 +358,7 @@ def poll(
polling_interval_ms = poll_interval_ms or 500
polling_timeout_ms = poll_timeout_ms or None
return polling.poll(
fn=functools.partial(self.retrieve, file_id, vector_store_id=vector_store_id, **kwargs),
fn=functools.partial(self.retrieve, file_id, vector_store_identifier=vector_store_identifier, **kwargs),
condition=lambda res: res.status == "completed" or res.status == "failed" or res.status == "cancelled",
interval_seconds=polling_interval_ms / 1000,
timeout_seconds=polling_timeout_ms / 1000 if polling_timeout_ms else None,
Expand All @@ -368,7 +368,7 @@ def create_and_poll(
self,
file_id: str,
*,
vector_store_id: str,
vector_store_identifier: str,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
Expand All @@ -379,19 +379,19 @@ def create_and_poll(
Attach a file to the given vector store and wait for it to be processed.
Args:
file_id: The ID of the file to poll
vector_store_id: The ID of the vector store
vector_store_identifier: The ID of the vector store
metadata: The metadata to attach to the file
poll_interval_ms: The interval between polls in milliseconds
poll_timeout_ms: The maximum time to poll for in milliseconds
Returns:
The file object once it reaches a terminal state
"""
self.create(
vector_store_id=vector_store_id, file_id=file_id, metadata=metadata, experimental=experimental, **kwargs
vector_store_identifier=vector_store_identifier, file_id=file_id, metadata=metadata, experimental=experimental, **kwargs
)
return self.poll(
file_id,
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
poll_interval_ms=poll_interval_ms,
poll_timeout_ms=poll_timeout_ms,
**kwargs,
Expand All @@ -400,7 +400,7 @@ def create_and_poll(
def upload(
self,
*,
vector_store_id: str,
vector_store_identifier: str,
file: FileTypes,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
Expand All @@ -412,7 +412,7 @@ def upload(
"""
file_obj = self._client.files.create(file=file, **kwargs)
return self.create(
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
file_id=file_obj.id,
metadata=metadata,
experimental=experimental,
Expand All @@ -422,7 +422,7 @@ def upload(
def upload_and_poll(
self,
*,
vector_store_id: str,
vector_store_identifier: str,
file: FileTypes,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
Expand All @@ -433,7 +433,7 @@ def upload_and_poll(
"""Add a file to a vector store and poll until processing is complete."""
file_obj = self._client.files.create(file=file, **kwargs)
return self.create_and_poll(
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
file_id=file_obj.id,
metadata=metadata,
experimental=experimental,
Expand Down Expand Up @@ -755,7 +755,7 @@ async def poll(
self,
file_id: str,
*,
vector_store_id: str,
vector_store_identifier: str,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
poll_timeout_ms: float | NotGiven = NOT_GIVEN,
**kwargs: Any,
Expand All @@ -764,7 +764,7 @@ async def poll(
Poll for a file's status until it reaches a terminal state.
Args:
file_id: The ID of the file to poll
vector_store_id: The ID of the vector store
vector_store_identifier: The ID of the vector store
poll_interval_ms: The interval between polls in milliseconds
poll_timeout_ms: The maximum time to poll for in milliseconds
Returns:
Expand All @@ -773,7 +773,7 @@ async def poll(
polling_interval_ms = poll_interval_ms or 500
polling_timeout_ms = poll_timeout_ms or None
return await polling.poll_async(
fn=functools.partial(self.retrieve, file_id, vector_store_id=vector_store_id, **kwargs),
fn=functools.partial(self.retrieve, file_id, vector_store_identifier=vector_store_identifier, **kwargs),
condition=lambda res: res.status == "completed" or res.status == "failed" or res.status == "cancelled",
interval_seconds=polling_interval_ms / 1000,
timeout_seconds=polling_timeout_ms / 1000 if polling_timeout_ms else None,
Expand All @@ -783,7 +783,7 @@ async def create_and_poll(
self,
file_id: str,
*,
vector_store_id: str,
vector_store_identifier: str,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
poll_interval_ms: int | NotGiven = NOT_GIVEN,
Expand All @@ -794,23 +794,23 @@ async def create_and_poll(
Attach a file to the given vector store and wait for it to be processed.
Args:
file_id: The ID of the file to poll
vector_store_id: The ID of the vector store
vector_store_identifier: The ID of the vector store
metadata: The metadata to attach to the file
poll_interval_ms: The interval between polls in milliseconds
poll_timeout_ms: The maximum time to poll for in milliseconds
Returns:
The file object once it reaches a terminal state
"""
await self.create(
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
file_id=file_id,
metadata=metadata,
experimental=experimental,
**kwargs,
)
return await self.poll(
file_id,
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
poll_interval_ms=poll_interval_ms,
poll_timeout_ms=poll_timeout_ms,
**kwargs,
Expand All @@ -819,7 +819,7 @@ async def create_and_poll(
async def upload(
self,
*,
vector_store_id: str,
vector_store_identifier: str,
file: FileTypes,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
Expand All @@ -831,7 +831,7 @@ async def upload(
"""
file_obj = await self._client.files.create(file=file, **kwargs)
return await self.create(
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
file_id=file_obj.id,
metadata=metadata,
experimental=experimental,
Expand All @@ -841,7 +841,7 @@ async def upload(
async def upload_and_poll(
self,
*,
vector_store_id: str,
vector_store_identifier: str,
file: FileTypes,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
experimental: file_create_params.Experimental | NotGiven = NOT_GIVEN,
Expand All @@ -852,7 +852,7 @@ async def upload_and_poll(
"""Add a file to a vector store and poll until processing is complete."""
file_obj = await self._client.files.create(file=file, **kwargs)
return await self.create_and_poll(
vector_store_id=vector_store_id,
vector_store_identifier=vector_store_identifier,
file_id=file_obj.id,
metadata=metadata,
experimental=experimental,
Expand Down