本页还没有译文
本页 22 段还没译成简体中文,下面显示的是英文原文。Nia Toolkit integration
还没翻译译自英文(docs.langchain.com)本页 22 段都还没译
Nia is a search and index API that continuously provides context from docs, research papers, datasets, codebases, and more—so agents never rely on stale data. Scalable, 5x cheaper, and reliable.
Overview
Integration details
| Class | Package | PY support | Version |
|---|---|---|---|
NiaToolkit | @nozomioai/langchain-nia | ✅ |
Setup
The integration lives in the @nozomioai/langchain-nia package:
npm install @nozomioai/langchain-nia @langchain/coreyarn add @nozomioai/langchain-nia @langchain/corepnpm add @nozomioai/langchain-nia @langchain/coreCredentials
Sign up at trynia.ai to get an API key.
process.env.NIA_API_KEY = "nk_...";It's also helpful (but not needed) to set up LangSmith for best-in-class observability:
process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_API_KEY = "your-api-key";Instantiation
Using the toolkit
import { NiaToolkit } from "@nozomioai/langchain-nia";
const toolkit = new NiaToolkit({
includeSearch: true, // 5 search tools
includeSources: true, // 7 source management tools
includeGithub: true, // 4 GitHub tools
includeContexts: true, // 2 context/memory tools
includeDependencies: true, // 2 dependency tools
});
const tools = toolkit.getTools(); // 20 toolsUsing individual tools
import { NiaSearch } from "@nozomioai/langchain-nia";
const tool = new NiaSearch();Invocation
Search across indexed sources
import { NiaSearch } from "@nozomioai/langchain-nia";
const tool = new NiaSearch();
const result = await tool.invoke({ query: "how to use React hooks" });Search the web
import { NiaWebSearch } from "@nozomioai/langchain-nia";
const tool = new NiaWebSearch();
const result = await tool.invoke({ query: "latest Node.js release", numResults: 5 });Within an agent
import { NiaToolkit } from "@nozomioai/langchain-nia";
import { ChatOpenAI } from "@langchain/openai";
const toolkit = new NiaToolkit({ includeSearch: true });
const tools = toolkit.getTools();
const llm = new ChatOpenAI({ model: "gpt-4o" });
const llmWithTools = llm.bindTools(tools);
const result = await llmWithTools.invoke("Search for React hooks best practices");Available tools
| Tool | Description |
|---|---|
NiaSearch | Semantic search across indexed repos, docs, and data sources |
NiaWebSearch | Web search with category filtering and date range |
NiaDeepResearch | Multi-step comprehensive research |
NiaUniversalSearch | Search all sources simultaneously |
NiaAdvisor | Analyze code against indexed documentation |
NiaIndex | Index new sources (repos, docs, papers, datasets) |
NiaSourceList | List indexed sources with filtering |
NiaSourceSubscribe | Subscribe to pre-indexed public sources |
NiaSourceSync | Re-sync sources to pull latest changes |
NiaRead | Read files/pages from indexed sources |
NiaGrep | Regex search within indexed sources |
NiaExplore | Browse file tree of indexed sources |
NiaGitHubSearch | Search code in GitHub repositories |
NiaGitHubRead | Read files from GitHub repos |
NiaGitHubGlob | Find files matching glob patterns |
NiaGitHubTree | Browse repo file tree |
NiaContextSave | Save context for cross-agent sharing |
NiaContextSearch | Semantic search over saved contexts |
NiaDependencySubscribe | Auto-subscribe to docs for project dependencies |
NiaDependencyAnalyze | Preview indexable dependencies from a manifest |
API reference
For detailed documentation, see the langchain-nia GitHub repository.
AI 翻译查看英文原文