npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

langchain-talordata

v0.1.1

Published

LangChain integration for Talor SERP API - TypeScript version

Readme

langchain-talordata

LangChain integration for TalorData's SERP APIs - TypeScript

npm version Node versions License: MIT

InstallationQuick StartToolsResources

LangChain integration for the Talor SERP API.

This package provides:

  • TalorSerpAPIWrapper for direct async API access
  • TalorSerpTool for creating tool descriptors for model tool routing
  • bundled engine schemas for 30+ search engines
  • support for search, history, and statistics endpoints

Overview

langchain-talordata provides TypeScript tools for TalorData's SERP APIs, enabling your AI apps to:

  • Search - Query search engines with geo-targeting and language customization
  • Inspect engines - Discover supported engines and engine-specific parameters
  • Query history - Fetch SERP request history with filters
  • View statistics - Retrieve usage statistics by date range and engine

Installation

npm install langchain-talordata

If you want to use the modern LangChain chat-model tool-calling flow, install a model integration too:

npm install @langchain/openai

Quick Start

1. Get your API key

Sign up at TalorData and get your API key from the dashboard.

2. Set up authentication

process.env.TALOR_API_KEY = "your-token";

3. Wrapper usage

import { TalorSerpAPIWrapper } from "langchain-talordata";

const wrapper = new TalorSerpAPIWrapper();
const result = await wrapper.run("LangChain tutorial");
console.log(result);

4. Modern tool-calling usage

Like the Python version, the recommended modern flow is: bind tools to a chat model, let the model emit tool_calls, then execute the chosen tool. In the TypeScript package, Talor tools are lightweight descriptors with name, description, inputSchema, and execute(input).

import { ChatOpenAI } from "@langchain/openai";
import { TalorSerpTool } from "langchain-talordata";

process.env.TALOR_API_KEY = "your-token";

const llm = new ChatOpenAI({
  model: "gpt-4o-mini",
  temperature: 0,
});

const searchTool = TalorSerpTool.fromEnv();

const modelWithTools = llm.bindTools([
  {
    type: "function",
    function: {
      name: searchTool.name,
      description: searchTool.description,
      parameters: searchTool.inputSchema,
    },
  },
]);

const response = await modelWithTools.invoke(
  "Search for the latest LangChain news"
);

console.log(response);

for (const call of response.tool_calls ?? []) {
  if (call.name === searchTool.name) {
    const toolResult = await searchTool.execute(call.args);
    console.log(toolResult);
  }
}

5. Search tool

import { TalorSerpTool } from "langchain-talordata";

const searchTool = TalorSerpTool.fromEnv();

const result = await searchTool.execute({
  query: "LangChain tutorial",
  engine: "google",
  params: {
    gl: "us",
    hl: "en",
    device: "desktop",
  },
});

console.log(result);

Search parameters:

  • query: required search query text
  • engine: optional engine key such as google, google_news, google_images, bing, duckduckgo
  • params: optional engine-specific parameter object
  • common params fields include gl, hl, device, location, and no_cache
  • use talor_serp_list_engines to inspect detailed parameters for a specific engine

params also accepts a JSON string when returned by a model tool call, for example:

const result = await searchTool.execute({
  query: "LangChain tutorial",
  engine: "google",
  params: "{\"hl\": \"zh-CN\", \"gl\": \"cn\"}",
});

6. History tool

import { TalorSerpTool } from "langchain-talordata";

const historyTool = TalorSerpTool.historyFromEnv();

const result = await historyTool.execute({
  page: 1,
  page_size: 20,
  search_query: "langchain",
  search_engine: "google",
  status: "success",
  timezone: "Asia/Shanghai",
});

console.log(result);

History parameters:

  • page: page number, default 1
  • page_size: page size, default 20
  • search_query: optional keyword filter
  • search_engine: optional engine filter such as google or bing
  • status: all, success, or error
  • start_time: optional unix timestamp in seconds
  • end_time: optional unix timestamp in seconds
  • timezone: optional timezone header such as Asia/Shanghai or +08:00

7. Statistics tool

import { TalorSerpTool } from "langchain-talordata";

const statisticsTool = TalorSerpTool.statisticsFromEnv();

const result = await statisticsTool.execute({
  start_date: "2026-06-01",
  end_date: "2026-06-05",
  engines: "google,bing",
  timezone: "+08:00",
});

console.log(result);

Statistics parameters:

  • start_date: required, format YYYY-MM-DD
  • end_date: required, format YYYY-MM-DD
  • engines: optional comma-separated engine keys such as google,bing
  • timezone: optional timezone offset such as +08:00

8. Bind multiple tools

import { ChatOpenAI } from "@langchain/openai";
import { TalorSerpTool } from "langchain-talordata";

const llm = new ChatOpenAI({
  model: "gpt-4o-mini",
  temperature: 0,
});

const tools = TalorSerpTool.toolsFromEnv();
const toolsByName = Object.fromEntries(tools.map((tool) => [tool.name, tool]));

const modelWithTools = llm.bindTools(
  tools.map((tool) => ({
    type: "function",
    function: {
      name: tool.name,
      description: tool.description,
      parameters: tool.inputSchema,
    },
  }))
);

const response = await modelWithTools.invoke(
  "Show my SERP usage statistics for 2026-06-01 to 2026-06-05"
);

for (const call of response.tool_calls ?? []) {
  const tool = toolsByName[call.name];
  if (!tool) continue;

  const result = await tool.execute(call.args);
  console.log(call.name, result);
}

These tool descriptors expose:

  • name
  • description
  • inputSchema
  • execute(input)

bindTools() only lets the model generate tool_calls. To actually execute the selected tool, your code still needs to call tool.execute(...).

Tools

  • talor_serp_search - search the web with engine-specific parameters
  • talor_serp_list_engines - inspect supported engines and detailed parameter schemas
  • talor_serp_history - query historical SERP requests
  • talor_serp_statistics - query usage statistics for a date range

Compatibility note

If you are using modern LangChain JavaScript packages such as:

prefer the chat-model tool-calling flow shown above. In this package, Talor tools are lightweight descriptors rather than auto-executing LangChain tools, so the recommended pattern is:

  • let the model generate tool_calls
  • match the tool by name
  • execute it with tool.execute(call.args)
  • optionally feed the tool result back into your own agent loop

Wrapper API

import { TalorSerpAPIWrapper } from "langchain-talordata";

const wrapper = new TalorSerpAPIWrapper({
  talorApiKey: "your-token",
  engine: "google",
  gl: "us",
  hl: "en",
  device: "desktop",
  responseMode: "compact",
  timeout: 15000,
  k: 5,
});

const results = await wrapper.run("query", "google_images", {
  gl: "cn",
  hl: "zh",
});

const raw = await wrapper.results("query");
const engines = wrapper.listEngines();
const desc = wrapper.engineDescription("google_flights");
const schema = wrapper.engineParamSchema("google_shopping");

For direct wrapper calls:

  • wrapper.run(query, engine?, kwargs?)
  • wrapper.results(query, engine?, kwargs?)
  • wrapper.history({ page, pageSize, searchQuery, ... })
  • wrapper.statistics({ startDate, endDate, ... })

Engine Parameters

Each engine has unique parameters. Use engineDescription() or engineParamSchema() to discover available parameters.

Common Parameters

  • gl - Country/region code (for example us, cn, uk)
  • hl - Interface language (for example en, zh, ja)
  • device - Device type: desktop, mobile, tablet
  • location - Geographic targeting
  • no_cache - Boolean, force fresh results

Development

npm install
npm run build
npm run dev
npm test
npm run clean

Resources

License

MIT

🎁 Get Started for Free

Try TalorData SERP API with 1,000 free searches and start building AI agents, SEO tools, and search-driven applications today.

  • No infrastructure to manage
  • Multi-engine search access
  • Real-time structured results
  • Developer-friendly integration

👉 Start Free


🤝 Connect With Us

Have questions or want to collaborate? Reach out through any of the following channels:


TalorData empowers developers and AI agents with fast, reliable search-data access through a single multi-engine SERP API.