mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
- Update `openai` dependency from ^v0.27.10 to ^v1.7.2 - Update poetry.lock - Update code for changed endpoints and new output types of OpenAI library - Replace uses of `AssistantChatMessageDict` by `AssistantChatMessage` - Update `PromptStrategy`, `BaseAgent`, and all of their subclasses accordingly - Update `OpenAIProvider`, `OpenAICredentials`, azure.yaml.template, .env.template and test_config.py to work with new separate `AzureOpenAI` client - Remove `_OpenAIRetryHandler` and implement retry mechanism with `tenacity` - Rewrite pytest fixture `cached_openai_client` (renamed from `patched_api_requestor`) for OpenAI v1 library
19 lines
650 B
Python
19 lines
650 B
Python
import pytest
|
|
|
|
from autogpt.agents.agent import Agent
|
|
from autogpt.commands.web_selenium import BrowsingError, read_webpage
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.requires_openai_api_key
|
|
@pytest.mark.asyncio
|
|
async def test_browse_website_nonexistent_url(agent: Agent, cached_openai_client: None):
|
|
url = "https://auto-gpt-thinks-this-website-does-not-exist.com"
|
|
question = "How to execute a barrel roll"
|
|
|
|
with pytest.raises(BrowsingError, match="NAME_NOT_RESOLVED") as raised:
|
|
await read_webpage(url=url, question=question, agent=agent)
|
|
|
|
# Sanity check that the response is not too long
|
|
assert len(raised.exconly()) < 200
|