mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-21 15:44:19 +01:00
🔎 feat: search fix web search
This commit is contained in:
@@ -38,7 +38,7 @@ def google_search(search_term, search_type, top_n):
|
|||||||
'q': search_term,
|
'q': search_term,
|
||||||
'key': google_api_key,
|
'key': google_api_key,
|
||||||
'cx': google_cse_id,
|
'cx': google_cse_id,
|
||||||
'searchType': search_type,
|
**({'searchType': search_type} if search_type == 'image' else {}),
|
||||||
'num': top_n
|
'num': top_n
|
||||||
}
|
}
|
||||||
response = requests.get(url, params=params)
|
response = requests.get(url, params=params)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from dev_gpt.options.generate.static_files.microservice.apis import search_web,
|
|||||||
def test_web_search():
|
def test_web_search():
|
||||||
results = search_web("jina", 10)
|
results = search_web("jina", 10)
|
||||||
assert len(results) == 10
|
assert len(results) == 10
|
||||||
assert "jina" in results[0]
|
assert "jina" in results[0].lower()
|
||||||
assert not results[0].startswith("http")
|
assert not results[0].startswith("http")
|
||||||
|
|
||||||
def test_image_search():
|
def test_image_search():
|
||||||
|
|||||||
Reference in New Issue
Block a user