mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
add webbrowsertool
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { BaseLanguageModel } from 'langchain/base_language'
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { WebBrowser } from 'langchain/tools/webbrowser'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
|
||||
class WebBrowser_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Web Browser'
|
||||
this.name = 'webBrowser'
|
||||
this.type = 'WebBrowser'
|
||||
this.icon = 'webBrowser.svg'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Gives agent the ability to visit a website and extract information'
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Language Model',
|
||||
name: 'model',
|
||||
type: 'BaseLanguageModel'
|
||||
},
|
||||
{
|
||||
label: 'Embeddings',
|
||||
name: 'embeddings',
|
||||
type: 'Embeddings'
|
||||
}
|
||||
]
|
||||
this.baseClasses = [this.type, ...getBaseClasses(WebBrowser)]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const model = nodeData.inputs?.model as BaseLanguageModel
|
||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||
|
||||
return new WebBrowser({ model, embeddings })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: WebBrowser_Tools }
|
||||
Reference in New Issue
Block a user