mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
added support for Google Images search (#7751)
- Description: Added Google Image Search support for SerpAPIWrapper - Issue: NA - Dependencies: None - Tag maintainer: @hinthornw - Twitter handle: @sausheong --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
1ff5b67025
commit
b6a7f40ad3
@ -159,7 +159,12 @@ class SerpAPIWrapper(BaseModel):
|
|||||||
toret = res["organic_results"][0]["snippet"]
|
toret = res["organic_results"][0]["snippet"]
|
||||||
elif "link" in res["organic_results"][0].keys():
|
elif "link" in res["organic_results"][0].keys():
|
||||||
toret = res["organic_results"][0]["link"]
|
toret = res["organic_results"][0]["link"]
|
||||||
|
elif (
|
||||||
|
"images_results" in res.keys()
|
||||||
|
and "thumbnail" in res["images_results"][0].keys()
|
||||||
|
):
|
||||||
|
thumbnails = [item["thumbnail"] for item in res["images_results"][:10]]
|
||||||
|
toret = thumbnails
|
||||||
else:
|
else:
|
||||||
toret = "No good search result found"
|
toret = "No good search result found"
|
||||||
return toret
|
return toret
|
||||||
|
Loading…
Reference in New Issue
Block a user