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

Feat:Wrap Openllm, Fireworks and other services into the OpenAILLM class. #946

Merged
merged 22 commits into from
Mar 1, 2024

Conversation

YangQianli92
Copy link
Contributor

@YangQianli92 YangQianli92 commented Feb 29, 2024

Features

  • Wrapping OpenLLM, FireWorksAI,Moonshot services into OpenAILLM
  • OpenLLM, FrreWorksAI, Moonshot will be registered in OpenAILLM class
  • Removed OpenLLM and FireWorks class
  • Provide a uniform method of calculating usage in OpenAILLM class
  • Added support for MistralAI services

Feature Docs
Specific configuration documentation can be found in this PR
geekan/MetaGPT-docs#100

Unit Test
pytest tests/metagpt/provider/test_openai.py

============================= test session starts =============================
collecting ... collected 8 items

test_openai.py::test_text_to_speech 
test_openai.py::test_speech_to_text 
test_openai.py::TestOpenAI::test_make_client_kwargs_without_proxy 
test_openai.py::TestOpenAI::test_make_client_kwargs_with_proxy 
test_openai.py::TestOpenAI::test_get_choice_function_arguments_for_aask_code 
test_openai.py::TestOpenAI::test_aask_code_json_decode_error 
test_openai.py::test_gen_image 
test_openai.py::test_openai_acompletion 

======================= 8 passed, 8 warnings in 38.95s ========================
PASSED                               [ 12%]PASSED                               [ 25%]PASSED [ 37%]PASSED    [ 50%]PASSED [ 62%]2024-02-29 11:27:48.097 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:111 - 
test get function call arguments 0: {'language': 'python', 'code': "print('hello world')"}
2024-02-29 11:27:48.098 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:115 - code is : print('hello world')
2024-02-29 11:27:48.098 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:111 - 
test get function call arguments 1: {'language': 'markdown', 'code': 'Completed a python code for hello world!'}
2024-02-29 11:27:48.098 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:115 - code is : Completed a python code for hello world!
2024-02-29 11:27:48.099 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:111 - 
test get function call arguments 2: {'language': 'python', 'code': "print('hello world')"}
2024-02-29 11:27:48.099 | INFO     | tests.metagpt.provider.test_openai:test_get_choice_function_arguments_for_aask_code:115 - code is : print('hello world')
PASSED      [ 75%]
2024-02-29 11:27:48.112 | INFO     | tests.metagpt.provider.test_openai:test_aask_code_json_decode_error:128 - code is : print('hello world')
PASSED                                    [ 87%]PASSED                           [100%]I'm AI assistant
I'm AI assistant

metagpt/context.py Show resolved Hide resolved
metagpt/provider/openai_api.py Show resolved Hide resolved
@better629
Copy link
Collaborator

LGTM

@YangQianli92 YangQianli92 requested a review from geekan March 1, 2024 02:12
Copy link
Owner

@geekan geekan left a comment

Choose a reason for hiding this comment

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

LGTM

@geekan geekan merged commit dacc8aa into geekan:main Mar 1, 2024
0 of 2 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.

None yet

3 participants