You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
1 year ago
|
import pytest
|
||
|
from langchain.base_language import BaseLanguageModel
|
||
|
from langchain_experimental.autonomous_agents.hugginggpt.repsonse_generator import (
|
||
|
load_response_generator,
|
||
|
)
|
||
|
from langchain_experimental.autonomous_agents.hugginggpt.task_executor import (
|
||
|
TaskExecutor,
|
||
|
)
|
||
|
from langchain_experimental.autonomous_agents.hugginggpt.task_planner import (
|
||
|
load_chat_planner,
|
||
|
)
|
||
|
from transformers import load_tool
|
||
|
from swarms.agents import OmniModalAgent # Replace `your_module_name` with the appropriate module name
|
||
|
|
||
|
# Mock objects or set up fixtures for dependent classes or external methods
|
||
|
@pytest.fixture
|
||
|
def mock_llm():
|
||
|
# For this mock, we are assuming the BaseLanguageModel has a method named "process"
|
||
|
class MockLLM(BaseLanguageModel):
|
||
|
def process(self, input):
|
||
|
return "mock response"
|
||
|
|
||
|
return MockLLM()
|
||
|
|
||
|
@pytest.fixture
|
||
|
def omni_agent(mock_llm):
|
||
|
return OmniModalAgent(mock_llm)
|
||
|
|
||
|
def test_omnimodalagent_initialization(omni_agent):
|
||
|
assert omni_agent.llm is not None, "LLM initialization failed"
|
||
|
assert len(omni_agent.tools) > 0, "Tools initialization failed"
|
||
|
|
||
|
def test_omnimodalagent_run(omni_agent):
|
||
|
input_string = "Hello, how are you?"
|
||
|
response = omni_agent.run(input_string)
|
||
|
assert response is not None, "Response generation failed"
|
||
|
assert isinstance(response, str), "Response should be a string"
|
||
|
|
||
|
def test_task_executor_initialization(omni_agent):
|
||
|
assert omni_agent.task_executor is not None, "TaskExecutor initialization failed"
|