Decodo 통합

Decodo 통합

LangChain JavaScript로 Decodo 도구와 통합하는 방법을 알아봅니다.

@decodo/langchain-ts 패키지는 개발자가 LangChain 애플리케이션과 함께 Decodo의 Web Scraper API를 사용할 수 있게 합니다.

Web Scraper API 기능:

  • 쉬운 웹 데이터 접근. 웹사이트와 온라인 소스에서 정보를 단순하게 검색.
  • 지리적 유연성. 지역 제한을 무시하고 콘텐츠에 접근.
  • 안정적인 스크래핑. 탐지와 차단을 피하는 고급 기법.

출처: 문서

본문

기능(Features)

@decodo/langchain-ts 플러그인 기능:

  • 웹 스크래핑: 모든 URL을 스크래핑하고 Markdown 콘텐츠 검색
  • Google 검색: Google을 검색하고 구조화된 결과 검색
  • Amazon 검색: Amazon을 검색하고 구조화된 제품 데이터 검색
  • 위치에 민감한 콘텐츠를 위한 지리 위치 선택
  • 실제 브라우저가 필요한 대상을 위한 JavaScript 렌더링
  • LLM에 토큰 효율적으로 연결하기 위한 Markdown 출력

설치

npm install @decodo/langchain-ts

빠른 시작(Quickstart)

이 프로젝트의 도구를 사용하려면 Decodo Advanced Web Scraping API 구독이 필요합니다. 대시보드에서 무료 체험판을 이용할 수 있습니다.

예시(Examples)

각 도구에 대한 에이전틱 예시 모음입니다.

유니버설(Universal)

import dotenv from "dotenv";
import { ChatOpenAI } from "@langchain/openai";
import { createAgent } from "@langchain/agents";
import { DecodoUniversalTool } from "@decodo/langchain-ts";

dotenv.config();

const main = async () => {
  const username = process.env.SCRAPER_API_USERNAME!;
  const password = process.env.SCRAPER_API_PASSWORD!;

  const decodoUniversalTool = new DecodoUniversalTool({ username, password });

  const model = new ChatOpenAI({
    model: "gpt-5.4-mini",
  });

  const agent = createAgent({
    llm: model,
    tools: [decodoUniversalTool],
  });

  const result = await agent.invoke({
    messages: [
      {
        role: "user",
        content:
          "scrape the wikipedia NBA 2025 season page and tell me who won in 2025?",
      },
    ],
  });

  console.log(result.messages[result.messages.length - 1].content);
};

if (require.main === module) {
  main();
}

더 많은 예시는 GitHub의 @decodo/langchain-ts를 참조하세요.

Google 검색

const main = async () => {
  const username = process.env.SCRAPER_API_USERNAME!;
  const password = process.env.SCRAPER_API_PASSWORD!;

  const decodoGoogleSearchTool = new DecodoGoogleSearchTool({
    username,
    password,
  });

  const model = new ChatOpenAI({
    model: "gpt-5-mini",
  });

  const agent = createAgent({
    llm: model,
    tools: [decodoGoogleSearchTool],
  });

  const prompt =
    "which mobile service provider appears first on Google in Germany?";

  const result = await agent.invoke({
    messages: [
      {
        role: "user",
        content: prompt,
      },
    ],
  });

  console.log(result.messages[result.messages.length - 1].content);
};

Amazon 검색

const main = async () => {
  const username = process.env.SCRAPER_API_USERNAME!;
  const password = process.env.SCRAPER_API_PASSWORD!;

  const decodoAmazonSearchTool = new DecodoAmazonSearchTool({
    username,
    password,
  });

  const model = new ChatOpenAI({
    model: "gpt-5-mini",
  });

  const agent = createAgent({
    llm: model,
    tools: [decodoAmazonSearchTool],
  });

  const prompt =
    "What is the cheapest laptop with a GeForce RTX 5080 on Amazon in France?";

  const result = await agent.invoke({
    messages: [
      {
        role: "user",
        content: prompt,
      },
    ],
  });

  console.log(result.messages[result.messages.length - 1].content);
};

구성(Configuration)

모든 도구는 DecodoConfig 객체를 받습니다:

type DecodoConfig = {
  username: string; // Your Web Advanced product username
  password: string; // Your Web Advanced product password
};

API 파라미터(API parameters)

사용 가능한 파라미터 목록은 Scraper API 문서를 참조하세요.

라이선스(License)

MIT

지원(Support)

지원이 필요하면 Decodo의 문서를 방문하거나 GitHub에서 이슈를 열어주세요.

더 알아보기 (Learn more)