mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
|
import {
|
|
NodeConnectionType,
|
|
type INodeType,
|
|
type INodeTypeDescription,
|
|
type ISupplyDataFunctions,
|
|
type SupplyData,
|
|
} from 'n8n-workflow';
|
|
import { WikipediaQueryRun } from '@langchain/community/tools/wikipedia_query_run';
|
|
import { logWrapper } from '../../../utils/logWrapper';
|
|
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
|
|
export class ToolWikipedia implements INodeType {
|
|
description: INodeTypeDescription = {
|
|
displayName: 'Wikipedia',
|
|
name: 'toolWikipedia',
|
|
icon: 'file:wikipedia.svg',
|
|
group: ['transform'],
|
|
version: 1,
|
|
description: 'Search in Wikipedia',
|
|
defaults: {
|
|
name: 'Wikipedia',
|
|
},
|
|
codex: {
|
|
categories: ['AI'],
|
|
subcategories: {
|
|
AI: ['Tools'],
|
|
Tools: ['Other Tools'],
|
|
},
|
|
resources: {
|
|
primaryDocumentation: [
|
|
{
|
|
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwikipedia/',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
|
inputs: [],
|
|
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
|
outputs: [NodeConnectionType.AiTool],
|
|
outputNames: ['Tool'],
|
|
properties: [getConnectionHintNoticeField([NodeConnectionType.AiAgent])],
|
|
};
|
|
|
|
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
|
const WikiTool = new WikipediaQueryRun();
|
|
|
|
WikiTool.description =
|
|
'A tool for interacting with and fetching data from the Wikipedia API. The input should always be a string query.';
|
|
|
|
return {
|
|
response: logWrapper(WikiTool, this),
|
|
};
|
|
}
|
|
}
|