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] Set openai proxy for class ZhiPuAPTAPI #630

Merged
merged 1 commit into from
Dec 26, 2023
Merged

Conversation

springasa
Copy link
Contributor

@springasa springasa commented Dec 25, 2023

When using ZHIPUAI as the large model provider, it is not possible to access ZHIPUAI in an HTTP proxy environment, and the following error will be reported: openai.error.APIConnectionError: Error communicating with OpenAI

So we need set proxy for class ZhiPuAPTAPI.

Features

#629

Feature Docs

Influence

Result

@springasa ➜ /workspaces/MetaGPT (bug-fix-proxy) $ pytest -vs tests/metagpt/provider/test_zhipuai_api.py 
2023-12-25 15:48:50.340 | INFO     | metagpt.const:get_metagpt_package_root:32 - Package root set to /workspaces/MetaGPT
============================================================ test session starts =============================================================
platform linux -- Python 3.11.4, pytest-7.3.1, pluggy-1.0.0 -- /usr/local/py-utils/venvs/pytest/bin/python
cachedir: .pytest_cache
rootdir: /workspaces/MetaGPT
plugins: mock-3.11.1, anyio-3.7.1, asyncio-0.23.2
asyncio: mode=Mode.STRICT
collected 3 items                                                                                                                            

tests/metagpt/provider/test_zhipuai_api.py::test_zhipuai_completion PASSED
tests/metagpt/provider/test_zhipuai_api.py::test_zhipuai_acompletion PASSED
tests/metagpt/provider/test_zhipuai_api.py::test_zhipuai_proxy PASSED

Other

When using ZHIPUAI as the large model provider, it is not possible to access ZHIPUAI in an HTTP proxy environment, and the following error will be reported:
openai.error.APIConnectionError: Error communicating with OpenAI

So we need set proxy for class ZhiPuAPTAPI.
@geekan
Copy link
Owner

geekan commented Dec 26, 2023

It looks like there's room for optimization, but I'll get through first

@geekan geekan merged commit b70cd88 into geekan:main Dec 26, 2023
1 check failed
@springasa
Copy link
Contributor Author

Thank you for your feedback @geekan. I also agree that there is room for optimization, and these changes should be more appropriately placed in the parent class. However, making such a modification would have a significant impact. Therefore, the current changes are addressing the specific issues with the provider first.

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.

2 participants