Skip to main content
Open In ColabOpen on GitHub

Naver Search

Using Naver Search in LangChain​

This guide explains how to integrate Naver Search into LangChain.

Setting Up API Credentials​

To use Naver Search, you need to obtain API credentials. Follow these steps:

Sign in to the Naver Developers portal. Create a new application and enable the Search API. Obtain your NAVER_CLIENT_ID and NAVER_CLIENT_SECRET from the "Application List" section.

Setting Up Environment Variables​

After obtaining the credentials, set them as environment variables in your script:

%pip install --upgrade --quiet  langchain-naver-community
import os
import getpass

if not os.environ.get("NAVER_CLIENT_ID"):
os.environ["NAVER_CLIENT_ID"] = getpass.getpass("Enter your Naver Client ID:\n")

if not os.environ.get("NAVER_CLIENT_SECRET"):
os.environ["NAVER_CLIENT_SECRET"] = getpass.getpass("Enter your Naver Client Secret:\n")


from langchain_naver_community.utils import NaverSearchAPIWrapper

search = NaverSearchAPIWrapper()

search.results("Seoul")[:3]
[{'title': 'Seoul shares rise for 4th day on tech gains; won at 2-week low',
'link': 'https://n.news.naver.com/mnews/article/001/0015277717?sid=104',
'description': 'stocks-summary Seoul shares rise for 4th day on tech gains; won at 2-week low SEOUL, March 20 (Yonhap) -- Seoul shares extended their winning streak to a fourth day Thursday on the back of gains... ',
'pubDate': 'Thu, 20 Mar 2025 16:09:00 +0900'},
{'title': "Seoul Mayor Oh's residence, office raided over alleged ties to shadowy po...",
'link': 'https://n.news.naver.com/mnews/article/640/0000067073?sid=100',
'description': 'Prosecutors on Thursday raided Seoul Mayor Oh Se-hoon’s official residence and the City Hall... The raid came as part of the Seoul Central District Prosecutors’ Office’s probe into... ',
'pubDate': 'Thu, 20 Mar 2025 19:12:00 +0900'},
{'title': 'Education can heal divides: Seoul schools chief',
'link': 'https://n.news.naver.com/mnews/article/044/0000267866?sid=104',
'description': 'Jung Keun-sik, Superintendent of Seoul Metropolitan Office of Education speaks during an interview with The Korea Herald at his office on March 13. (Lim Se-jun/ The Korea Herald) Seoul education... ',
'pubDate': 'Thu, 20 Mar 2025 14:35:00 +0900'}]

Tool Usage​

from langchain_naver_community.tool import NaverSearchResults
from langchain_naver_community.utils import NaverSearchAPIWrapper

search = NaverSearchAPIWrapper()

tool = NaverSearchResults(api_wrapper=search)

tool.invoke("what is the weather in seoul?")[3:5]

[{'title': "2025 is here. Here's what to watch out for",
'link': 'https://n.news.naver.com/mnews/article/044/0000265707?sid=104',
'description': 'The trend was predicted in "Trend Korea 2025," written by Kim Ran-do, a professor of consumer science at Seoul National University, and his team. The annually published book also predicts that... ',
'pubDate': 'Sat, 18 Jan 2025 16:01:00 +0900'},
{'title': '[INTERVIEW] Korea to overhaul weather prediction model against climate ch...',
'link': 'https://www.koreatimes.co.kr/www/nation/2023/06/371_353628.html?utm_source=na',
'description': 'western Seoul to protest its confusing weather predictions, false forecasting is hardly accepted compared to what Yoo saw in Oklahoma. The administrator hopes the Korean public would understand... ',
'pubDate': 'Sun, 25 Jun 2023 17:22:00 +0900'}]

Was this page helpful?