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

update get rpm from api.openai.com #483

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

MaxZhongSheep
Copy link

@MaxZhongSheep MaxZhongSheep commented Nov 9, 2023

I access the "https://platform.openai.com/account/limits" webpage to automatically obtain RPM by setting the session key. The logic is as follows: if the connection to OpenAI fails, the RPM is set to the default value. If the connection to OpenAI is successful but the sess-key is invalid (including when set to the api-key), an appropriate error is displayed. If the sess-key is set to "" or not set, the RPM is set to the default value. If the sess-key is valid and the connection is successful, the RPM is obtained from the webpage.

@martcpp
Copy link
Contributor

martcpp commented Nov 9, 2023

Provide description and pictures of you updated . For easily understanding

config/config.yaml Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
metagpt/provider/openai_api.py Outdated Show resolved Hide resolved
@stellaHSR
Copy link
Collaborator

提供下对应的测试用例脚本或者examples

@geekan
Copy link
Owner

geekan commented Dec 21, 2023

Please resolve all conflicts and Review comments


@pytest.mark.asyncio
async def test_update_rpm():
llm = OpenAILLM(config)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It accepts LLMConfig, not Config

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.

None yet

6 participants