Wait for the vector store file to finish processing. Note: this will return even if the file failed to process, you need to check file.last_error and file.status to handle these cases
(
self,
video_id: str,
*,
poll_interval_ms: int | Omit = omit,
)
| 748 | ) |
| 749 | |
| 750 | async def poll( |
| 751 | self, |
| 752 | video_id: str, |
| 753 | *, |
| 754 | poll_interval_ms: int | Omit = omit, |
| 755 | ) -> Video: |
| 756 | class="st">"""Wait for the vector store file to finish processing. |
| 757 | |
| 758 | Note: this will return even if the file failed to process, you need to check |
| 759 | file.last_error and file.status to handle these cases |
| 760 | class="st">""" |
| 761 | headers: dict[str, str] = {class="st">"X-Stainless-Poll-Helper": class="st">"true"} |
| 762 | if is_given(poll_interval_ms): |
| 763 | headers[class="st">"X-Stainless-Custom-Poll-Interval"] = str(poll_interval_ms) |
| 764 | |
| 765 | while True: |
| 766 | response = await self.with_raw_response.retrieve( |
| 767 | video_id, |
| 768 | extra_headers=headers, |
| 769 | ) |
| 770 | |
| 771 | video = response.parse() |
| 772 | if video.status == class="st">"in_progress" or video.status == class="st">"queued": |
| 773 | if not is_given(poll_interval_ms): |
| 774 | from_header = response.headers.get(class="st">"openai-poll-after-ms") |
| 775 | if from_header is not None: |
| 776 | poll_interval_ms = int(from_header) |
| 777 | else: |
| 778 | poll_interval_ms = 1000 |
| 779 | |
| 780 | await self._sleep(poll_interval_ms / 1000) |
| 781 | elif video.status == class="st">"completed" or video.status == class="st">"failed": |
| 782 | return video |
| 783 | else: |
| 784 | if TYPE_CHECKING: class="cm"># type: ignore[unreachable] |
| 785 | assert_never(video.status) |
| 786 | else: |
| 787 | return video |
| 788 | |
| 789 | async def retrieve( |
| 790 | self, |