This commit is contained in:
geekan 2024-01-15 17:53:24 +08:00
parent c715b9c102
commit 92d31fb750
4 changed files with 25 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@ from pathlib import Path
import pytest
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.learn.text_to_embedding import text_to_embedding
from metagpt.utils.common import aread
@ -19,6 +19,7 @@ from metagpt.utils.common import aread
@pytest.mark.asyncio
async def test_text_to_embedding(mocker):
# mock
config = Config.default()
mock_post = mocker.patch("aiohttp.ClientSession.post")
mock_response = mocker.AsyncMock()
mock_response.status = 200

View file

@ -57,7 +57,8 @@ class TestOpenAI:
def test_make_client_kwargs_without_proxy(self):
instance = OpenAILLM(mock_llm_config)
kwargs = instance._make_client_kwargs()
assert kwargs == {"api_key": "mock_api_key", "base_url": "mock_base_url"}
assert kwargs["api_key"] == "mock_api_key"
assert kwargs["base_url"] == "mock_base_url"
assert "http_client" not in kwargs
def test_make_client_kwargs_with_proxy(self):

View file

@ -10,7 +10,7 @@ from pathlib import Path
import pytest
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.tools.openai_text_to_embedding import oas3_openai_text_to_embedding
from metagpt.utils.common import aread
@ -18,6 +18,7 @@ from metagpt.utils.common import aread
@pytest.mark.asyncio
async def test_embedding(mocker):
# mock
config = Config.default()
mock_post = mocker.patch("aiohttp.ClientSession.post")
mock_response = mocker.AsyncMock()
mock_response.status = 200