Merge pull request #1162 from SearchApi/feature/add-searchapi
Add SearchApi documentloader, tool & podcast QA example
This commit is contained in:
commit
4f3d352606
|
|
@ -0,0 +1,26 @@
|
|||
import { INodeParams, INodeCredential } from '../src/Interface'
|
||||
|
||||
class SearchApi implements INodeCredential {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
description: string
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Search API'
|
||||
this.name = 'searchApi'
|
||||
this.version = 1.0
|
||||
this.description =
|
||||
'Sign in to <a target="_blank" href="https://www.searchapi.io/">SearchApi</a> to obtain a free API key from the dashboard.'
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'SearchApi API Key',
|
||||
name: 'searchApiKey',
|
||||
type: 'password'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { credClass: SearchApi }
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { TextSplitter } from 'langchain/text_splitter'
|
||||
import { SearchApiLoader } from 'langchain/document_loaders/web/searchapi'
|
||||
import { getCredentialData, getCredentialParam } from '../../../src'
|
||||
|
||||
// Provides access to multiple search engines using the SearchApi.
|
||||
// For available parameters & engines, refer to: https://www.searchapi.io/docs/google
|
||||
class SearchAPI_DocumentLoaders implements INode {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'SearchApi For Web Search'
|
||||
this.name = 'searchApi'
|
||||
this.version = 1.0
|
||||
this.type = 'Document'
|
||||
this.icon = 'searchapi.svg'
|
||||
this.category = 'Document Loaders'
|
||||
this.description = 'Load data from real-time search results'
|
||||
this.baseClasses = [this.type]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
optional: false,
|
||||
credentialNames: ['searchApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Query',
|
||||
name: 'query',
|
||||
type: 'string',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Custom Parameters',
|
||||
name: 'customParameters',
|
||||
type: 'json',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'Text Splitter',
|
||||
name: 'textSplitter',
|
||||
type: 'TextSplitter',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Metadata',
|
||||
name: 'metadata',
|
||||
type: 'json',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const query = nodeData.inputs?.query as string
|
||||
const customParameters = nodeData.inputs?.customParameters
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
|
||||
// Fetch the API credentials for this node
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const searchApiKey = getCredentialParam('searchApiKey', credentialData, nodeData)
|
||||
|
||||
// Check and parse custom parameters (should be JSON or object)
|
||||
const parsedParameters = typeof customParameters === 'object' ? customParameters : JSON.parse(customParameters || '{}')
|
||||
|
||||
// Prepare the configuration for the SearchApiLoader
|
||||
const loaderConfig = {
|
||||
q: query,
|
||||
apiKey: searchApiKey,
|
||||
...parsedParameters
|
||||
}
|
||||
|
||||
// Initialize the loader with the given configuration
|
||||
const loader = new SearchApiLoader(loaderConfig)
|
||||
|
||||
// Fetch documents, split if a text splitter is provided
|
||||
const docs = textSplitter ? await loader.loadAndSplit() : await loader.load()
|
||||
|
||||
if (metadata) {
|
||||
const parsedMetadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
|
||||
return docs.map((doc) => {
|
||||
return {
|
||||
...doc,
|
||||
metadata: {
|
||||
...doc.metadata,
|
||||
...parsedMetadata
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return docs
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: SearchAPI_DocumentLoaders }
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg id="SvgjsSvg1001" width="75.27131652832031" height="63.92396926879883" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 75.27131652832031 63.92396926879883"><defs id="SvgjsDefs1002"></defs><rect id="SvgjsRect1008" width="75.27131652832031" height="63.92396926879883" fill="transparent"></rect><g id="SvgjsG1009" transform="matrix(1,0,0,1,-39.50003433227539,-50.53549575805664)"><title>0479_octopus_verti</title><path id="color_1" d="M97.24234,109.8245a2.57759,2.57759,0,0,1-2.57778,2.57778,9.80672,9.80672,0,0,1-9.79558-9.79557V91.58366a2.57779,2.57779,0,0,1,5.15557,0v11.02305a4.64509,4.64509,0,0,0,4.64,4.64A2.57759,2.57759,0,0,1,97.24234,109.8245ZM112.19348,93.223a2.57759,2.57759,0,0,0-2.57778,2.57779,4.64,4.64,0,1,1-9.28,0V73.73554a23.2,23.2,0,1,0-46.40009,0V95.80076a4.64,4.64,0,1,1-9.28,0,2.57779,2.57779,0,1,0-5.15557,0,9.79558,9.79558,0,0,0,19.59115,0V73.73554a18.04449,18.04449,0,0,1,36.089,0V95.80076a9.79558,9.79558,0,0,0,19.59115,0A2.57759,2.57759,0,0,0,112.19348,93.223ZM77.13563,91.78a2.57759,2.57759,0,0,0-2.57778,2.57778v17.52893a2.57779,2.57779,0,0,0,5.15557,0V94.3578A2.57759,2.57759,0,0,0,77.13563,91.78ZM66.8245,89.00588a2.57759,2.57759,0,0,0-2.57778,2.57778v11.02305a4.64509,4.64509,0,0,1-4.64,4.64,2.57778,2.57778,0,1,0,0,5.15556,9.80671,9.80671,0,0,0,9.79557-9.79557V91.58366A2.57759,2.57759,0,0,0,66.8245,89.00588ZM69.918,70.12639a3.6089,3.6089,0,1,0,3.6089,3.6089A3.60891,3.60891,0,0,0,69.918,70.12639Zm18.04448,3.6089a3.6089,3.6089,0,1,0-3.60889,3.60889A3.60891,3.60891,0,0,0,87.96251,73.73529Z" fill="#3730a3"></path></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,42 @@
|
|||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { SearchApi } from 'langchain/tools'
|
||||
|
||||
class SearchAPI_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'SearchApi'
|
||||
this.name = 'searchAPI'
|
||||
this.version = 1.0
|
||||
this.type = 'SearchAPI'
|
||||
this.icon = 'searchapi.svg'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Real-time API for accessing Google Search data'
|
||||
this.inputs = []
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['searchApi']
|
||||
}
|
||||
this.baseClasses = [this.type, ...getBaseClasses(SearchApi)]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const searchApiKey = getCredentialParam('searchApiKey', credentialData, nodeData)
|
||||
return new SearchApi(searchApiKey)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: SearchAPI_Tools }
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg id="SvgjsSvg1001" width="75.27131652832031" height="63.92396926879883" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 75.27131652832031 63.92396926879883"><defs id="SvgjsDefs1002"></defs><rect id="SvgjsRect1008" width="75.27131652832031" height="63.92396926879883" fill="transparent"></rect><g id="SvgjsG1009" transform="matrix(1,0,0,1,-39.50003433227539,-50.53549575805664)"><title>0479_octopus_verti</title><path id="color_1" d="M97.24234,109.8245a2.57759,2.57759,0,0,1-2.57778,2.57778,9.80672,9.80672,0,0,1-9.79558-9.79557V91.58366a2.57779,2.57779,0,0,1,5.15557,0v11.02305a4.64509,4.64509,0,0,0,4.64,4.64A2.57759,2.57759,0,0,1,97.24234,109.8245ZM112.19348,93.223a2.57759,2.57759,0,0,0-2.57778,2.57779,4.64,4.64,0,1,1-9.28,0V73.73554a23.2,23.2,0,1,0-46.40009,0V95.80076a4.64,4.64,0,1,1-9.28,0,2.57779,2.57779,0,1,0-5.15557,0,9.79558,9.79558,0,0,0,19.59115,0V73.73554a18.04449,18.04449,0,0,1,36.089,0V95.80076a9.79558,9.79558,0,0,0,19.59115,0A2.57759,2.57759,0,0,0,112.19348,93.223ZM77.13563,91.78a2.57759,2.57759,0,0,0-2.57778,2.57778v17.52893a2.57779,2.57779,0,0,0,5.15557,0V94.3578A2.57759,2.57759,0,0,0,77.13563,91.78ZM66.8245,89.00588a2.57759,2.57759,0,0,0-2.57778,2.57778v11.02305a4.64509,4.64509,0,0,1-4.64,4.64,2.57778,2.57778,0,1,0,0,5.15556,9.80671,9.80671,0,0,0,9.79557-9.79557V91.58366A2.57759,2.57759,0,0,0,66.8245,89.00588ZM69.918,70.12639a3.6089,3.6089,0,1,0,3.6089,3.6089A3.60891,3.60891,0,0,0,69.918,70.12639Zm18.04448,3.6089a3.6089,3.6089,0,1,0-3.60889,3.60889A3.60891,3.60891,0,0,0,87.96251,73.73529Z" fill="#3730a3"></path></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,669 @@
|
|||
{
|
||||
"description": "Engage with data sources such as YouTube Transcripts, Google, and more through intelligent Q&A interactions",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 483,
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"position": {
|
||||
"x": 1499.2693059023254,
|
||||
"y": 430.03911199833317
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "conversationalRetrievalQAChain_0",
|
||||
"label": "Conversational Retrieval QA Chain",
|
||||
"version": 1,
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain",
|
||||
"baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "Runnable"],
|
||||
"category": "Chains",
|
||||
"description": "Document QA - built on RetrievalQAChain to provide a chat history component",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Return Source Documents",
|
||||
"name": "returnSourceDocuments",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean"
|
||||
},
|
||||
{
|
||||
"label": "System Message",
|
||||
"name": "systemMessagePrompt",
|
||||
"type": "string",
|
||||
"rows": 4,
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"placeholder": "I want you to act as a document that I am having a conversation with. Your name is \"AI Assistant\". You will provide me with answers from the given info. If the answer is not included, say exactly \"Hmm, I am not sure.\" and stop after that. Refuse to answer any question not about the info. Never break character.",
|
||||
"id": "conversationalRetrievalQAChain_0-input-systemMessagePrompt-string"
|
||||
},
|
||||
{
|
||||
"label": "Chain Option",
|
||||
"name": "chainOption",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "MapReduceDocumentsChain",
|
||||
"name": "map_reduce",
|
||||
"description": "Suitable for QA tasks over larger documents and can run the preprocessing step in parallel, reducing the running time"
|
||||
},
|
||||
{
|
||||
"label": "RefineDocumentsChain",
|
||||
"name": "refine",
|
||||
"description": "Suitable for QA tasks over a large number of documents."
|
||||
},
|
||||
{
|
||||
"label": "StuffDocumentsChain",
|
||||
"name": "stuff",
|
||||
"description": "Suitable for QA tasks over a small number of documents."
|
||||
}
|
||||
],
|
||||
"additionalParams": true,
|
||||
"optional": true,
|
||||
"id": "conversationalRetrievalQAChain_0-input-chainOption-options"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Language Model",
|
||||
"name": "model",
|
||||
"type": "BaseLanguageModel",
|
||||
"id": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store Retriever",
|
||||
"name": "vectorStoreRetriever",
|
||||
"type": "BaseRetriever",
|
||||
"id": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever"
|
||||
},
|
||||
{
|
||||
"label": "Memory",
|
||||
"name": "memory",
|
||||
"type": "BaseMemory",
|
||||
"optional": true,
|
||||
"description": "If left empty, a default BufferMemory will be used",
|
||||
"id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStoreRetriever": "{{memoryVectorStore_0.data.instance}}",
|
||||
"memory": "",
|
||||
"returnSourceDocuments": "",
|
||||
"systemMessagePrompt": "",
|
||||
"chainOption": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain|Runnable",
|
||||
"name": "conversationalRetrievalQAChain",
|
||||
"label": "ConversationalRetrievalQAChain",
|
||||
"type": "ConversationalRetrievalQAChain | BaseChain | Runnable"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1499.2693059023254,
|
||||
"y": 430.03911199833317
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 408,
|
||||
"id": "memoryVectorStore_0",
|
||||
"position": {
|
||||
"x": 1082.0280622332507,
|
||||
"y": 589.9990964387842
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "memoryVectorStore_0",
|
||||
"label": "In-Memory Vector Store",
|
||||
"version": 1,
|
||||
"name": "memoryVectorStore",
|
||||
"type": "Memory",
|
||||
"baseClasses": ["Memory", "VectorStoreRetriever", "BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "In-memory vectorstore that stores embeddings and does an exact, linear search for the most similar embeddings.",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Top K",
|
||||
"name": "topK",
|
||||
"description": "Number of top results to fetch. Default to 4",
|
||||
"placeholder": "4",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "memoryVectorStore_0-input-topK-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"list": true,
|
||||
"id": "memoryVectorStore_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "memoryVectorStore_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": ["{{searchApi_0.data.instance}}", "{{searchApi_0.data.instance}}", "{{searchApi_0.data.instance}}"],
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"topK": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Memory Retriever",
|
||||
"type": "Memory | VectorStoreRetriever | BaseRetriever"
|
||||
},
|
||||
{
|
||||
"id": "memoryVectorStore_0-output-vectorStore-Memory|VectorStore",
|
||||
"name": "vectorStore",
|
||||
"label": "Memory Vector Store",
|
||||
"type": "Memory | VectorStore"
|
||||
}
|
||||
],
|
||||
"default": "retriever"
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"output": "retriever"
|
||||
},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 1082.0280622332507,
|
||||
"y": 589.9990964387842
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 577,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 1056.2788608917747,
|
||||
"y": -60.59149112477064
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"version": 2,
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
|
||||
"category": "Chat Models",
|
||||
"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "chatOpenAI_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"label": "gpt-4",
|
||||
"name": "gpt-4"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-0613",
|
||||
"name": "gpt-4-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k",
|
||||
"name": "gpt-4-32k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-4-32k-0613",
|
||||
"name": "gpt-4-32k-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo",
|
||||
"name": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-0613",
|
||||
"name": "gpt-3.5-turbo-0613"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k",
|
||||
"name": "gpt-3.5-turbo-16k"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-16k-0613",
|
||||
"name": "gpt-3.5-turbo-16k-0613"
|
||||
}
|
||||
],
|
||||
"default": "gpt-3.5-turbo",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-modelName-options"
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"step": 0.1,
|
||||
"default": 0.9,
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-temperature-number"
|
||||
},
|
||||
{
|
||||
"label": "Max Tokens",
|
||||
"name": "maxTokens",
|
||||
"type": "number",
|
||||
"step": 1,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-maxTokens-number"
|
||||
},
|
||||
{
|
||||
"label": "Top Probability",
|
||||
"name": "topP",
|
||||
"type": "number",
|
||||
"step": 0.1,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-topP-number"
|
||||
},
|
||||
{
|
||||
"label": "Frequency Penalty",
|
||||
"name": "frequencyPenalty",
|
||||
"type": "number",
|
||||
"step": 0.1,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-frequencyPenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Presence Penalty",
|
||||
"name": "presencePenalty",
|
||||
"type": "number",
|
||||
"step": 0.1,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-presencePenalty-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"step": 1,
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-basepath-string"
|
||||
},
|
||||
{
|
||||
"label": "BaseOptions",
|
||||
"name": "baseOptions",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "chatOpenAI_0-input-baseOptions-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Cache",
|
||||
"name": "cache",
|
||||
"type": "BaseCache",
|
||||
"optional": true,
|
||||
"id": "chatOpenAI_0-input-cache-BaseCache"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"cache": "",
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": "0.5",
|
||||
"maxTokens": "",
|
||||
"topP": "",
|
||||
"frequencyPenalty": "",
|
||||
"presencePenalty": "",
|
||||
"timeout": "",
|
||||
"basepath": "",
|
||||
"baseOptions": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1056.2788608917747,
|
||||
"y": -60.59149112477064
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 478,
|
||||
"id": "characterTextSplitter_0",
|
||||
"position": {
|
||||
"x": 260.5475803279806,
|
||||
"y": -65.1647664861618
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "characterTextSplitter_0",
|
||||
"label": "Character Text Splitter",
|
||||
"version": 1,
|
||||
"name": "characterTextSplitter",
|
||||
"type": "CharacterTextSplitter",
|
||||
"baseClasses": ["CharacterTextSplitter", "TextSplitter", "BaseDocumentTransformer", "Runnable"],
|
||||
"category": "Text Splitters",
|
||||
"description": "splits only on one type of character (defaults to \"\\n\\n\").",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Chunk Size",
|
||||
"name": "chunkSize",
|
||||
"type": "number",
|
||||
"default": 1000,
|
||||
"optional": true,
|
||||
"id": "characterTextSplitter_0-input-chunkSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Chunk Overlap",
|
||||
"name": "chunkOverlap",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"id": "characterTextSplitter_0-input-chunkOverlap-number"
|
||||
},
|
||||
{
|
||||
"label": "Custom Separator",
|
||||
"name": "separator",
|
||||
"type": "string",
|
||||
"placeholder": "\" \"",
|
||||
"description": "Seperator to determine when to split the text, will override the default separator",
|
||||
"optional": true,
|
||||
"id": "characterTextSplitter_0-input-separator-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"chunkSize": "2000",
|
||||
"chunkOverlap": "200",
|
||||
"separator": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "characterTextSplitter_0-output-characterTextSplitter-CharacterTextSplitter|TextSplitter|BaseDocumentTransformer|Runnable",
|
||||
"name": "characterTextSplitter",
|
||||
"label": "CharacterTextSplitter",
|
||||
"type": "CharacterTextSplitter | TextSplitter | BaseDocumentTransformer | Runnable"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 260.5475803279806,
|
||||
"y": -65.1647664861618
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 332,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": 666.3950526535211,
|
||||
"y": 777.4191705193945
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "openAIEmbeddings_0",
|
||||
"label": "OpenAI Embeddings",
|
||||
"version": 1,
|
||||
"name": "openAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings",
|
||||
"baseClasses": ["OpenAIEmbeddings", "Embeddings"],
|
||||
"category": "Embeddings",
|
||||
"description": "OpenAI API to generate embeddings for a given text",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"credentialNames": ["openAIApi"],
|
||||
"id": "openAIEmbeddings_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Strip New Lines",
|
||||
"name": "stripNewLines",
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-stripNewLines-boolean"
|
||||
},
|
||||
{
|
||||
"label": "Batch Size",
|
||||
"name": "batchSize",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-batchSize-number"
|
||||
},
|
||||
{
|
||||
"label": "Timeout",
|
||||
"name": "timeout",
|
||||
"type": "number",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-timeout-number"
|
||||
},
|
||||
{
|
||||
"label": "BasePath",
|
||||
"name": "basepath",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "openAIEmbeddings_0-input-basepath-string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"stripNewLines": "",
|
||||
"batchSize": "",
|
||||
"timeout": "",
|
||||
"basepath": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"dragging": false,
|
||||
"positionAbsolute": {
|
||||
"x": 666.3950526535211,
|
||||
"y": 777.4191705193945
|
||||
}
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 482,
|
||||
"id": "searchApi_0",
|
||||
"position": {
|
||||
"x": 680.1258121447145,
|
||||
"y": 144.9905217023999
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "searchApi_0",
|
||||
"label": "SearchApi",
|
||||
"version": 1,
|
||||
"name": "searchApi",
|
||||
"type": "Document",
|
||||
"baseClasses": ["Document"],
|
||||
"category": "Document Loaders",
|
||||
"description": "Load data from real-time search results",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Connect Credential",
|
||||
"name": "credential",
|
||||
"type": "credential",
|
||||
"optional": false,
|
||||
"credentialNames": ["searchApi"],
|
||||
"id": "searchApi_0-input-credential-credential"
|
||||
},
|
||||
{
|
||||
"label": "Query",
|
||||
"name": "query",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"id": "searchApi_0-input-query-string"
|
||||
},
|
||||
{
|
||||
"label": "Custom Parameters",
|
||||
"name": "customParameters",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "searchApi_0-input-customParameters-json"
|
||||
},
|
||||
{
|
||||
"label": "Metadata",
|
||||
"name": "metadata",
|
||||
"type": "json",
|
||||
"optional": true,
|
||||
"additionalParams": true,
|
||||
"id": "searchApi_0-input-metadata-json"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Text Splitter",
|
||||
"name": "textSplitter",
|
||||
"type": "TextSplitter",
|
||||
"optional": true,
|
||||
"id": "searchApi_0-input-textSplitter-TextSplitter"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"query": "",
|
||||
"customParameters": "{\"engine\":\"youtube_transcripts\",\"video_id\":\"0e3GPea1Tyg\"}",
|
||||
"textSplitter": "{{characterTextSplitter_0.data.instance}}",
|
||||
"metadata": ""
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "searchApi_0-output-searchApi-Document",
|
||||
"name": "searchApi",
|
||||
"label": "Document",
|
||||
"type": "Document"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 680.1258121447145,
|
||||
"y": 144.9905217023999
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "memoryVectorStore_0",
|
||||
"sourceHandle": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "memoryVectorStore_0-memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "chatOpenAI_0",
|
||||
"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAIEmbeddings_0",
|
||||
"sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"target": "memoryVectorStore_0",
|
||||
"targetHandle": "memoryVectorStore_0-input-embeddings-Embeddings",
|
||||
"type": "buttonedge",
|
||||
"id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-memoryVectorStore_0-memoryVectorStore_0-input-embeddings-Embeddings",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "characterTextSplitter_0",
|
||||
"sourceHandle": "characterTextSplitter_0-output-characterTextSplitter-CharacterTextSplitter|TextSplitter|BaseDocumentTransformer|Runnable",
|
||||
"target": "searchApi_0",
|
||||
"targetHandle": "searchApi_0-input-textSplitter-TextSplitter",
|
||||
"type": "buttonedge",
|
||||
"id": "characterTextSplitter_0-characterTextSplitter_0-output-characterTextSplitter-CharacterTextSplitter|TextSplitter|BaseDocumentTransformer|Runnable-searchApi_0-searchApi_0-input-textSplitter-TextSplitter",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "searchApi_0",
|
||||
"sourceHandle": "searchApi_0-output-searchApi-Document",
|
||||
"target": "memoryVectorStore_0",
|
||||
"targetHandle": "memoryVectorStore_0-input-document-Document",
|
||||
"type": "buttonedge",
|
||||
"id": "searchApi_0-searchApi_0-output-searchApi-Document-memoryVectorStore_0-memoryVectorStore_0-input-document-Document",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue