mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Fix test_make_agent
This commit is contained in:
@@ -34,7 +34,7 @@ class ApiManager(metaclass=Singleton):
|
||||
temperature: float = None,
|
||||
max_tokens: int | None = None,
|
||||
deployment_id=None,
|
||||
) -> str:
|
||||
):
|
||||
"""
|
||||
Create a chat completion and update the cost.
|
||||
Args:
|
||||
|
||||
@@ -242,7 +242,7 @@ def create_chat_completion(
|
||||
max_tokens=max_tokens,
|
||||
)
|
||||
|
||||
resp = response.choices[0].message["content"]
|
||||
resp = response.choices[0].message.content
|
||||
for plugin in cfg.plugins:
|
||||
if not plugin.can_handle_on_response():
|
||||
continue
|
||||
|
||||
@@ -11,10 +11,11 @@ def test_make_agent(agent: Agent, mocker: MockerFixture) -> None:
|
||||
mock = mocker.patch("openai.ChatCompletion.create")
|
||||
|
||||
response = MagicMock()
|
||||
# del response.error
|
||||
response.choices[0].messages[0].content = "Test message"
|
||||
response.choices[0].message.content = "Test message"
|
||||
response.usage.prompt_tokens = 1
|
||||
response.usage.completion_tokens = 1
|
||||
del response.error
|
||||
|
||||
mock.return_value = response
|
||||
start_agent("Test Agent", "chat", "Hello, how are you?", agent, "gpt-3.5-turbo")
|
||||
agents = list_agents(agent)
|
||||
|
||||
Reference in New Issue
Block a user