diff --git a/autogen/oai/client.py b/autogen/oai/client.py index 833cc7772196..481e55728c54 100644 --- a/autogen/oai/client.py +++ b/autogen/oai/client.py @@ -1069,7 +1069,7 @@ def extract_text_or_completion_object( def _throttle_api_calls(self, idx: int) -> None: """Rate limit api calls.""" - if self._rate_limiters[idx]: + if idx < len(self._rate_limiters) and self._rate_limiters[idx]: limiter = self._rate_limiters[idx] assert limiter is not None