22 lines
768 B
Python
22 lines
768 B
Python
import pytest
|
|
import json
|
|
from src.pipeline.core.utils import logger, baidu_search_async
|
|
from src.pipeline.core.skills import load_skills
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_search_web():
|
|
query = "孙悟空哪里出生"
|
|
logger.debug(f"query: {query} ...")
|
|
results = await baidu_search_async(query, max_results=5)
|
|
logger.debug(json.dumps(results, indent=4, ensure_ascii=False))
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_skills():
|
|
skills = await load_skills("./src/skills")
|
|
logger.debug("Loaded skills")
|
|
for s in skills:
|
|
logger.debug(f"\n- {s.name}: {s.description} : {s.parameters}")
|
|
res = await s.run(**{"query": "今天星期几", "max_results": 10})
|
|
logger.debug(f"\n{json.dumps(res, indent=4, ensure_ascii=False)}")
|