Naver Search Tool은 Naver를 검색하고 결과를 가져오는 간단한 인터페이스를 제공합니다.

Integration details

ClassPackageSerializableJS supportVersion
NaverSearchResultslangchain-naver-communityPyPI - Version

Tool features

Search : Naver Search Tool은 Naver를 검색하고 결과를 가져오는 간단한 인터페이스를 제공합니다.

Setup

API Credentials 설정하기

Naver Search를 사용하려면 API credentials를 발급받아야 합니다. 다음 단계를 따르세요: Naver Developers portal에 로그인합니다. 새 애플리케이션을 생성하고 Search API를 활성화합니다. “Application List” 섹션에서 NAVER_CLIENT_IDNAVER_CLIENT_SECRET을 발급받습니다.

Environment Variables 설정하기

credentials를 발급받은 후, 스크립트에서 environment variables로 설정합니다:
pip install -qU  langchain-naver-community
import getpass
import os

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"
    )

Instantiation

from langchain_naver_community.utils import NaverSearchAPIWrapper

search = NaverSearchAPIWrapper()

Invocation

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'}]

Use within an agent

Naver Search tool은 더 복잡한 작업을 위해 LangChain agent에 통합될 수 있습니다. 아래에서는 현재 정보를 Naver에서 검색할 수 있는 agent를 설정하는 방법을 보여줍니다.
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4o-mini")

system_prompt = """
You are a helpful assistant that can search the web for information.
"""
from langchain_naver_community.tool import NaverNewsSearch
from langchain.agents import create_agent


tools = [NaverNewsSearch()]

agent_executor = create_agent(
    model,
    tools,
    prompt=system_prompt,
)
이제 쿼리와 함께 agent를 실행할 수 있습니다.
query = "What is the weather in Seoul?"
result = agent_executor.invoke({"messages": [("human", query)]})
result["messages"][-1].content

API reference


Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I