mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-30 06:59:41 -08:00
0f7ae3f50a
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com>
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
|
import {
|
|
NodeConnectionType,
|
|
type IExecuteFunctions,
|
|
type INodeType,
|
|
type INodeTypeDescription,
|
|
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'],
|
|
},
|
|
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: IExecuteFunctions): 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),
|
|
};
|
|
}
|
|
}
|