Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Optional rate limiting #4066

Merged
merged 2 commits into from
Nov 5, 2024
Merged

Conversation

kampernet
Copy link

Why are these changes needed?

Simple UserProxyAgent and AssistantAgent flow does not work due to rate limiters not being initialized via the OpenAIWrapper.

Rate Limters seem to be optional, but the code syntax fails when there is not one set.

Adding "api_rate_limit" parameter to the LLM Config does not work when directly using the client:

assistant = autogen.AssistantAgent(
    name="assistant",
    system_message="You are a helpful assistant ",
    llm_config={"model": "gpt-4", "api_key": os.getenv("OPENAI_API_KEY"), "cache_seed": None,
                "api_rate_limit": 60.0},
)

The error is:
Traceback (most recent call last):
File "/venv/lib/python3.11/site-packages/autogen/oai/client.py", line 775, in create
self._throttle_api_calls(i)
File "/venv/lib/python3.11/site-packages/autogen/oai/client.py", line 1073, in _throttle_api_calls
if self._rate_limiters[idx]:
~~~~~~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range

@kampernet
Copy link
Author

@microsoft-github-policy-service agree

@kampernet kampernet changed the base branch from main to 0.2 November 5, 2024 18:28
@ekzhu ekzhu merged commit 23c14bc into microsoft:0.2 Nov 5, 2024
35 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants