diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43866c9a..524db215 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,26 +118,28 @@ Flowise has 3 different modules in a single mono repository. Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables) -| Variable | Description | Type | Default | -| -------------------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- | -| PORT | The HTTP port Flowise runs on | Number | 3000 | -| FLOWISE_USERNAME | Username to login | String | | -| FLOWISE_PASSWORD | Password to login | String | | -| DEBUG | Print logs from components | Boolean | | -| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` | -| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` | -| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` | -| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` | -| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | | -| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | | -| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` | -| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` | -| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` | -| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_USERNAME | Database username (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | | +| Variable | Description | Type | Default | +| -------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- | +| PORT | The HTTP port Flowise runs on | Number | 3000 | +| FLOWISE_USERNAME | Username to login | String | | +| FLOWISE_PASSWORD | Password to login | String | | +| DEBUG | Print logs from components | Boolean | | +| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` | +| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` | +| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` | +| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` | +| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | | +| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | | +| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` | +| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` | +| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` | +| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | | +| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | | +| DATABASE_USER | Database username (When DATABASE_TYPE is not sqlite) | String | | +| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | | +| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | | +| PASSPHRASE | Passphrase used to create encryption key | String | `MYPASSPHRASE` | +| SECRETKEY_PATH | Location where encryption key (used to encrypt/decrypt credentials) is saved | String | `your-path/Flowise/packages/server` | You can also specify the env variables when using `npx`. For example: diff --git a/README.md b/README.md index 13da9420..65249147 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0 ### Docker Compose 1. Go to `docker` folder at the root of the project -2. Create `.env` file and specify the `PORT` (refer to `.env.example`) +2. Copy `.env.example` file, paste it into the same location, and rename to `.env` 3. `docker-compose up -d` 4. Open [http://localhost:3000](http://localhost:3000) 5. You can bring the containers down by `docker-compose stop` diff --git a/docker/.env.example b/docker/.env.example index e7d35272..dd3b00fb 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -1,20 +1,22 @@ PORT=3000 -OVERRIDE_DATABASE=true -DATABASE_TYPE=sqlite +PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key DATABASE_PATH=/root/.flowise -# When database is not sqlite +APIKEY_PATH=/root/.flowise +SECRETKEY_PATH=/root/.flowise +LOG_PATH=/root/.flowise/logs + +# DATABASE_TYPE=postgres # DATABASE_PORT="" # DATABASE_HOST="" # DATABASE_NAME="flowise" # DATABASE_USER="" # DATABASE_PASSWORD="" +# OVERRIDE_DATABASE=true -APIKEY_PATH=/root/.flowise -LOG_PATH=/root/.flowise/logs # FLOWISE_USERNAME=user # FLOWISE_PASSWORD=1234 # DEBUG=true # LOG_LEVEL=debug (error | warn | info | verbose | debug) -# EXECUTION_MODE=child or main +# EXECUTION_MODE=main (child | main) # TOOL_FUNCTION_BUILTIN_DEP=crypto,fs # TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash diff --git a/docker/README.md b/docker/README.md index 0060fa38..d3ad1c19 100644 --- a/docker/README.md +++ b/docker/README.md @@ -25,10 +25,11 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f ## 🌱 Env Variables -If you like to persist your data (flows, logs, apikeys), set these variables in the `.env` file inside `docker` folder: +If you like to persist your data (flows, logs, apikeys, credentials), set these variables in the `.env` file inside `docker` folder: - DATABASE_PATH=/root/.flowise - APIKEY_PATH=/root/.flowise - LOG_PATH=/root/.flowise/logs +- SECRETKEY_PATH=/root/.flowise Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7f616fa5..e9b2824d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -6,13 +6,15 @@ services: restart: always environment: - PORT=${PORT} + - PASSPHRASE=${PASSPHRASE} - FLOWISE_USERNAME=${FLOWISE_USERNAME} - FLOWISE_PASSWORD=${FLOWISE_PASSWORD} - DEBUG=${DEBUG} - DATABASE_PATH=${DATABASE_PATH} - APIKEY_PATH=${APIKEY_PATH} - - LOG_PATH=${LOG_PATH} + - SECRETKEY_PATH=${SECRETKEY_PATH} - LOG_LEVEL=${LOG_LEVEL} + - LOG_PATH=${LOG_PATH} - EXECUTION_MODE=${EXECUTION_MODE} ports: - '${PORT}:${PORT}' diff --git a/package.json b/package.json index 27c5358e..b5c7c5fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flowise", - "version": "1.2.16", + "version": "1.3.1", "private": true, "homepage": "https://flowiseai.com", "workspaces": [ diff --git a/packages/components/credentials/AirtableApi.credential.ts b/packages/components/credentials/AirtableApi.credential.ts new file mode 100644 index 00000000..323b308f --- /dev/null +++ b/packages/components/credentials/AirtableApi.credential.ts @@ -0,0 +1,27 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class AirtableApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Airtable API' + this.name = 'airtableApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to get accessToken on Airtable' + this.inputs = [ + { + label: 'Access Token', + name: 'accessToken', + type: 'password', + placeholder: '' + } + ] + } +} + +module.exports = { credClass: AirtableApi } diff --git a/packages/components/credentials/AnthropicApi.credential.ts b/packages/components/credentials/AnthropicApi.credential.ts new file mode 100644 index 00000000..955196c9 --- /dev/null +++ b/packages/components/credentials/AnthropicApi.credential.ts @@ -0,0 +1,23 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class AnthropicApi implements INodeCredential { + label: string + name: string + version: number + inputs: INodeParams[] + + constructor() { + this.label = 'Anthropic API' + this.name = 'anthropicApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Anthropic Api Key', + name: 'anthropicApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: AnthropicApi } diff --git a/packages/components/credentials/AzureOpenAIApi.credential.ts b/packages/components/credentials/AzureOpenAIApi.credential.ts new file mode 100644 index 00000000..65f63f37 --- /dev/null +++ b/packages/components/credentials/AzureOpenAIApi.credential.ts @@ -0,0 +1,47 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class AzureOpenAIApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Azure OpenAI API' + this.name = 'azureOpenAIApi' + this.version = 1.0 + this.description = + 'Refer to official guide of how to use Azure OpenAI service' + this.inputs = [ + { + label: 'Azure OpenAI Api Key', + name: 'azureOpenAIApiKey', + type: 'password', + description: `Refer to official guide on how to create API key on Azure OpenAI` + }, + { + label: 'Azure OpenAI Api Instance Name', + name: 'azureOpenAIApiInstanceName', + type: 'string', + placeholder: 'YOUR-INSTANCE-NAME' + }, + { + label: 'Azure OpenAI Api Deployment Name', + name: 'azureOpenAIApiDeploymentName', + type: 'string', + placeholder: 'YOUR-DEPLOYMENT-NAME' + }, + { + label: 'Azure OpenAI Api Version', + name: 'azureOpenAIApiVersion', + type: 'string', + placeholder: '2023-06-01-preview', + description: + 'Description of Supported API Versions. Please refer examples' + } + ] + } +} + +module.exports = { credClass: AzureOpenAIApi } diff --git a/packages/components/credentials/BraveSearchApi.credential.ts b/packages/components/credentials/BraveSearchApi.credential.ts new file mode 100644 index 00000000..fdacf82c --- /dev/null +++ b/packages/components/credentials/BraveSearchApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class BraveSearchApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Brave Search API' + this.name = 'braveSearchApi' + this.version = 1.0 + this.inputs = [ + { + label: 'BraveSearch Api Key', + name: 'braveApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: BraveSearchApi } diff --git a/packages/components/credentials/CohereApi.credential.ts b/packages/components/credentials/CohereApi.credential.ts new file mode 100644 index 00000000..b171090e --- /dev/null +++ b/packages/components/credentials/CohereApi.credential.ts @@ -0,0 +1,23 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class CohereApi implements INodeCredential { + label: string + name: string + version: number + inputs: INodeParams[] + + constructor() { + this.label = 'Cohere API' + this.name = 'cohereApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Cohere Api Key', + name: 'cohereApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: CohereApi } diff --git a/packages/components/credentials/ConfluenceApi.credential.ts b/packages/components/credentials/ConfluenceApi.credential.ts new file mode 100644 index 00000000..a1d32e9c --- /dev/null +++ b/packages/components/credentials/ConfluenceApi.credential.ts @@ -0,0 +1,33 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class ConfluenceApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Confluence API' + this.name = 'confluenceApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to get accessToken on Confluence' + this.inputs = [ + { + label: 'Access Token', + name: 'accessToken', + type: 'password', + placeholder: '' + }, + { + label: 'Username', + name: 'username', + type: 'string', + placeholder: '' + } + ] + } +} + +module.exports = { credClass: ConfluenceApi } diff --git a/packages/components/credentials/DynamodbMemoryApi.credential.ts b/packages/components/credentials/DynamodbMemoryApi.credential.ts new file mode 100644 index 00000000..2f5ffa64 --- /dev/null +++ b/packages/components/credentials/DynamodbMemoryApi.credential.ts @@ -0,0 +1,29 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class DynamodbMemoryApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'DynamodbMemory API' + this.name = 'dynamodbMemoryApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Access Key', + name: 'accessKey', + type: 'password' + }, + { + label: 'Secret Access Key', + name: 'secretAccessKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: DynamodbMemoryApi } diff --git a/packages/components/credentials/FigmaApi.credential.ts b/packages/components/credentials/FigmaApi.credential.ts new file mode 100644 index 00000000..aed49359 --- /dev/null +++ b/packages/components/credentials/FigmaApi.credential.ts @@ -0,0 +1,27 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class FigmaApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Figma API' + this.name = 'figmaApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to get accessToken on Figma' + this.inputs = [ + { + label: 'Access Token', + name: 'accessToken', + type: 'password', + placeholder: '' + } + ] + } +} + +module.exports = { credClass: FigmaApi } diff --git a/packages/components/credentials/GithubApi.credential.ts b/packages/components/credentials/GithubApi.credential.ts new file mode 100644 index 00000000..34c5074e --- /dev/null +++ b/packages/components/credentials/GithubApi.credential.ts @@ -0,0 +1,27 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class GithubApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Github API' + this.name = 'githubApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to get accessToken on Github' + this.inputs = [ + { + label: 'Access Token', + name: 'accessToken', + type: 'password', + placeholder: '' + } + ] + } +} + +module.exports = { credClass: GithubApi } diff --git a/packages/components/credentials/HuggingFaceApi.credential.ts b/packages/components/credentials/HuggingFaceApi.credential.ts new file mode 100644 index 00000000..1b922194 --- /dev/null +++ b/packages/components/credentials/HuggingFaceApi.credential.ts @@ -0,0 +1,23 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class HuggingFaceApi implements INodeCredential { + label: string + name: string + version: number + inputs: INodeParams[] + + constructor() { + this.label = 'HuggingFace API' + this.name = 'huggingFaceApi' + this.version = 1.0 + this.inputs = [ + { + label: 'HuggingFace Api Key', + name: 'huggingFaceApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: HuggingFaceApi } diff --git a/packages/components/credentials/MotorheadMemoryApi.credential.ts b/packages/components/credentials/MotorheadMemoryApi.credential.ts new file mode 100644 index 00000000..68a18ec1 --- /dev/null +++ b/packages/components/credentials/MotorheadMemoryApi.credential.ts @@ -0,0 +1,31 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class MotorheadMemoryApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Motorhead Memory API' + this.name = 'motorheadMemoryApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to create API key and Client ID on Motorhead Memory' + this.inputs = [ + { + label: 'Client ID', + name: 'clientId', + type: 'string' + }, + { + label: 'API Key', + name: 'apiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: MotorheadMemoryApi } diff --git a/packages/components/credentials/NotionApi.credential.ts b/packages/components/credentials/NotionApi.credential.ts new file mode 100644 index 00000000..ebe4bf99 --- /dev/null +++ b/packages/components/credentials/NotionApi.credential.ts @@ -0,0 +1,26 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class NotionApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Notion API' + this.name = 'notionApi' + this.version = 1.0 + this.description = + 'You can find integration token here' + this.inputs = [ + { + label: 'Notion Integration Token', + name: 'notionIntegrationToken', + type: 'password' + } + ] + } +} + +module.exports = { credClass: NotionApi } diff --git a/packages/components/credentials/OpenAIApi.credential.ts b/packages/components/credentials/OpenAIApi.credential.ts new file mode 100644 index 00000000..836da7e9 --- /dev/null +++ b/packages/components/credentials/OpenAIApi.credential.ts @@ -0,0 +1,23 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class OpenAIApi implements INodeCredential { + label: string + name: string + version: number + inputs: INodeParams[] + + constructor() { + this.label = 'OpenAI API' + this.name = 'openAIApi' + this.version = 1.0 + this.inputs = [ + { + label: 'OpenAI Api Key', + name: 'openAIApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: OpenAIApi } diff --git a/packages/components/credentials/OpenAPIAuth.credential.ts b/packages/components/credentials/OpenAPIAuth.credential.ts new file mode 100644 index 00000000..3f0ef907 --- /dev/null +++ b/packages/components/credentials/OpenAPIAuth.credential.ts @@ -0,0 +1,25 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class OpenAPIAuth implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'OpenAPI Auth Token' + this.name = 'openAPIAuth' + this.version = 1.0 + this.inputs = [ + { + label: 'OpenAPI Token', + name: 'openAPIToken', + type: 'password', + description: 'Auth Token. For example: Bearer ' + } + ] + } +} + +module.exports = { credClass: OpenAPIAuth } diff --git a/packages/components/credentials/PineconeApi.credential.ts b/packages/components/credentials/PineconeApi.credential.ts new file mode 100644 index 00000000..4c5f62fe --- /dev/null +++ b/packages/components/credentials/PineconeApi.credential.ts @@ -0,0 +1,29 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class PineconeApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Pinecone API' + this.name = 'pineconeApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Pinecone Api Key', + name: 'pineconeApiKey', + type: 'password' + }, + { + label: 'Pinecone Environment', + name: 'pineconeEnv', + type: 'string' + } + ] + } +} + +module.exports = { credClass: PineconeApi } diff --git a/packages/components/credentials/QdrantApi.credential.ts b/packages/components/credentials/QdrantApi.credential.ts new file mode 100644 index 00000000..fffebccc --- /dev/null +++ b/packages/components/credentials/QdrantApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class QdrantApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Qdrant API' + this.name = 'qdrantApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Qdrant API Key', + name: 'qdrantApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: QdrantApi } diff --git a/packages/components/credentials/ReplicateApi.credential.ts b/packages/components/credentials/ReplicateApi.credential.ts new file mode 100644 index 00000000..e638826b --- /dev/null +++ b/packages/components/credentials/ReplicateApi.credential.ts @@ -0,0 +1,23 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class ReplicateApi implements INodeCredential { + label: string + name: string + version: number + inputs: INodeParams[] + + constructor() { + this.label = 'Replicate API' + this.name = 'replicateApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Replicate Api Key', + name: 'replicateApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: ReplicateApi } diff --git a/packages/components/credentials/SerpApi.credential.ts b/packages/components/credentials/SerpApi.credential.ts new file mode 100644 index 00000000..20cf6ab5 --- /dev/null +++ b/packages/components/credentials/SerpApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class SerpApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Serp API' + this.name = 'serpApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Serp Api Key', + name: 'serpApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: SerpApi } diff --git a/packages/components/credentials/SerperApi.credential.ts b/packages/components/credentials/SerperApi.credential.ts new file mode 100644 index 00000000..9a8fee1e --- /dev/null +++ b/packages/components/credentials/SerperApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class SerperApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Serper API' + this.name = 'serperApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Serper Api Key', + name: 'serperApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: SerperApi } diff --git a/packages/components/credentials/SingleStoreApi.credential.ts b/packages/components/credentials/SingleStoreApi.credential.ts new file mode 100644 index 00000000..fee9853b --- /dev/null +++ b/packages/components/credentials/SingleStoreApi.credential.ts @@ -0,0 +1,31 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class SingleStoreApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'SingleStore API' + this.name = 'singleStoreApi' + this.version = 1.0 + this.inputs = [ + { + label: 'User', + name: 'user', + type: 'string', + placeholder: '' + }, + { + label: 'Password', + name: 'password', + type: 'password', + placeholder: '' + } + ] + } +} + +module.exports = { credClass: SingleStoreApi } diff --git a/packages/components/credentials/SupabaseApi.credential.ts b/packages/components/credentials/SupabaseApi.credential.ts new file mode 100644 index 00000000..beb2a422 --- /dev/null +++ b/packages/components/credentials/SupabaseApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class SupabaseApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Supabase API' + this.name = 'supabaseApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Supabase API Key', + name: 'supabaseApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: SupabaseApi } diff --git a/packages/components/credentials/WeaviateApi.credential.ts b/packages/components/credentials/WeaviateApi.credential.ts new file mode 100644 index 00000000..041b41ea --- /dev/null +++ b/packages/components/credentials/WeaviateApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class WeaviateApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Weaviate API' + this.name = 'weaviateApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Weaviate API Key', + name: 'weaviateApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: WeaviateApi } diff --git a/packages/components/credentials/ZapierNLAApi.credential.ts b/packages/components/credentials/ZapierNLAApi.credential.ts new file mode 100644 index 00000000..72035660 --- /dev/null +++ b/packages/components/credentials/ZapierNLAApi.credential.ts @@ -0,0 +1,24 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class ZapierNLAApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Zapier NLA API' + this.name = 'zapierNLAApi' + this.version = 1.0 + this.inputs = [ + { + label: 'Zapier NLA Api Key', + name: 'zapierNLAApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: ZapierNLAApi } diff --git a/packages/components/credentials/ZepMemoryApi.credential.ts b/packages/components/credentials/ZepMemoryApi.credential.ts new file mode 100644 index 00000000..a78ad6d6 --- /dev/null +++ b/packages/components/credentials/ZepMemoryApi.credential.ts @@ -0,0 +1,26 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class ZepMemoryApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Zep Memory API' + this.name = 'zepMemoryApi' + this.version = 1.0 + this.description = + 'Refer to official guide on how to create API key on Zep' + this.inputs = [ + { + label: 'API Key', + name: 'apiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: ZepMemoryApi } diff --git a/packages/components/nodes/agents/AirtableAgent/AirtableAgent.ts b/packages/components/nodes/agents/AirtableAgent/AirtableAgent.ts index 5d42d8be..074f39c1 100644 --- a/packages/components/nodes/agents/AirtableAgent/AirtableAgent.ts +++ b/packages/components/nodes/agents/AirtableAgent/AirtableAgent.ts @@ -1,6 +1,6 @@ import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface' import { AgentExecutor } from 'langchain/agents' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { LoadPyodide, finalSystemPrompt, systemPrompt } from './core' import { LLMChain } from 'langchain/chains' import { BaseLanguageModel } from 'langchain/base_language' @@ -10,34 +10,36 @@ import axios from 'axios' class Airtable_Agents 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 = 'Airtable Agent' this.name = 'airtableAgent' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'airtable.svg' this.description = 'Agent used to to answer queries on Airtable table' this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['airtableApi'] + } this.inputs = [ { label: 'Language Model', name: 'model', type: 'BaseLanguageModel' }, - { - label: 'Personal Access Token', - name: 'accessToken', - type: 'password', - description: - 'Get personal access token from official guide' - }, { label: 'Base Id', name: 'baseId', @@ -67,7 +69,6 @@ class Airtable_Agents implements INode { name: 'limit', type: 'number', default: 100, - step: 1, additionalParams: true, description: 'Number of results to return' } @@ -81,12 +82,14 @@ class Airtable_Agents implements INode { async run(nodeData: INodeData, input: string, options: ICommonObject): Promise { const model = nodeData.inputs?.model as BaseLanguageModel - const accessToken = nodeData.inputs?.accessToken as string const baseId = nodeData.inputs?.baseId as string const tableId = nodeData.inputs?.tableId as string const returnAll = nodeData.inputs?.returnAll as boolean const limit = nodeData.inputs?.limit as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessToken = getCredentialParam('accessToken', credentialData, nodeData) + let airtableData: ICommonObject[] = [] if (returnAll) { @@ -124,7 +127,6 @@ json.dumps(my_dict)` } catch (error) { throw new Error(error) } - options.logger.debug('[components/AirtableAgent] [1] DataframeColDict =>', dataframeColDict) // Then tell GPT to come out with ONLY python code // For example: len(df), df[df['SibSp'] > 3]['PassengerId'].count() @@ -142,7 +144,6 @@ json.dumps(my_dict)` const res = await chain.call(inputs, [loggerHandler]) pythonCode = res?.text } - options.logger.debug('[components/AirtableAgent] [2] Generated Python Code =>', pythonCode) // Then run the code using Pyodide let finalResult = '' @@ -154,7 +155,6 @@ json.dumps(my_dict)` throw new Error(`Sorry, I'm unable to find answer for question: "${input}" using follwoing code: "${pythonCode}"`) } } - options.logger.debug('[components/AirtableAgent] [3] Pyodide Result =>', finalResult) // Finally, return a complete answer if (finalResult) { @@ -170,11 +170,9 @@ json.dumps(my_dict)` if (options.socketIO && options.socketIOClientId) { const result = await chain.call(inputs, [loggerHandler, handler]) - options.logger.debug('[components/AirtableAgent] [4] Final Result =>', result?.text) return result?.text } else { const result = await chain.call(inputs, [loggerHandler]) - options.logger.debug('[components/AirtableAgent] [4] Final Result =>', result?.text) return result?.text } } diff --git a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts index 044b6f7b..69e9b9ed 100644 --- a/packages/components/nodes/agents/AutoGPT/AutoGPT.ts +++ b/packages/components/nodes/agents/AutoGPT/AutoGPT.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class AutoGPT_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class AutoGPT_Agents implements INode { constructor() { this.label = 'AutoGPT' this.name = 'autoGPT' + this.version = 1.0 this.type = 'AutoGPT' this.category = 'Agents' this.icon = 'autogpt.png' diff --git a/packages/components/nodes/agents/BabyAGI/BabyAGI.ts b/packages/components/nodes/agents/BabyAGI/BabyAGI.ts index 91af1469..303c231e 100644 --- a/packages/components/nodes/agents/BabyAGI/BabyAGI.ts +++ b/packages/components/nodes/agents/BabyAGI/BabyAGI.ts @@ -6,6 +6,7 @@ import { VectorStore } from 'langchain/vectorstores' class BabyAGI_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class BabyAGI_Agents implements INode { constructor() { this.label = 'BabyAGI' this.name = 'babyAGI' + this.version = 1.0 this.type = 'BabyAGI' this.category = 'Agents' this.icon = 'babyagi.jpg' diff --git a/packages/components/nodes/agents/CSVAgent/CSVAgent.ts b/packages/components/nodes/agents/CSVAgent/CSVAgent.ts index dae90990..9224a4c1 100644 --- a/packages/components/nodes/agents/CSVAgent/CSVAgent.ts +++ b/packages/components/nodes/agents/CSVAgent/CSVAgent.ts @@ -9,6 +9,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class CSV_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -19,6 +20,7 @@ class CSV_Agents implements INode { constructor() { this.label = 'CSV Agent' this.name = 'csvAgent' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'csvagent.png' @@ -92,7 +94,6 @@ json.dumps(my_dict)` } catch (error) { throw new Error(error) } - options.logger.debug('[components/CSVAgent] [1] DataframeColDict =>', dataframeColDict) // Then tell GPT to come out with ONLY python code // For example: len(df), df[df['SibSp'] > 3]['PassengerId'].count() @@ -110,7 +111,6 @@ json.dumps(my_dict)` const res = await chain.call(inputs, [loggerHandler]) pythonCode = res?.text } - options.logger.debug('[components/CSVAgent] [2] Generated Python Code =>', pythonCode) // Then run the code using Pyodide let finalResult = '' @@ -122,7 +122,6 @@ json.dumps(my_dict)` throw new Error(`Sorry, I'm unable to find answer for question: "${input}" using follwoing code: "${pythonCode}"`) } } - options.logger.debug('[components/CSVAgent] [3] Pyodide Result =>', finalResult) // Finally, return a complete answer if (finalResult) { @@ -138,11 +137,9 @@ json.dumps(my_dict)` if (options.socketIO && options.socketIOClientId) { const result = await chain.call(inputs, [loggerHandler, handler]) - options.logger.debug('[components/CSVAgent] [4] Final Result =>', result?.text) return result?.text } else { const result = await chain.call(inputs, [loggerHandler]) - options.logger.debug('[components/CSVAgent] [4] Final Result =>', result?.text) return result?.text } } diff --git a/packages/components/nodes/agents/ConversationalAgent/ConversationalAgent.ts b/packages/components/nodes/agents/ConversationalAgent/ConversationalAgent.ts index 568ced0b..005429d6 100644 --- a/packages/components/nodes/agents/ConversationalAgent/ConversationalAgent.ts +++ b/packages/components/nodes/agents/ConversationalAgent/ConversationalAgent.ts @@ -7,9 +7,18 @@ import { AIMessage, HumanMessage } from 'langchain/schema' import { BaseLanguageModel } from 'langchain/base_language' import { flatten } from 'lodash' +const DEFAULT_PREFIX = `Assistant is a large language model trained by OpenAI. + +Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand. + +Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics. + +Overall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.` + class ConversationalAgent_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -20,6 +29,7 @@ class ConversationalAgent_Agents implements INode { constructor() { this.label = 'Conversational Agent' this.name = 'conversationalAgent' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'agent.svg' @@ -47,14 +57,7 @@ class ConversationalAgent_Agents implements INode { name: 'systemMessage', type: 'string', rows: 4, - optional: true, - additionalParams: true - }, - { - label: 'Human Message', - name: 'humanMessage', - type: 'string', - rows: 4, + default: DEFAULT_PREFIX, optional: true, additionalParams: true } @@ -66,7 +69,6 @@ class ConversationalAgent_Agents implements INode { let tools = nodeData.inputs?.tools as Tool[] tools = flatten(tools) const memory = nodeData.inputs?.memory as BaseChatMemory - const humanMessage = nodeData.inputs?.humanMessage as string const systemMessage = nodeData.inputs?.systemMessage as string const obj: InitializeAgentExecutorOptions = { @@ -75,9 +77,6 @@ class ConversationalAgent_Agents implements INode { } const agentArgs: any = {} - if (humanMessage) { - agentArgs.humanMessage = humanMessage - } if (systemMessage) { agentArgs.systemMessage = systemMessage } diff --git a/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts b/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts index d2a52d6c..0a9e744c 100644 --- a/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts +++ b/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class MRKLAgentChat_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class MRKLAgentChat_Agents implements INode { constructor() { this.label = 'MRKL Agent for Chat Models' this.name = 'mrklAgentChat' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'agent.svg' diff --git a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts b/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts index eb685531..d7af586b 100644 --- a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts +++ b/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class MRKLAgentLLM_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class MRKLAgentLLM_Agents implements INode { constructor() { this.label = 'MRKL Agent for LLMs' this.name = 'mrklAgentLLM' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'agent.svg' diff --git a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts index f4d065d9..f3751f1f 100644 --- a/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts +++ b/packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts @@ -10,6 +10,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class OpenAIFunctionAgent_Agents implements INode { label: string name: string + version: number description: string type: string icon: string @@ -20,6 +21,7 @@ class OpenAIFunctionAgent_Agents implements INode { constructor() { this.label = 'OpenAI Function Agent' this.name = 'openAIFunctionAgent' + this.version = 1.0 this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'openai.png' diff --git a/packages/components/nodes/chains/ApiChain/GETApiChain.ts b/packages/components/nodes/chains/ApiChain/GETApiChain.ts index 373d0462..bd4f3bc0 100644 --- a/packages/components/nodes/chains/ApiChain/GETApiChain.ts +++ b/packages/components/nodes/chains/ApiChain/GETApiChain.ts @@ -19,6 +19,7 @@ export const API_RESPONSE_RAW_PROMPT_TEMPLATE = class GETApiChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -29,6 +30,7 @@ class GETApiChain_Chains implements INode { constructor() { this.label = 'GET API Chain' this.name = 'getApiChain' + this.version = 1.0 this.type = 'GETApiChain' this.icon = 'apichain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts index a231e80a..9f6c79e4 100644 --- a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts +++ b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts @@ -7,6 +7,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class OpenApiChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -17,10 +18,11 @@ class OpenApiChain_Chains implements INode { constructor() { this.label = 'OpenAPI Chain' this.name = 'openApiChain' - this.type = 'openApiChain' + this.version = 1.0 + this.type = 'OpenAPIChain' this.icon = 'openapi.png' this.category = 'Chains' - this.description = 'Chain to run queries against OpenAPI' + this.description = 'Chain that automatically select and call APIs based only on an OpenAPI spec' this.baseClasses = [this.type, ...getBaseClasses(APIChain)] this.inputs = [ { diff --git a/packages/components/nodes/chains/ApiChain/POSTApiChain.ts b/packages/components/nodes/chains/ApiChain/POSTApiChain.ts index 7189f1ad..cba4a297 100644 --- a/packages/components/nodes/chains/ApiChain/POSTApiChain.ts +++ b/packages/components/nodes/chains/ApiChain/POSTApiChain.ts @@ -8,6 +8,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class POSTApiChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -18,6 +19,7 @@ class POSTApiChain_Chains implements INode { constructor() { this.label = 'POST API Chain' this.name = 'postApiChain' + this.version = 1.0 this.type = 'POSTApiChain' this.icon = 'apichain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/ConversationChain/ConversationChain.ts b/packages/components/nodes/chains/ConversationChain/ConversationChain.ts index 7b6f002d..f08d430c 100644 --- a/packages/components/nodes/chains/ConversationChain/ConversationChain.ts +++ b/packages/components/nodes/chains/ConversationChain/ConversationChain.ts @@ -14,6 +14,7 @@ let systemMessage = `The following is a friendly conversation between a human an class ConversationChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -24,6 +25,7 @@ class ConversationChain_Chains implements INode { constructor() { this.label = 'Conversation Chain' this.name = 'conversationChain' + this.version = 1.0 this.type = 'ConversationChain' this.icon = 'chain.svg' this.category = 'Chains' @@ -77,6 +79,9 @@ class ConversationChain_Chains implements INode { finalText += finalDocs[i].pageContent } + const replaceChar: string[] = ['{', '}'] + for (const char of replaceChar) finalText = finalText.replaceAll(char, '') + if (finalText) systemMessage = `${systemMessage}\nThe AI has the following context:\n${finalText}` const obj: any = { diff --git a/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts b/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts index 3ac99bc3..e7f6e826 100644 --- a/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts +++ b/packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts @@ -2,7 +2,8 @@ import { BaseLanguageModel } from 'langchain/base_language' import { ICommonObject, IMessage, INode, INodeData, INodeParams } from '../../../src/Interface' import { getBaseClasses } from '../../../src/utils' import { ConversationalRetrievalQAChain, QAChainParams } from 'langchain/chains' -import { AIMessage, BaseRetriever, HumanMessage } from 'langchain/schema' +import { AIMessage, HumanMessage } from 'langchain/schema' +import { BaseRetriever } from 'langchain/schema/retriever' import { BaseChatMemory, BufferMemory, ChatMessageHistory, BufferMemoryInput } from 'langchain/memory' import { PromptTemplate } from 'langchain/prompts' import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler' @@ -19,6 +20,7 @@ import { class ConversationalRetrievalQAChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -29,6 +31,7 @@ class ConversationalRetrievalQAChain_Chains implements INode { constructor() { this.label = 'Conversational Retrieval QA Chain' this.name = 'conversationalRetrievalQAChain' + this.version = 1.0 this.type = 'ConversationalRetrievalQAChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/LLMChain/LLMChain.ts b/packages/components/nodes/chains/LLMChain/LLMChain.ts index eca56d31..cf9e4bc9 100644 --- a/packages/components/nodes/chains/LLMChain/LLMChain.ts +++ b/packages/components/nodes/chains/LLMChain/LLMChain.ts @@ -7,6 +7,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class LLMChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -18,6 +19,7 @@ class LLMChain_Chains implements INode { constructor() { this.label = 'LLM Chain' this.name = 'llmChain' + this.version = 1.0 this.type = 'LLMChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts b/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts index e9783639..0d137714 100644 --- a/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts +++ b/packages/components/nodes/chains/MultiPromptChain/MultiPromptChain.ts @@ -7,6 +7,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class MultiPromptChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -17,6 +18,7 @@ class MultiPromptChain_Chains implements INode { constructor() { this.label = 'Multi Prompt Chain' this.name = 'multiPromptChain' + this.version = 1.0 this.type = 'MultiPromptChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts b/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts index a1947faa..6d150647 100644 --- a/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts +++ b/packages/components/nodes/chains/MultiRetrievalQAChain/MultiRetrievalQAChain.ts @@ -7,6 +7,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class MultiRetrievalQAChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -17,6 +18,7 @@ class MultiRetrievalQAChain_Chains implements INode { constructor() { this.label = 'Multi Retrieval QA Chain' this.name = 'multiRetrievalQAChain' + this.version = 1.0 this.type = 'MultiRetrievalQAChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts b/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts index eaf5a0a9..935866ca 100644 --- a/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts +++ b/packages/components/nodes/chains/RetrievalQAChain/RetrievalQAChain.ts @@ -1,6 +1,6 @@ import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { RetrievalQAChain } from 'langchain/chains' -import { BaseRetriever } from 'langchain/schema' +import { BaseRetriever } from 'langchain/schema/retriever' import { getBaseClasses } from '../../../src/utils' import { BaseLanguageModel } from 'langchain/base_language' import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler' @@ -8,6 +8,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class RetrievalQAChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -18,6 +19,7 @@ class RetrievalQAChain_Chains implements INode { constructor() { this.label = 'Retrieval QA Chain' this.name = 'retrievalQAChain' + this.version = 1.0 this.type = 'RetrievalQAChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/SqlDatabaseChain/SqlDatabaseChain.ts b/packages/components/nodes/chains/SqlDatabaseChain/SqlDatabaseChain.ts index 5817264d..9416371b 100644 --- a/packages/components/nodes/chains/SqlDatabaseChain/SqlDatabaseChain.ts +++ b/packages/components/nodes/chains/SqlDatabaseChain/SqlDatabaseChain.ts @@ -9,6 +9,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class SqlDatabaseChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -19,6 +20,7 @@ class SqlDatabaseChain_Chains implements INode { constructor() { this.label = 'Sql Database Chain' this.name = 'sqlDatabaseChain' + this.version = 1.0 this.type = 'SqlDatabaseChain' this.icon = 'sqlchain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts b/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts index abe7aab3..03811682 100644 --- a/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts +++ b/packages/components/nodes/chains/VectorDBQAChain/VectorDBQAChain.ts @@ -8,6 +8,7 @@ import { ConsoleCallbackHandler, CustomChainHandler } from '../../../src/handler class VectorDBQAChain_Chains implements INode { label: string name: string + version: number type: string icon: string category: string @@ -18,6 +19,7 @@ class VectorDBQAChain_Chains implements INode { constructor() { this.label = 'VectorDB QA Chain' this.name = 'vectorDBQAChain' + this.version = 1.0 this.type = 'VectorDBQAChain' this.icon = 'chain.svg' this.category = 'Chains' diff --git a/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg b/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg index 51eb6253..47ad8c44 100644 --- a/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg +++ b/packages/components/nodes/chatmodels/AzureChatOpenAI/Azure.svg @@ -1,5 +1 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureChatOpenAI.ts b/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureChatOpenAI.ts index 2cdb505d..90f430f0 100644 --- a/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureChatOpenAI.ts +++ b/packages/components/nodes/chatmodels/AzureChatOpenAI/AzureChatOpenAI.ts @@ -1,32 +1,36 @@ import { OpenAIBaseInput } from 'langchain/dist/types/openai-types' -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { AzureOpenAIInput, ChatOpenAI } from 'langchain/chat_models/openai' class AzureChatOpenAI_ChatModels implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Azure ChatOpenAI' this.name = 'azureChatOpenAI' + this.version = 1.0 this.type = 'AzureChatOpenAI' this.icon = 'Azure.svg' this.category = 'Chat Models' this.description = 'Wrapper around Azure OpenAI large language models that use the Chat endpoint' this.baseClasses = [this.type, ...getBaseClasses(ChatOpenAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['azureOpenAIApi'] + } this.inputs = [ - { - label: 'Azure OpenAI Api Key', - name: 'azureOpenAIApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -56,33 +60,15 @@ class AzureChatOpenAI_ChatModels implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.9, optional: true }, - { - label: 'Azure OpenAI Api Instance Name', - name: 'azureOpenAIApiInstanceName', - type: 'string', - placeholder: 'YOUR-INSTANCE-NAME' - }, - { - label: 'Azure OpenAI Api Deployment Name', - name: 'azureOpenAIApiDeploymentName', - type: 'string', - placeholder: 'YOUR-DEPLOYMENT-NAME' - }, - { - label: 'Azure OpenAI Api Version', - name: 'azureOpenAIApiVersion', - type: 'string', - placeholder: '2023-06-01-preview', - description: - 'Description of Supported API Versions. Please refer examples' - }, { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -90,6 +76,7 @@ class AzureChatOpenAI_ChatModels implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -97,6 +84,7 @@ class AzureChatOpenAI_ChatModels implements INode { label: 'Presence Penalty', name: 'presencePenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -104,25 +92,28 @@ class AzureChatOpenAI_ChatModels implements INode { label: 'Timeout', name: 'timeout', type: 'number', + step: 1, optional: true, additionalParams: true } ] } - async init(nodeData: INodeData): Promise { - const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const modelName = nodeData.inputs?.modelName as string const temperature = nodeData.inputs?.temperature as string - const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string - const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string - const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string const maxTokens = nodeData.inputs?.maxTokens as string const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string const presencePenalty = nodeData.inputs?.presencePenalty as string const timeout = nodeData.inputs?.timeout as string const streaming = nodeData.inputs?.streaming as boolean + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData) + const azureOpenAIApiInstanceName = getCredentialParam('azureOpenAIApiInstanceName', credentialData, nodeData) + const azureOpenAIApiDeploymentName = getCredentialParam('azureOpenAIApiDeploymentName', credentialData, nodeData) + const azureOpenAIApiVersion = getCredentialParam('azureOpenAIApiVersion', credentialData, nodeData) + const obj: Partial & Partial = { temperature: parseFloat(temperature), modelName, @@ -134,8 +125,8 @@ class AzureChatOpenAI_ChatModels implements INode { } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) - if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) + if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty) if (timeout) obj.timeout = parseInt(timeout, 10) const model = new ChatOpenAI(obj) diff --git a/packages/components/nodes/chatmodels/ChatAnthropic/ChatAnthropic.ts b/packages/components/nodes/chatmodels/ChatAnthropic/ChatAnthropic.ts index b65c7bd8..12a33d99 100644 --- a/packages/components/nodes/chatmodels/ChatAnthropic/ChatAnthropic.ts +++ b/packages/components/nodes/chatmodels/ChatAnthropic/ChatAnthropic.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { AnthropicInput, ChatAnthropic } from 'langchain/chat_models/anthropic' class ChatAnthropic_ChatModels implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'ChatAnthropic' this.name = 'chatAnthropic' + this.version = 1.0 this.type = 'ChatAnthropic' this.icon = 'chatAnthropic.png' this.category = 'Chat Models' this.description = 'Wrapper around ChatAnthropic large language models that use the Chat endpoint' this.baseClasses = [this.type, ...getBaseClasses(ChatAnthropic)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['anthropicApi'] + } this.inputs = [ - { - label: 'ChatAnthropic Api Key', - name: 'anthropicApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -86,13 +90,14 @@ class ChatAnthropic_ChatModels implements INode { name: 'claude-instant-v1.1-100k' } ], - default: 'claude-v1', + default: 'claude-2', optional: true }, { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.9, optional: true }, @@ -100,6 +105,7 @@ class ChatAnthropic_ChatModels implements INode { label: 'Max Tokens', name: 'maxTokensToSample', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -107,6 +113,7 @@ class ChatAnthropic_ChatModels implements INode { label: 'Top P', name: 'topP', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -114,21 +121,24 @@ class ChatAnthropic_ChatModels implements INode { label: 'Top K', name: 'topK', type: 'number', + step: 0.1, optional: true, additionalParams: true } ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const temperature = nodeData.inputs?.temperature as string const modelName = nodeData.inputs?.modelName as string - const anthropicApiKey = nodeData.inputs?.anthropicApiKey as string const maxTokensToSample = nodeData.inputs?.maxTokensToSample as string const topP = nodeData.inputs?.topP as string const topK = nodeData.inputs?.topK as string const streaming = nodeData.inputs?.streaming as boolean + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const anthropicApiKey = getCredentialParam('anthropicApiKey', credentialData, nodeData) + const obj: Partial & { anthropicApiKey?: string } = { temperature: parseFloat(temperature), modelName, @@ -137,8 +147,8 @@ class ChatAnthropic_ChatModels implements INode { } if (maxTokensToSample) obj.maxTokensToSample = parseInt(maxTokensToSample, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (topK) obj.topK = parseInt(topK, 10) + if (topP) obj.topP = parseFloat(topP) + if (topK) obj.topK = parseFloat(topK) const model = new ChatAnthropic(obj) return model diff --git a/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts b/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts index d92dd1e0..ee55c7bb 100644 --- a/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts +++ b/packages/components/nodes/chatmodels/ChatHuggingFace/ChatHuggingFace.ts @@ -1,41 +1,56 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { HFInput, HuggingFaceInference } from './core' class ChatHuggingFace_ChatModels implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'ChatHuggingFace' this.name = 'chatHuggingFace' + this.version = 1.0 this.type = 'ChatHuggingFace' this.icon = 'huggingface.png' this.category = 'Chat Models' this.description = 'Wrapper around HuggingFace large language models' this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(HuggingFaceInference)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['huggingFaceApi'] + } this.inputs = [ { label: 'Model', name: 'model', type: 'string', - placeholder: 'gpt2' + description: 'If using own inference endpoint, leave this blank', + placeholder: 'gpt2', + optional: true }, { - label: 'HuggingFace Api Key', - name: 'apiKey', - type: 'password' + label: 'Endpoint', + name: 'endpoint', + type: 'string', + placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2', + description: 'Using your own inference endpoint', + optional: true }, { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, description: 'Temperature parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -44,6 +59,7 @@ class ChatHuggingFace_ChatModels implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, description: 'Max Tokens parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -52,6 +68,7 @@ class ChatHuggingFace_ChatModels implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, description: 'Top Probability parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -60,6 +77,7 @@ class ChatHuggingFace_ChatModels implements INode { label: 'Top K', name: 'hfTopK', type: 'number', + step: 0.1, description: 'Top K parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -68,25 +86,16 @@ class ChatHuggingFace_ChatModels implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, description: 'Frequency Penalty parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true - }, - { - label: 'Endpoint', - name: 'endpoint', - type: 'string', - placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2', - description: 'Using your own inference endpoint', - optional: true, - additionalParams: true } ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const model = nodeData.inputs?.model as string - const apiKey = nodeData.inputs?.apiKey as string const temperature = nodeData.inputs?.temperature as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string @@ -94,16 +103,19 @@ class ChatHuggingFace_ChatModels implements INode { const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string const endpoint = nodeData.inputs?.endpoint as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData) + const obj: Partial = { model, - apiKey + apiKey: huggingFaceApiKey } if (temperature) obj.temperature = parseFloat(temperature) if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (hfTopK) obj.topK = parseInt(hfTopK, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) + if (topP) obj.topP = parseFloat(topP) + if (hfTopK) obj.topK = parseFloat(hfTopK) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) if (endpoint) obj.endpoint = endpoint const huggingFace = new HuggingFaceInference(obj) diff --git a/packages/components/nodes/chatmodels/ChatLocalAI/ChatLocalAI.ts b/packages/components/nodes/chatmodels/ChatLocalAI/ChatLocalAI.ts index c5860b24..a6ddfae4 100644 --- a/packages/components/nodes/chatmodels/ChatLocalAI/ChatLocalAI.ts +++ b/packages/components/nodes/chatmodels/ChatLocalAI/ChatLocalAI.ts @@ -6,6 +6,7 @@ import { OpenAIChatInput } from 'langchain/chat_models/openai' class ChatLocalAI_ChatModels implements INode { label: string name: string + version: number type: string icon: string category: string @@ -16,6 +17,7 @@ class ChatLocalAI_ChatModels implements INode { constructor() { this.label = 'ChatLocalAI' this.name = 'chatLocalAI' + this.version = 1.0 this.type = 'ChatLocalAI' this.icon = 'localai.png' this.category = 'Chat Models' @@ -38,6 +40,7 @@ class ChatLocalAI_ChatModels implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.9, optional: true }, @@ -45,6 +48,7 @@ class ChatLocalAI_ChatModels implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -52,6 +56,7 @@ class ChatLocalAI_ChatModels implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -59,6 +64,7 @@ class ChatLocalAI_ChatModels implements INode { label: 'Timeout', name: 'timeout', type: 'number', + step: 1, optional: true, additionalParams: true } @@ -80,7 +86,7 @@ class ChatLocalAI_ChatModels implements INode { } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) + if (topP) obj.topP = parseFloat(topP) if (timeout) obj.timeout = parseInt(timeout, 10) const model = new OpenAIChat(obj, { basePath }) diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts index 955563ff..9512da66 100644 --- a/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts +++ b/packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { ChatOpenAI, OpenAIChatInput } from 'langchain/chat_models/openai' class ChatOpenAI_ChatModels implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'ChatOpenAI' this.name = 'chatOpenAI' + this.version = 1.0 this.type = 'ChatOpenAI' this.icon = 'openai.png' this.category = 'Chat Models' this.description = 'Wrapper around OpenAI large language models that use the Chat endpoint' this.baseClasses = [this.type, ...getBaseClasses(ChatOpenAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['openAIApi'] + } this.inputs = [ - { - label: 'OpenAI Api Key', - name: 'openAIApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -71,6 +75,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.9, optional: true }, @@ -78,6 +83,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -85,6 +91,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -92,6 +99,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -99,6 +107,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Presence Penalty', name: 'presencePenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -106,6 +115,7 @@ class ChatOpenAI_ChatModels implements INode { label: 'Timeout', name: 'timeout', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -119,10 +129,9 @@ class ChatOpenAI_ChatModels implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const temperature = nodeData.inputs?.temperature as string const modelName = nodeData.inputs?.modelName as string - const openAIApiKey = nodeData.inputs?.openAIApiKey as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string @@ -131,6 +140,9 @@ class ChatOpenAI_ChatModels implements INode { const streaming = nodeData.inputs?.streaming as boolean const basePath = nodeData.inputs?.basepath as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData) + const obj: Partial & { openAIApiKey?: string } = { temperature: parseFloat(temperature), modelName, @@ -139,9 +151,9 @@ class ChatOpenAI_ChatModels implements INode { } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) - if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10) + if (topP) obj.topP = parseFloat(topP) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) + if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty) if (timeout) obj.timeout = parseInt(timeout, 10) const model = new ChatOpenAI(obj, { diff --git a/packages/components/nodes/documentloaders/API/APILoader.ts b/packages/components/nodes/documentloaders/API/APILoader.ts index 30fa31d7..3de6d636 100644 --- a/packages/components/nodes/documentloaders/API/APILoader.ts +++ b/packages/components/nodes/documentloaders/API/APILoader.ts @@ -7,6 +7,7 @@ import axios, { AxiosRequestConfig } from 'axios' class API_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class API_DocumentLoaders implements INode { constructor() { this.label = 'API Loader' this.name = 'apiLoader' + this.version = 1.0 this.type = 'Document' this.icon = 'api-loader.png' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Airtable/Airtable.ts b/packages/components/nodes/documentloaders/Airtable/Airtable.ts index 9607693a..70d0c674 100644 --- a/packages/components/nodes/documentloaders/Airtable/Airtable.ts +++ b/packages/components/nodes/documentloaders/Airtable/Airtable.ts @@ -3,25 +3,35 @@ import { TextSplitter } from 'langchain/text_splitter' import { BaseDocumentLoader } from 'langchain/document_loaders/base' import { Document } from 'langchain/document' import axios from 'axios' +import { getCredentialData, getCredentialParam } from '../../../src/utils' class Airtable_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 = 'Airtable' this.name = 'airtable' + this.version = 1.0 this.type = 'Document' this.icon = 'airtable.svg' this.category = 'Document Loaders' this.description = `Load data from Airtable table` this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['airtableApi'] + } this.inputs = [ { label: 'Text Splitter', @@ -29,13 +39,6 @@ class Airtable_DocumentLoaders implements INode { type: 'TextSplitter', optional: true }, - { - label: 'Personal Access Token', - name: 'accessToken', - type: 'password', - description: - 'Get personal access token from official guide' - }, { label: 'Base Id', name: 'baseId', @@ -65,7 +68,6 @@ class Airtable_DocumentLoaders implements INode { name: 'limit', type: 'number', default: 100, - step: 1, additionalParams: true, description: 'Number of results to return' }, @@ -78,8 +80,7 @@ class Airtable_DocumentLoaders implements INode { } ] } - async init(nodeData: INodeData): Promise { - const accessToken = nodeData.inputs?.accessToken as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const baseId = nodeData.inputs?.baseId as string const tableId = nodeData.inputs?.tableId as string const returnAll = nodeData.inputs?.returnAll as boolean @@ -87,7 +88,10 @@ class Airtable_DocumentLoaders implements INode { const textSplitter = nodeData.inputs?.textSplitter as TextSplitter const metadata = nodeData.inputs?.metadata - const options: AirtableLoaderParams = { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessToken = getCredentialParam('accessToken', credentialData, nodeData) + + const airtableOptions: AirtableLoaderParams = { baseId, tableId, returnAll, @@ -95,7 +99,7 @@ class Airtable_DocumentLoaders implements INode { limit: limit ? parseInt(limit, 10) : 100 } - const loader = new AirtableLoader(options) + const loader = new AirtableLoader(airtableOptions) let docs = [] diff --git a/packages/components/nodes/documentloaders/Cheerio/Cheerio.ts b/packages/components/nodes/documentloaders/Cheerio/Cheerio.ts index b93a8685..310aa9e6 100644 --- a/packages/components/nodes/documentloaders/Cheerio/Cheerio.ts +++ b/packages/components/nodes/documentloaders/Cheerio/Cheerio.ts @@ -7,6 +7,7 @@ import { webCrawl, xmlScrape } from '../../../src' class Cheerio_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class Cheerio_DocumentLoaders implements INode { constructor() { this.label = 'Cheerio Web Scraper' this.name = 'cheerioWebScraper' + this.version = 1.0 this.type = 'Document' this.icon = 'cheerio.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Confluence/Confluence.ts b/packages/components/nodes/documentloaders/Confluence/Confluence.ts index 9a69be14..a17c41b9 100644 --- a/packages/components/nodes/documentloaders/Confluence/Confluence.ts +++ b/packages/components/nodes/documentloaders/Confluence/Confluence.ts @@ -1,25 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { TextSplitter } from 'langchain/text_splitter' import { ConfluencePagesLoader, ConfluencePagesLoaderParams } from 'langchain/document_loaders/web/confluence' +import { getCredentialData, getCredentialParam } from '../../../src' class Confluence_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 = 'Confluence' this.name = 'confluence' + this.version = 1.0 this.type = 'Document' this.icon = 'confluence.png' this.category = 'Document Loaders' this.description = `Load data from a Confluence Document` this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['confluenceApi'] + } this.inputs = [ { label: 'Text Splitter', @@ -27,18 +37,6 @@ class Confluence_DocumentLoaders implements INode { type: 'TextSplitter', optional: true }, - { - label: 'Username', - name: 'username', - type: 'string', - placeholder: '' - }, - { - label: 'Access Token', - name: 'accessToken', - type: 'password', - placeholder: '' - }, { label: 'Base URL', name: 'baseUrl', @@ -49,7 +47,9 @@ class Confluence_DocumentLoaders implements INode { label: 'Space Key', name: 'spaceKey', type: 'string', - placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE' + placeholder: '~EXAMPLE362906de5d343d49dcdbae5dEXAMPLE', + description: + 'Refer to official guide on how to get Confluence Space Key' }, { label: 'Limit', @@ -68,16 +68,18 @@ class Confluence_DocumentLoaders implements INode { ] } - async init(nodeData: INodeData): Promise { - const username = nodeData.inputs?.username as string - const accessToken = nodeData.inputs?.accessToken as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const spaceKey = nodeData.inputs?.spaceKey as string const baseUrl = nodeData.inputs?.baseUrl as string const limit = nodeData.inputs?.limit as number const textSplitter = nodeData.inputs?.textSplitter as TextSplitter const metadata = nodeData.inputs?.metadata - const options: ConfluencePagesLoaderParams = { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessToken = getCredentialParam('accessToken', credentialData, nodeData) + const username = getCredentialParam('username', credentialData, nodeData) + + const confluenceOptions: ConfluencePagesLoaderParams = { username, accessToken, baseUrl, @@ -85,7 +87,7 @@ class Confluence_DocumentLoaders implements INode { limit } - const loader = new ConfluencePagesLoader(options) + const loader = new ConfluencePagesLoader(confluenceOptions) let docs = [] diff --git a/packages/components/nodes/documentloaders/Csv/Csv.ts b/packages/components/nodes/documentloaders/Csv/Csv.ts index f4b36ad0..750490b7 100644 --- a/packages/components/nodes/documentloaders/Csv/Csv.ts +++ b/packages/components/nodes/documentloaders/Csv/Csv.ts @@ -5,6 +5,7 @@ import { CSVLoader } from 'langchain/document_loaders/fs/csv' class Csv_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Csv_DocumentLoaders implements INode { constructor() { this.label = 'Csv File' this.name = 'csvFile' + this.version = 1.0 this.type = 'Document' this.icon = 'Csv.png' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Docx/Docx.ts b/packages/components/nodes/documentloaders/Docx/Docx.ts index e27991a5..41922775 100644 --- a/packages/components/nodes/documentloaders/Docx/Docx.ts +++ b/packages/components/nodes/documentloaders/Docx/Docx.ts @@ -5,6 +5,7 @@ import { DocxLoader } from 'langchain/document_loaders/fs/docx' class Docx_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Docx_DocumentLoaders implements INode { constructor() { this.label = 'Docx File' this.name = 'docxFile' + this.version = 1.0 this.type = 'Document' this.icon = 'Docx.png' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Figma/Figma.ts b/packages/components/nodes/documentloaders/Figma/Figma.ts index 388c4ee0..3d313044 100644 --- a/packages/components/nodes/documentloaders/Figma/Figma.ts +++ b/packages/components/nodes/documentloaders/Figma/Figma.ts @@ -1,42 +1,50 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { getCredentialData, getCredentialParam } from '../../../src' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { FigmaFileLoader, FigmaLoaderParams } from 'langchain/document_loaders/web/figma' class Figma_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 = 'Figma' this.name = 'figma' + this.version = 1.0 this.type = 'Document' - this.icon = 'figma.png' + this.icon = 'figma.svg' this.category = 'Document Loaders' this.description = 'Load data from a Figma file' this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['figmaApi'] + } this.inputs = [ - { - label: 'Access Token', - name: 'accessToken', - type: 'password', - placeholder: '' - }, { label: 'File Key', name: 'fileKey', type: 'string', - placeholder: 'key' + placeholder: 'key', + description: + 'The file key can be read from any Figma file URL: https://www.figma.com/file/:key/:title. For example, in https://www.figma.com/file/12345/Website, the file key is 12345' }, { label: 'Node IDs', name: 'nodeIds', type: 'string', - placeholder: '0, 1, 2' + placeholder: '0, 1, 2', + description: + 'A list of Node IDs, seperated by comma. Refer to official guide on how to get Node IDs' }, { label: 'Recursive', @@ -60,18 +68,20 @@ class Figma_DocumentLoaders implements INode { ] } - async init(nodeData: INodeData): Promise { - const accessToken = nodeData.inputs?.accessToken as string - const nodeIds = (nodeData.inputs?.nodeIds as string)?.split(',') || [] + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const nodeIds = (nodeData.inputs?.nodeIds as string)?.trim().split(',') || [] const fileKey = nodeData.inputs?.fileKey as string - const options: FigmaLoaderParams = { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessToken = getCredentialParam('accessToken', credentialData, nodeData) + + const figmaOptions: FigmaLoaderParams = { accessToken, nodeIds, fileKey } - const loader = new FigmaFileLoader(options) + const loader = new FigmaFileLoader(figmaOptions) const docs = await loader.load() return docs diff --git a/packages/components/nodes/documentloaders/Figma/figma.png b/packages/components/nodes/documentloaders/Figma/figma.png deleted file mode 100644 index 72372ddf..00000000 Binary files a/packages/components/nodes/documentloaders/Figma/figma.png and /dev/null differ diff --git a/packages/components/nodes/documentloaders/Figma/figma.svg b/packages/components/nodes/documentloaders/Figma/figma.svg new file mode 100644 index 00000000..c4f85674 --- /dev/null +++ b/packages/components/nodes/documentloaders/Figma/figma.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/components/nodes/documentloaders/Folder/Folder.ts b/packages/components/nodes/documentloaders/Folder/Folder.ts index 2290133e..83bffd18 100644 --- a/packages/components/nodes/documentloaders/Folder/Folder.ts +++ b/packages/components/nodes/documentloaders/Folder/Folder.ts @@ -10,6 +10,7 @@ import { DocxLoader } from 'langchain/document_loaders/fs/docx' class Folder_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -20,6 +21,7 @@ class Folder_DocumentLoaders implements INode { constructor() { this.label = 'Folder with Files' this.name = 'folderFiles' + this.version = 1.0 this.type = 'Document' this.icon = 'folder.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Gitbook/Gitbook.ts b/packages/components/nodes/documentloaders/Gitbook/Gitbook.ts index 933fa9d4..181fa48d 100644 --- a/packages/components/nodes/documentloaders/Gitbook/Gitbook.ts +++ b/packages/components/nodes/documentloaders/Gitbook/Gitbook.ts @@ -5,6 +5,7 @@ import { GitbookLoader } from 'langchain/document_loaders/web/gitbook' class Gitbook_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Gitbook_DocumentLoaders implements INode { constructor() { this.label = 'GitBook' this.name = 'gitbook' + this.version = 1.0 this.type = 'Document' this.icon = 'gitbook.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Github/Github.ts b/packages/components/nodes/documentloaders/Github/Github.ts index bbaad3cb..079bffb0 100644 --- a/packages/components/nodes/documentloaders/Github/Github.ts +++ b/packages/components/nodes/documentloaders/Github/Github.ts @@ -1,25 +1,37 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { TextSplitter } from 'langchain/text_splitter' import { GithubRepoLoader, GithubRepoLoaderParams } from 'langchain/document_loaders/web/github' +import { getCredentialData, getCredentialParam } from '../../../src' class Github_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 = 'Github' this.name = 'github' + this.version = 1.0 this.type = 'Document' this.icon = 'github.png' this.category = 'Document Loaders' this.description = `Load data from a GitHub repository` this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed when accessing private repo', + optional: true, + credentialNames: ['githubApi'] + } this.inputs = [ { label: 'Repo Link', @@ -33,13 +45,6 @@ class Github_DocumentLoaders implements INode { type: 'string', default: 'main' }, - { - label: 'Access Token', - name: 'accessToken', - type: 'password', - placeholder: '', - optional: true - }, { label: 'Recursive', name: 'recursive', @@ -62,23 +67,25 @@ class Github_DocumentLoaders implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const repoLink = nodeData.inputs?.repoLink as string const branch = nodeData.inputs?.branch as string const recursive = nodeData.inputs?.recursive as boolean - const accessToken = nodeData.inputs?.accessToken as string const textSplitter = nodeData.inputs?.textSplitter as TextSplitter const metadata = nodeData.inputs?.metadata - const options: GithubRepoLoaderParams = { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessToken = getCredentialParam('accessToken', credentialData, nodeData) + + const githubOptions: GithubRepoLoaderParams = { branch, recursive, unknown: 'warn' } - if (accessToken) options.accessToken = accessToken + if (accessToken) githubOptions.accessToken = accessToken - const loader = new GithubRepoLoader(repoLink, options) + const loader = new GithubRepoLoader(repoLink, githubOptions) const docs = textSplitter ? await loader.loadAndSplit(textSplitter) : await loader.load() if (metadata) { diff --git a/packages/components/nodes/documentloaders/Json/Json.ts b/packages/components/nodes/documentloaders/Json/Json.ts index 9177df5c..43051251 100644 --- a/packages/components/nodes/documentloaders/Json/Json.ts +++ b/packages/components/nodes/documentloaders/Json/Json.ts @@ -5,6 +5,7 @@ import { JSONLoader } from 'langchain/document_loaders/fs/json' class Json_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Json_DocumentLoaders implements INode { constructor() { this.label = 'Json File' this.name = 'jsonFile' + this.version = 1.0 this.type = 'Document' this.icon = 'json.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts b/packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts index 4af8c2ce..fcc2fae9 100644 --- a/packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts +++ b/packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts @@ -5,6 +5,7 @@ import { JSONLinesLoader } from 'langchain/document_loaders/fs/json' class Jsonlines_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Jsonlines_DocumentLoaders implements INode { constructor() { this.label = 'Json Lines File' this.name = 'jsonlinesFile' + this.version = 1.0 this.type = 'Document' this.icon = 'jsonlines.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Notion/NotionDB.ts b/packages/components/nodes/documentloaders/Notion/NotionDB.ts index 111e3718..74879dd2 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionDB.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionDB.ts @@ -1,25 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { TextSplitter } from 'langchain/text_splitter' import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi' +import { getCredentialData, getCredentialParam } from '../../../src' class NotionDB_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 = 'Notion Database' this.name = 'notionDB' + this.version = 1.0 this.type = 'Document' this.icon = 'notion.png' this.category = 'Document Loaders' this.description = 'Load data from Notion Database (each row is a separate document with all properties as metadata)' this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['notionApi'] + } this.inputs = [ { label: 'Text Splitter', @@ -27,13 +37,6 @@ class NotionDB_DocumentLoaders implements INode { type: 'TextSplitter', optional: true }, - { - label: 'Notion Integration Token', - name: 'notionIntegrationToken', - type: 'password', - description: - 'You can find integration token here' - }, { label: 'Notion Database Id', name: 'databaseId', @@ -50,11 +53,13 @@ class NotionDB_DocumentLoaders implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const textSplitter = nodeData.inputs?.textSplitter as TextSplitter const databaseId = nodeData.inputs?.databaseId as string const metadata = nodeData.inputs?.metadata - const notionIntegrationToken = nodeData.inputs?.notionIntegrationToken as string + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData) const obj: NotionAPILoaderOptions = { clientOptions: { diff --git a/packages/components/nodes/documentloaders/Notion/NotionFolder.ts b/packages/components/nodes/documentloaders/Notion/NotionFolder.ts index 11b8165b..8b8254a4 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionFolder.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionFolder.ts @@ -5,6 +5,7 @@ import { NotionLoader } from 'langchain/document_loaders/fs/notion' class NotionFolder_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class NotionFolder_DocumentLoaders implements INode { constructor() { this.label = 'Notion Folder' this.name = 'notionFolder' + this.version = 1.0 this.type = 'Document' this.icon = 'notion.png' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Notion/NotionPage.ts b/packages/components/nodes/documentloaders/Notion/NotionPage.ts index 37c43d55..b45067ab 100644 --- a/packages/components/nodes/documentloaders/Notion/NotionPage.ts +++ b/packages/components/nodes/documentloaders/Notion/NotionPage.ts @@ -1,25 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { TextSplitter } from 'langchain/text_splitter' import { NotionAPILoader, NotionAPILoaderOptions } from 'langchain/document_loaders/web/notionapi' +import { getCredentialData, getCredentialParam } from '../../../src' class NotionPage_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 = 'Notion Page' this.name = 'notionPage' + this.version = 1.0 this.type = 'Document' this.icon = 'notion.png' this.category = 'Document Loaders' this.description = 'Load data from Notion Page (including child pages all as separate documents)' this.baseClasses = [this.type] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['notionApi'] + } this.inputs = [ { label: 'Text Splitter', @@ -27,13 +37,6 @@ class NotionPage_DocumentLoaders implements INode { type: 'TextSplitter', optional: true }, - { - label: 'Notion Integration Token', - name: 'notionIntegrationToken', - type: 'password', - description: - 'You can find integration token here' - }, { label: 'Notion Page Id', name: 'pageId', @@ -51,11 +54,13 @@ class NotionPage_DocumentLoaders implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const textSplitter = nodeData.inputs?.textSplitter as TextSplitter const pageId = nodeData.inputs?.pageId as string const metadata = nodeData.inputs?.metadata - const notionIntegrationToken = nodeData.inputs?.notionIntegrationToken as string + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const notionIntegrationToken = getCredentialParam('notionIntegrationToken', credentialData, nodeData) const obj: NotionAPILoaderOptions = { clientOptions: { diff --git a/packages/components/nodes/documentloaders/Pdf/Pdf.ts b/packages/components/nodes/documentloaders/Pdf/Pdf.ts index ddb7edb8..a9f6ab23 100644 --- a/packages/components/nodes/documentloaders/Pdf/Pdf.ts +++ b/packages/components/nodes/documentloaders/Pdf/Pdf.ts @@ -5,6 +5,7 @@ import { PDFLoader } from 'langchain/document_loaders/fs/pdf' class Pdf_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Pdf_DocumentLoaders implements INode { constructor() { this.label = 'Pdf File' this.name = 'pdfFile' + this.version = 1.0 this.type = 'Document' this.icon = 'pdf.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Playwright/Playwright.ts b/packages/components/nodes/documentloaders/Playwright/Playwright.ts index 73a3e290..3399574d 100644 --- a/packages/components/nodes/documentloaders/Playwright/Playwright.ts +++ b/packages/components/nodes/documentloaders/Playwright/Playwright.ts @@ -7,6 +7,7 @@ import { webCrawl, xmlScrape } from '../../../src' class Playwright_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class Playwright_DocumentLoaders implements INode { constructor() { this.label = 'Playwright Web Scraper' this.name = 'playwrightWebScraper' + this.version = 1.0 this.type = 'Document' this.icon = 'playwright.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts b/packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts index 014845d2..ea6280db 100644 --- a/packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts +++ b/packages/components/nodes/documentloaders/Puppeteer/Puppeteer.ts @@ -7,6 +7,7 @@ import { webCrawl, xmlScrape } from '../../../src' class Puppeteer_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class Puppeteer_DocumentLoaders implements INode { constructor() { this.label = 'Puppeteer Web Scraper' this.name = 'puppeteerWebScraper' + this.version = 1.0 this.type = 'Document' this.icon = 'puppeteer.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Subtitles/Subtitles.ts b/packages/components/nodes/documentloaders/Subtitles/Subtitles.ts index 0f60e151..f85898b3 100644 --- a/packages/components/nodes/documentloaders/Subtitles/Subtitles.ts +++ b/packages/components/nodes/documentloaders/Subtitles/Subtitles.ts @@ -5,6 +5,7 @@ import { SRTLoader } from 'langchain/document_loaders/fs/srt' class Subtitles_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Subtitles_DocumentLoaders implements INode { constructor() { this.label = 'Subtitles File' this.name = 'subtitlesFile' + this.version = 1.0 this.type = 'Document' this.icon = 'subtitlesFile.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/documentloaders/Text/Text.ts b/packages/components/nodes/documentloaders/Text/Text.ts index 63e7e0e2..dacf087c 100644 --- a/packages/components/nodes/documentloaders/Text/Text.ts +++ b/packages/components/nodes/documentloaders/Text/Text.ts @@ -5,6 +5,7 @@ import { TextLoader } from 'langchain/document_loaders/fs/text' class Text_DocumentLoaders implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class Text_DocumentLoaders implements INode { constructor() { this.label = 'Text File' this.name = 'textFile' + this.version = 1.0 this.type = 'Document' this.icon = 'textFile.svg' this.category = 'Document Loaders' diff --git a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg index 51eb6253..47ad8c44 100644 --- a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg +++ b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/Azure.svg @@ -1,5 +1 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts index 4133539e..b70caa4c 100644 --- a/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts +++ b/packages/components/nodes/embeddings/AzureOpenAIEmbedding/AzureOpenAIEmbedding.ts @@ -1,52 +1,36 @@ import { AzureOpenAIInput } from 'langchain/chat_models/openai' -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai' class AzureOpenAIEmbedding_Embeddings implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Azure OpenAI Embeddings' this.name = 'azureOpenAIEmbeddings' + this.version = 1.0 this.type = 'AzureOpenAIEmbeddings' this.icon = 'Azure.svg' this.category = 'Embeddings' this.description = 'Azure OpenAI API to generate embeddings for a given text' this.baseClasses = [this.type, ...getBaseClasses(OpenAIEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['azureOpenAIApi'] + } this.inputs = [ - { - label: 'Azure OpenAI Api Key', - name: 'azureOpenAIApiKey', - type: 'password' - }, - { - label: 'Azure OpenAI Api Instance Name', - name: 'azureOpenAIApiInstanceName', - type: 'string', - placeholder: 'YOUR-INSTANCE-NAME' - }, - { - label: 'Azure OpenAI Api Deployment Name', - name: 'azureOpenAIApiDeploymentName', - type: 'string', - placeholder: 'YOUR-DEPLOYMENT-NAME' - }, - { - label: 'Azure OpenAI Api Version', - name: 'azureOpenAIApiVersion', - type: 'string', - placeholder: '2023-03-15-preview', - description: - 'Description of Supported API Versions. Please refer examples' - }, { label: 'Batch Size', name: 'batchSize', @@ -65,14 +49,16 @@ class AzureOpenAIEmbedding_Embeddings implements INode { ] } - async init(nodeData: INodeData): Promise { - const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string - const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string - const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string - const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const batchSize = nodeData.inputs?.batchSize as string const timeout = nodeData.inputs?.timeout as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData) + const azureOpenAIApiInstanceName = getCredentialParam('azureOpenAIApiInstanceName', credentialData, nodeData) + const azureOpenAIApiDeploymentName = getCredentialParam('azureOpenAIApiDeploymentName', credentialData, nodeData) + const azureOpenAIApiVersion = getCredentialParam('azureOpenAIApiVersion', credentialData, nodeData) + const obj: Partial & Partial = { azureOpenAIApiKey, azureOpenAIApiInstanceName, diff --git a/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts b/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts index 344713a4..b42a0357 100644 --- a/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts +++ b/packages/components/nodes/embeddings/CohereEmbedding/CohereEmbedding.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { CohereEmbeddings, CohereEmbeddingsParams } from 'langchain/embeddings/cohere' class CohereEmbedding_Embeddings implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Cohere Embeddings' this.name = 'cohereEmbeddings' + this.version = 1.0 this.type = 'CohereEmbeddings' this.icon = 'cohere.png' this.category = 'Embeddings' this.description = 'Cohere API to generate embeddings for a given text' this.baseClasses = [this.type, ...getBaseClasses(CohereEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['cohereApi'] + } this.inputs = [ - { - label: 'Cohere API Key', - name: 'cohereApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -50,12 +54,14 @@ class CohereEmbedding_Embeddings implements INode { ] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.cohereApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const modelName = nodeData.inputs?.modelName as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData) + const obj: Partial & { apiKey?: string } = { - apiKey + apiKey: cohereApiKey } if (modelName) obj.modelName = modelName diff --git a/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts b/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts index d77d623f..6d75b955 100644 --- a/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts +++ b/packages/components/nodes/embeddings/HuggingFaceInferenceEmbedding/HuggingFaceInferenceEmbedding.ts @@ -1,35 +1,41 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { HuggingFaceInferenceEmbeddings, HuggingFaceInferenceEmbeddingsParams } from './core' class HuggingFaceInferenceEmbedding_Embeddings implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'HuggingFace Inference Embeddings' this.name = 'huggingFaceInferenceEmbeddings' + this.version = 1.0 this.type = 'HuggingFaceInferenceEmbeddings' this.icon = 'huggingface.png' this.category = 'Embeddings' this.description = 'HuggingFace Inference API to generate embeddings for a given text' this.baseClasses = [this.type, ...getBaseClasses(HuggingFaceInferenceEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['huggingFaceApi'] + } this.inputs = [ - { - label: 'HuggingFace Api Key', - name: 'apiKey', - type: 'password' - }, { label: 'Model', name: 'modelName', type: 'string', + description: 'If using own inference endpoint, leave this blank', + placeholder: 'sentence-transformers/distilbert-base-nli-mean-tokens', optional: true }, { @@ -43,13 +49,15 @@ class HuggingFaceInferenceEmbedding_Embeddings implements INode { ] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.apiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const modelName = nodeData.inputs?.modelName as string const endpoint = nodeData.inputs?.endpoint as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData) + const obj: Partial = { - apiKey + apiKey: huggingFaceApiKey } if (modelName) obj.model = modelName diff --git a/packages/components/nodes/embeddings/LocalAIEmbedding/LocalAIEmbedding.ts b/packages/components/nodes/embeddings/LocalAIEmbedding/LocalAIEmbedding.ts index 7fb2a798..557e35d6 100644 --- a/packages/components/nodes/embeddings/LocalAIEmbedding/LocalAIEmbedding.ts +++ b/packages/components/nodes/embeddings/LocalAIEmbedding/LocalAIEmbedding.ts @@ -4,6 +4,7 @@ import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/o class LocalAIEmbedding_Embeddings implements INode { label: string name: string + version: number type: string icon: string category: string @@ -14,6 +15,7 @@ class LocalAIEmbedding_Embeddings implements INode { constructor() { this.label = 'LocalAI Embeddings' this.name = 'localAIEmbeddings' + this.version = 1.0 this.type = 'LocalAI Embeddings' this.icon = 'localai.png' this.category = 'Embeddings' diff --git a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts index 0fd08973..d21b6dca 100644 --- a/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts +++ b/packages/components/nodes/embeddings/OpenAIEmbedding/OpenAIEmbedding.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { OpenAIEmbeddings, OpenAIEmbeddingsParams } from 'langchain/embeddings/openai' class OpenAIEmbedding_Embeddings implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'OpenAI Embeddings' this.name = 'openAIEmbeddings' + this.version = 1.0 this.type = 'OpenAIEmbeddings' this.icon = 'openai.png' this.category = 'Embeddings' this.description = 'OpenAI API to generate embeddings for a given text' this.baseClasses = [this.type, ...getBaseClasses(OpenAIEmbeddings)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['openAIApi'] + } this.inputs = [ - { - label: 'OpenAI Api Key', - name: 'openAIApiKey', - type: 'password' - }, { label: 'Strip New Lines', name: 'stripNewLines', @@ -57,13 +61,15 @@ class OpenAIEmbedding_Embeddings implements INode { ] } - async init(nodeData: INodeData): Promise { - const openAIApiKey = nodeData.inputs?.openAIApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const stripNewLines = nodeData.inputs?.stripNewLines as boolean const batchSize = nodeData.inputs?.batchSize as string const timeout = nodeData.inputs?.timeout as string const basePath = nodeData.inputs?.basepath as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData) + const obj: Partial & { openAIApiKey?: string } = { openAIApiKey } diff --git a/packages/components/nodes/llms/Azure OpenAI/Azure.svg b/packages/components/nodes/llms/Azure OpenAI/Azure.svg index 51eb6253..47ad8c44 100644 --- a/packages/components/nodes/llms/Azure OpenAI/Azure.svg +++ b/packages/components/nodes/llms/Azure OpenAI/Azure.svg @@ -1,5 +1 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts b/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts index 130eed33..f48c4642 100644 --- a/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts +++ b/packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { AzureOpenAIInput, OpenAI, OpenAIInput } from 'langchain/llms/openai' class AzureOpenAI_LLMs implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Azure OpenAI' this.name = 'azureOpenAI' + this.version = 1.0 this.type = 'AzureOpenAI' this.icon = 'Azure.svg' this.category = 'LLMs' this.description = 'Wrapper around Azure OpenAI large language models' this.baseClasses = [this.type, ...getBaseClasses(OpenAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['azureOpenAIApi'] + } this.inputs = [ - { - label: 'Azure OpenAI Api Key', - name: 'azureOpenAIApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -87,33 +91,15 @@ class AzureOpenAI_LLMs implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.9, optional: true }, - { - label: 'Azure OpenAI Api Instance Name', - name: 'azureOpenAIApiInstanceName', - type: 'string', - placeholder: 'YOUR-INSTANCE-NAME' - }, - { - label: 'Azure OpenAI Api Deployment Name', - name: 'azureOpenAIApiDeploymentName', - type: 'string', - placeholder: 'YOUR-DEPLOYMENT-NAME' - }, - { - label: 'Azure OpenAI Api Version', - name: 'azureOpenAIApiVersion', - type: 'string', - placeholder: '2023-06-01-preview', - description: - 'Description of Supported API Versions. Please refer examples' - }, { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -121,6 +107,7 @@ class AzureOpenAI_LLMs implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -128,6 +115,7 @@ class AzureOpenAI_LLMs implements INode { label: 'Best Of', name: 'bestOf', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -135,6 +123,7 @@ class AzureOpenAI_LLMs implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -142,6 +131,7 @@ class AzureOpenAI_LLMs implements INode { label: 'Presence Penalty', name: 'presencePenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -149,19 +139,16 @@ class AzureOpenAI_LLMs implements INode { label: 'Timeout', name: 'timeout', type: 'number', + step: 1, optional: true, additionalParams: true } ] } - async init(nodeData: INodeData): Promise { - const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const temperature = nodeData.inputs?.temperature as string const modelName = nodeData.inputs?.modelName as string - const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string - const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string - const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string @@ -170,6 +157,12 @@ class AzureOpenAI_LLMs implements INode { const bestOf = nodeData.inputs?.bestOf as string const streaming = nodeData.inputs?.streaming as boolean + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData) + const azureOpenAIApiInstanceName = getCredentialParam('azureOpenAIApiInstanceName', credentialData, nodeData) + const azureOpenAIApiDeploymentName = getCredentialParam('azureOpenAIApiDeploymentName', credentialData, nodeData) + const azureOpenAIApiVersion = getCredentialParam('azureOpenAIApiVersion', credentialData, nodeData) + const obj: Partial & Partial = { temperature: parseFloat(temperature), modelName, @@ -181,9 +174,9 @@ class AzureOpenAI_LLMs implements INode { } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) - if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10) + if (topP) obj.topP = parseFloat(topP) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) + if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty) if (timeout) obj.timeout = parseInt(timeout, 10) if (bestOf) obj.bestOf = parseInt(bestOf, 10) diff --git a/packages/components/nodes/llms/Cohere/Cohere.ts b/packages/components/nodes/llms/Cohere/Cohere.ts index 75151571..4a3a8a80 100644 --- a/packages/components/nodes/llms/Cohere/Cohere.ts +++ b/packages/components/nodes/llms/Cohere/Cohere.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { Cohere, CohereInput } from './core' class Cohere_LLMs implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Cohere' this.name = 'cohere' + this.version = 1.0 this.type = 'Cohere' this.icon = 'cohere.png' this.category = 'LLMs' this.description = 'Wrapper around Cohere large language models' this.baseClasses = [this.type, ...getBaseClasses(Cohere)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['cohereApi'] + } this.inputs = [ - { - label: 'Cohere Api Key', - name: 'cohereApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -63,6 +67,7 @@ class Cohere_LLMs implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.7, optional: true }, @@ -70,19 +75,22 @@ class Cohere_LLMs implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true } ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const temperature = nodeData.inputs?.temperature as string const modelName = nodeData.inputs?.modelName as string - const apiKey = nodeData.inputs?.cohereApiKey as string const maxTokens = nodeData.inputs?.maxTokens as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData) + const obj: CohereInput = { - apiKey + apiKey: cohereApiKey } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) diff --git a/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts b/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts index 92eb46d5..c7f6a37e 100644 --- a/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts +++ b/packages/components/nodes/llms/HuggingFaceInference/HuggingFaceInference.ts @@ -1,41 +1,56 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { HFInput, HuggingFaceInference } from './core' class HuggingFaceInference_LLMs implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'HuggingFace Inference' this.name = 'huggingFaceInference_LLMs' + this.version = 1.0 this.type = 'HuggingFaceInference' this.icon = 'huggingface.png' this.category = 'LLMs' this.description = 'Wrapper around HuggingFace large language models' this.baseClasses = [this.type, ...getBaseClasses(HuggingFaceInference)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['huggingFaceApi'] + } this.inputs = [ { label: 'Model', name: 'model', type: 'string', - placeholder: 'gpt2' + description: 'If using own inference endpoint, leave this blank', + placeholder: 'gpt2', + optional: true }, { - label: 'HuggingFace Api Key', - name: 'apiKey', - type: 'password' + label: 'Endpoint', + name: 'endpoint', + type: 'string', + placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2', + description: 'Using your own inference endpoint', + optional: true }, { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, description: 'Temperature parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -44,6 +59,7 @@ class HuggingFaceInference_LLMs implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, description: 'Max Tokens parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -52,6 +68,7 @@ class HuggingFaceInference_LLMs implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, description: 'Top Probability parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -60,6 +77,7 @@ class HuggingFaceInference_LLMs implements INode { label: 'Top K', name: 'hfTopK', type: 'number', + step: 0.1, description: 'Top K parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true @@ -68,25 +86,16 @@ class HuggingFaceInference_LLMs implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, description: 'Frequency Penalty parameter may not apply to certain model. Please check available model parameters', optional: true, additionalParams: true - }, - { - label: 'Endpoint', - name: 'endpoint', - type: 'string', - placeholder: 'https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2', - description: 'Using your own inference endpoint', - optional: true, - additionalParams: true } ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const model = nodeData.inputs?.model as string - const apiKey = nodeData.inputs?.apiKey as string const temperature = nodeData.inputs?.temperature as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string @@ -94,16 +103,19 @@ class HuggingFaceInference_LLMs implements INode { const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string const endpoint = nodeData.inputs?.endpoint as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const huggingFaceApiKey = getCredentialParam('huggingFaceApiKey', credentialData, nodeData) + const obj: Partial = { model, - apiKey + apiKey: huggingFaceApiKey } if (temperature) obj.temperature = parseFloat(temperature) if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (hfTopK) obj.topK = parseInt(hfTopK, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) + if (topP) obj.topP = parseFloat(topP) + if (hfTopK) obj.topK = parseFloat(hfTopK) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) if (endpoint) obj.endpoint = endpoint const huggingFace = new HuggingFaceInference(obj) diff --git a/packages/components/nodes/llms/OpenAI/OpenAI.ts b/packages/components/nodes/llms/OpenAI/OpenAI.ts index b0af867d..4e35d659 100644 --- a/packages/components/nodes/llms/OpenAI/OpenAI.ts +++ b/packages/components/nodes/llms/OpenAI/OpenAI.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { OpenAI, OpenAIInput } from 'langchain/llms/openai' class OpenAI_LLMs implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'OpenAI' this.name = 'openAI' + this.version = 1.0 this.type = 'OpenAI' this.icon = 'openai.png' this.category = 'LLMs' this.description = 'Wrapper around OpenAI large language models' this.baseClasses = [this.type, ...getBaseClasses(OpenAI)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['openAIApi'] + } this.inputs = [ - { - label: 'OpenAI Api Key', - name: 'openAIApiKey', - type: 'password' - }, { label: 'Model Name', name: 'modelName', @@ -55,6 +59,7 @@ class OpenAI_LLMs implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, default: 0.7, optional: true }, @@ -62,6 +67,7 @@ class OpenAI_LLMs implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -69,6 +75,7 @@ class OpenAI_LLMs implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -76,6 +83,7 @@ class OpenAI_LLMs implements INode { label: 'Best Of', name: 'bestOf', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -83,6 +91,7 @@ class OpenAI_LLMs implements INode { label: 'Frequency Penalty', name: 'frequencyPenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -90,6 +99,7 @@ class OpenAI_LLMs implements INode { label: 'Presence Penalty', name: 'presencePenalty', type: 'number', + step: 0.1, optional: true, additionalParams: true }, @@ -97,6 +107,7 @@ class OpenAI_LLMs implements INode { label: 'Batch Size', name: 'batchSize', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -104,6 +115,7 @@ class OpenAI_LLMs implements INode { label: 'Timeout', name: 'timeout', type: 'number', + step: 1, optional: true, additionalParams: true }, @@ -117,10 +129,9 @@ class OpenAI_LLMs implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const temperature = nodeData.inputs?.temperature as string const modelName = nodeData.inputs?.modelName as string - const openAIApiKey = nodeData.inputs?.openAIApiKey as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string @@ -131,6 +142,9 @@ class OpenAI_LLMs implements INode { const streaming = nodeData.inputs?.streaming as boolean const basePath = nodeData.inputs?.basepath as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData) + const obj: Partial & { openAIApiKey?: string } = { temperature: parseFloat(temperature), modelName, @@ -139,9 +153,9 @@ class OpenAI_LLMs implements INode { } if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10) - if (topP) obj.topP = parseInt(topP, 10) - if (frequencyPenalty) obj.frequencyPenalty = parseInt(frequencyPenalty, 10) - if (presencePenalty) obj.presencePenalty = parseInt(presencePenalty, 10) + if (topP) obj.topP = parseFloat(topP) + if (frequencyPenalty) obj.frequencyPenalty = parseFloat(frequencyPenalty) + if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty) if (timeout) obj.timeout = parseInt(timeout, 10) if (batchSize) obj.batchSize = parseInt(batchSize, 10) if (bestOf) obj.bestOf = parseInt(bestOf, 10) diff --git a/packages/components/nodes/llms/Replicate/Replicate.ts b/packages/components/nodes/llms/Replicate/Replicate.ts index 03e20fb7..ca30cd97 100644 --- a/packages/components/nodes/llms/Replicate/Replicate.ts +++ b/packages/components/nodes/llms/Replicate/Replicate.ts @@ -1,31 +1,35 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { Replicate, ReplicateInput } from 'langchain/llms/replicate' class Replicate_LLMs implements INode { label: string name: string + version: number type: string icon: string category: string description: string baseClasses: string[] + credential: INodeParams inputs: INodeParams[] constructor() { this.label = 'Replicate' this.name = 'replicate' + this.version = 1.0 this.type = 'Replicate' this.icon = 'replicate.svg' this.category = 'LLMs' this.description = 'Use Replicate to run open source models on cloud' this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(Replicate)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['replicateApi'] + } this.inputs = [ - { - label: 'Replicate Api Key', - name: 'replicateApiKey', - type: 'password' - }, { label: 'Model', name: 'model', @@ -37,6 +41,7 @@ class Replicate_LLMs implements INode { label: 'Temperature', name: 'temperature', type: 'number', + step: 0.1, description: 'Adjusts randomness of outputs, greater than 1 is random and 0 is deterministic, 0.75 is a good starting value.', default: 0.7, @@ -46,6 +51,7 @@ class Replicate_LLMs implements INode { label: 'Max Tokens', name: 'maxTokens', type: 'number', + step: 1, description: 'Maximum number of tokens to generate. A word is generally 2-3 tokens', optional: true, additionalParams: true @@ -54,6 +60,7 @@ class Replicate_LLMs implements INode { label: 'Top Probability', name: 'topP', type: 'number', + step: 0.1, description: 'When decoding text, samples from the top p percentage of most likely tokens; lower to ignore less likely tokens', optional: true, @@ -63,6 +70,7 @@ class Replicate_LLMs implements INode { label: 'Repetition Penalty', name: 'repetitionPenalty', type: 'number', + step: 0.1, description: 'Penalty for repeated words in generated text; 1 is no penalty, values greater than 1 discourage repetition, less than 1 encourage it. (minimum: 0.01; maximum: 5)', optional: true, @@ -80,15 +88,17 @@ class Replicate_LLMs implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const modelName = nodeData.inputs?.model as string - const apiKey = nodeData.inputs?.replicateApiKey as string const temperature = nodeData.inputs?.temperature as string const maxTokens = nodeData.inputs?.maxTokens as string const topP = nodeData.inputs?.topP as string const repetitionPenalty = nodeData.inputs?.repetitionPenalty as string const additionalInputs = nodeData.inputs?.additionalInputs as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('apiKey', credentialData, nodeData) + const version = modelName.split(':').pop() const name = modelName.split(':')[0].split('/').pop() const org = modelName.split(':')[0].split('/')[0] diff --git a/packages/components/nodes/memory/BufferMemory/BufferMemory.ts b/packages/components/nodes/memory/BufferMemory/BufferMemory.ts index fd635ff4..7793d96d 100644 --- a/packages/components/nodes/memory/BufferMemory/BufferMemory.ts +++ b/packages/components/nodes/memory/BufferMemory/BufferMemory.ts @@ -5,6 +5,7 @@ import { BufferMemory } from 'langchain/memory' class BufferMemory_Memory implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class BufferMemory_Memory implements INode { constructor() { this.label = 'Buffer Memory' this.name = 'bufferMemory' + this.version = 1.0 this.type = 'BufferMemory' this.icon = 'memory.svg' this.category = 'Memory' diff --git a/packages/components/nodes/memory/BufferWindowMemory/BufferWindowMemory.ts b/packages/components/nodes/memory/BufferWindowMemory/BufferWindowMemory.ts index ae783fec..cf8e7f1d 100644 --- a/packages/components/nodes/memory/BufferWindowMemory/BufferWindowMemory.ts +++ b/packages/components/nodes/memory/BufferWindowMemory/BufferWindowMemory.ts @@ -5,6 +5,7 @@ import { BufferWindowMemory, BufferWindowMemoryInput } from 'langchain/memory' class BufferWindowMemory_Memory implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class BufferWindowMemory_Memory implements INode { constructor() { this.label = 'Buffer Window Memory' this.name = 'bufferWindowMemory' + this.version = 1.0 this.type = 'BufferWindowMemory' this.icon = 'memory.svg' this.category = 'Memory' diff --git a/packages/components/nodes/memory/ConversationSummaryMemory/ConversationSummaryMemory.ts b/packages/components/nodes/memory/ConversationSummaryMemory/ConversationSummaryMemory.ts index 3c055e8e..332d73aa 100644 --- a/packages/components/nodes/memory/ConversationSummaryMemory/ConversationSummaryMemory.ts +++ b/packages/components/nodes/memory/ConversationSummaryMemory/ConversationSummaryMemory.ts @@ -6,6 +6,7 @@ import { BaseLanguageModel } from 'langchain/base_language' class ConversationSummaryMemory_Memory implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class ConversationSummaryMemory_Memory implements INode { constructor() { this.label = 'Conversation Summary Memory' this.name = 'conversationSummaryMemory' + this.version = 1.0 this.type = 'ConversationSummaryMemory' this.icon = 'memory.svg' this.category = 'Memory' diff --git a/packages/components/nodes/memory/DynamoDb/DynamoDb.ts b/packages/components/nodes/memory/DynamoDb/DynamoDb.ts index 2ea7ba04..a1c0fb1f 100644 --- a/packages/components/nodes/memory/DynamoDb/DynamoDb.ts +++ b/packages/components/nodes/memory/DynamoDb/DynamoDb.ts @@ -1,25 +1,34 @@ -import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses } from '../../../src' +import { ICommonObject, INode, INodeData, INodeParams, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src' import { DynamoDBChatMessageHistory } from 'langchain/stores/message/dynamodb' import { BufferMemory } from 'langchain/memory' class DynamoDb_Memory 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 = 'DynamoDB Chat Memory' this.name = 'DynamoDBChatMemory' + this.version = 1.0 this.type = 'DynamoDBChatMemory' this.icon = 'dynamodb.svg' this.category = 'Memory' this.description = 'Stores the conversation in dynamo db table' this.baseClasses = [this.type, ...getBaseClasses(BufferMemory)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['dynamodbMemoryApi'] + } this.inputs = [ { label: 'Table Name', @@ -31,6 +40,13 @@ class DynamoDb_Memory implements INode { name: 'partitionKey', type: 'string' }, + { + label: 'Region', + name: 'region', + type: 'string', + description: 'The aws region in which table is located', + placeholder: 'us-east-1' + }, { label: 'Session ID', name: 'sessionId', @@ -40,28 +56,12 @@ class DynamoDb_Memory implements INode { additionalParams: true, optional: true }, - { - label: 'Region', - name: 'region', - type: 'string', - description: 'The aws region in which table is located', - placeholder: 'us-east-1' - }, - { - label: 'Access Key', - name: 'accessKey', - type: 'password' - }, - { - label: 'Secret Access Key', - name: 'secretAccessKey', - type: 'password' - }, { label: 'Memory Key', name: 'memoryKey', type: 'string', - default: 'chat_history' + default: 'chat_history', + additionalParams: true } ] } @@ -71,22 +71,24 @@ class DynamoDb_Memory implements INode { } async clearSessionMemory(nodeData: INodeData, options: ICommonObject): Promise { - const dynamodbMemory = initalizeDynamoDB(nodeData, options) - dynamodbMemory.clear() + const dynamodbMemory = await initalizeDynamoDB(nodeData, options) + await dynamodbMemory.clear() } } -const initalizeDynamoDB = (nodeData: INodeData, options: ICommonObject): BufferMemory => { +const initalizeDynamoDB = async (nodeData: INodeData, options: ICommonObject): Promise => { const tableName = nodeData.inputs?.tableName as string const partitionKey = nodeData.inputs?.partitionKey as string const sessionId = nodeData.inputs?.sessionId as string const region = nodeData.inputs?.region as string - const accessKey = nodeData.inputs?.accessKey as string - const secretAccessKey = nodeData.inputs?.secretAccessKey as string const memoryKey = nodeData.inputs?.memoryKey as string const chatId = options.chatId + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const accessKeyId = getCredentialParam('accessKey', credentialData, nodeData) + const secretAccessKey = getCredentialParam('secretAccessKey', credentialData, nodeData) + const dynamoDb = new DynamoDBChatMessageHistory({ tableName, partitionKey, @@ -94,7 +96,7 @@ const initalizeDynamoDB = (nodeData: INodeData, options: ICommonObject): BufferM config: { region, credentials: { - accessKeyId: accessKey, + accessKeyId, secretAccessKey } } diff --git a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts index ece0e655..790c753c 100644 --- a/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts +++ b/packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts @@ -1,26 +1,37 @@ import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { ICommonObject } from '../../../src' import { MotorheadMemory, MotorheadMemoryInput } from 'langchain/memory' class MotorMemory_Memory 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 = 'Motorhead Memory' this.name = 'motorheadMemory' + this.version = 1.0 this.type = 'MotorheadMemory' this.icon = 'motorhead.png' this.category = 'Memory' - this.description = 'Remembers previous conversational back and forths directly' + this.description = 'Use Motorhead Memory to store chat conversations' this.baseClasses = [this.type, ...getBaseClasses(MotorheadMemory)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + optional: true, + description: 'Only needed when using hosted solution - https://getmetal.io', + credentialNames: ['motorheadMemoryApi'] + } this.inputs = [ { label: 'Base URL', @@ -29,12 +40,6 @@ class MotorMemory_Memory implements INode { optional: true, description: 'To use the online version, leave the URL blank. More details at https://getmetal.io.' }, - { - label: 'Memory Key', - name: 'memoryKey', - type: 'string', - default: 'chat_history' - }, { label: 'Session Id', name: 'sessionId', @@ -45,20 +50,11 @@ class MotorMemory_Memory implements INode { optional: true }, { - label: 'API Key', - name: 'apiKey', - type: 'password', - description: 'Only needed when using hosted solution - https://getmetal.io', - additionalParams: true, - optional: true - }, - { - label: 'Client ID', - name: 'clientId', + label: 'Memory Key', + name: 'memoryKey', type: 'string', - description: 'Only needed when using hosted solution - https://getmetal.io', - additionalParams: true, - optional: true + default: 'chat_history', + additionalParams: true } ] } @@ -68,20 +64,22 @@ class MotorMemory_Memory implements INode { } async clearSessionMemory(nodeData: INodeData, options: ICommonObject): Promise { - const motorhead = initalizeMotorhead(nodeData, options) - motorhead.clear() + const motorhead = await initalizeMotorhead(nodeData, options) + await motorhead.clear() } } -const initalizeMotorhead = (nodeData: INodeData, options: ICommonObject): MotorheadMemory => { +const initalizeMotorhead = async (nodeData: INodeData, options: ICommonObject): Promise => { const memoryKey = nodeData.inputs?.memoryKey as string const baseURL = nodeData.inputs?.baseURL as string const sessionId = nodeData.inputs?.sessionId as string - const apiKey = nodeData.inputs?.apiKey as string - const clientId = nodeData.inputs?.clientId as string const chatId = options?.chatId as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('apiKey', credentialData, nodeData) + const clientId = getCredentialParam('clientId', credentialData, nodeData) + let obj: MotorheadMemoryInput = { returnMessages: true, sessionId: sessionId ? sessionId : chatId, diff --git a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts index cd406f59..e9c963dd 100644 --- a/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts +++ b/packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts @@ -8,6 +8,7 @@ import { createClient } from 'redis' class RedisBackedChatMemory_Memory implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class RedisBackedChatMemory_Memory implements INode { constructor() { this.label = 'Redis-Backed Chat Memory' this.name = 'RedisBackedChatMemory' + this.version = 1.0 this.type = 'RedisBackedChatMemory' this.icon = 'redis.svg' this.category = 'Memory' @@ -44,13 +46,15 @@ class RedisBackedChatMemory_Memory implements INode { name: 'sessionTTL', type: 'number', description: 'Omit this parameter to make sessions never expire', + additionalParams: true, optional: true }, { label: 'Memory Key', name: 'memoryKey', type: 'string', - default: 'chat_history' + default: 'chat_history', + additionalParams: true } ] } diff --git a/packages/components/nodes/memory/ZepMemory/ZepMemory.ts b/packages/components/nodes/memory/ZepMemory/ZepMemory.ts index 77db7dac..e64740b8 100644 --- a/packages/components/nodes/memory/ZepMemory/ZepMemory.ts +++ b/packages/components/nodes/memory/ZepMemory/ZepMemory.ts @@ -1,27 +1,38 @@ import { SystemMessage } from 'langchain/schema' import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { ZepMemory, ZepMemoryInput } from 'langchain/memory/zep' import { ICommonObject } from '../../../src' class ZepMemory_Memory 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 = 'Zep Memory' this.name = 'ZepMemory' + this.version = 1.0 this.type = 'ZepMemory' this.icon = 'zep.png' this.category = 'Memory' this.description = 'Summarizes the conversation and stores the memory in zep server' this.baseClasses = [this.type, ...getBaseClasses(ZepMemory)] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + optional: true, + description: 'Configure JWT authentication on your Zep instance (Optional)', + credentialNames: ['zepMemoryApi'] + } this.inputs = [ { label: 'Base URL', @@ -44,13 +55,6 @@ class ZepMemory_Memory implements INode { additionalParams: true, optional: true }, - { - label: 'API Key', - name: 'apiKey', - type: 'password', - additionalParams: true, - optional: true - }, { label: 'Size', name: 'k', @@ -106,9 +110,10 @@ class ZepMemory_Memory implements INode { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const autoSummaryTemplate = nodeData.inputs?.autoSummaryTemplate as string const autoSummary = nodeData.inputs?.autoSummary as boolean + const k = nodeData.inputs?.k as string - let zep = initalizeZep(nodeData, options) + let zep = await initalizeZep(nodeData, options) // hack to support summary let tmpFunc = zep.loadMemoryVariables @@ -135,23 +140,24 @@ class ZepMemory_Memory implements INode { } async clearSessionMemory(nodeData: INodeData, options: ICommonObject): Promise { - const zep = initalizeZep(nodeData, options) - zep.clear() + const zep = await initalizeZep(nodeData, options) + await zep.clear() } } -const initalizeZep = (nodeData: INodeData, options: ICommonObject) => { +const initalizeZep = async (nodeData: INodeData, options: ICommonObject): Promise => { const baseURL = nodeData.inputs?.baseURL as string const aiPrefix = nodeData.inputs?.aiPrefix as string const humanPrefix = nodeData.inputs?.humanPrefix as string const memoryKey = nodeData.inputs?.memoryKey as string const inputKey = nodeData.inputs?.inputKey as string - const sessionId = nodeData.inputs?.sessionId as string - const apiKey = nodeData.inputs?.apiKey as string const chatId = options?.chatId as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const apiKey = getCredentialParam('apiKey', credentialData, nodeData) + const obj: ZepMemoryInput = { baseURL, sessionId: sessionId ? sessionId : chatId, diff --git a/packages/components/nodes/prompts/ChatPromptTemplate/ChatPromptTemplate.ts b/packages/components/nodes/prompts/ChatPromptTemplate/ChatPromptTemplate.ts index 88803348..c9ec751d 100644 --- a/packages/components/nodes/prompts/ChatPromptTemplate/ChatPromptTemplate.ts +++ b/packages/components/nodes/prompts/ChatPromptTemplate/ChatPromptTemplate.ts @@ -5,6 +5,7 @@ import { ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemp class ChatPromptTemplate_Prompts implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class ChatPromptTemplate_Prompts implements INode { constructor() { this.label = 'Chat Prompt Template' this.name = 'chatPromptTemplate' + this.version = 1.0 this.type = 'ChatPromptTemplate' this.icon = 'prompt.svg' this.category = 'Prompts' diff --git a/packages/components/nodes/prompts/FewShotPromptTemplate/FewShotPromptTemplate.ts b/packages/components/nodes/prompts/FewShotPromptTemplate/FewShotPromptTemplate.ts index 3bf305a4..ed1d3cb2 100644 --- a/packages/components/nodes/prompts/FewShotPromptTemplate/FewShotPromptTemplate.ts +++ b/packages/components/nodes/prompts/FewShotPromptTemplate/FewShotPromptTemplate.ts @@ -7,6 +7,7 @@ import { TemplateFormat } from 'langchain/dist/prompts/template' class FewShotPromptTemplate_Prompts implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class FewShotPromptTemplate_Prompts implements INode { constructor() { this.label = 'Few Shot Prompt Template' this.name = 'fewShotPromptTemplate' + this.version = 1.0 this.type = 'FewShotPromptTemplate' this.icon = 'prompt.svg' this.category = 'Prompts' diff --git a/packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts b/packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts index bd5740d8..a401e282 100644 --- a/packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts +++ b/packages/components/nodes/prompts/PromptTemplate/PromptTemplate.ts @@ -5,6 +5,7 @@ import { PromptTemplateInput } from 'langchain/prompts' class PromptTemplate_Prompts implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class PromptTemplate_Prompts implements INode { constructor() { this.label = 'Prompt Template' this.name = 'promptTemplate' + this.version = 1.0 this.type = 'PromptTemplate' this.icon = 'prompt.svg' this.category = 'Prompts' diff --git a/packages/components/nodes/retrievers/HydeRetriever/HydeRetriever.ts b/packages/components/nodes/retrievers/HydeRetriever/HydeRetriever.ts index a90f9870..2baf677e 100644 --- a/packages/components/nodes/retrievers/HydeRetriever/HydeRetriever.ts +++ b/packages/components/nodes/retrievers/HydeRetriever/HydeRetriever.ts @@ -7,6 +7,7 @@ import { PromptTemplate } from 'langchain/prompts' class HydeRetriever_Retrievers implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class HydeRetriever_Retrievers implements INode { constructor() { this.label = 'Hyde Retriever' this.name = 'HydeRetriever' + this.version = 1.0 this.type = 'HydeRetriever' this.icon = 'hyderetriever.svg' this.category = 'Retrievers' diff --git a/packages/components/nodes/retrievers/PromptRetriever/PromptRetriever.ts b/packages/components/nodes/retrievers/PromptRetriever/PromptRetriever.ts index e3b9a4ac..7ffaa64f 100644 --- a/packages/components/nodes/retrievers/PromptRetriever/PromptRetriever.ts +++ b/packages/components/nodes/retrievers/PromptRetriever/PromptRetriever.ts @@ -3,6 +3,7 @@ import { INode, INodeData, INodeParams, PromptRetriever, PromptRetrieverInput } class PromptRetriever_Retrievers implements INode { label: string name: string + version: number description: string type: string icon: string @@ -13,6 +14,7 @@ class PromptRetriever_Retrievers implements INode { constructor() { this.label = 'Prompt Retriever' this.name = 'promptRetriever' + this.version = 1.0 this.type = 'PromptRetriever' this.icon = 'promptretriever.svg' this.category = 'Retrievers' diff --git a/packages/components/nodes/retrievers/VectorStoreRetriever/VectorStoreRetriever.ts b/packages/components/nodes/retrievers/VectorStoreRetriever/VectorStoreRetriever.ts index 2ccfc995..41f66571 100644 --- a/packages/components/nodes/retrievers/VectorStoreRetriever/VectorStoreRetriever.ts +++ b/packages/components/nodes/retrievers/VectorStoreRetriever/VectorStoreRetriever.ts @@ -4,6 +4,7 @@ import { INode, INodeData, INodeParams, VectorStoreRetriever, VectorStoreRetriev class VectorStoreRetriever_Retrievers implements INode { label: string name: string + version: number description: string type: string icon: string @@ -14,6 +15,7 @@ class VectorStoreRetriever_Retrievers implements INode { constructor() { this.label = 'Vector Store Retriever' this.name = 'vectorStoreRetriever' + this.version = 1.0 this.type = 'VectorStoreRetriever' this.icon = 'vectorretriever.svg' this.category = 'Retrievers' diff --git a/packages/components/nodes/textsplitters/CharacterTextSplitter/CharacterTextSplitter.ts b/packages/components/nodes/textsplitters/CharacterTextSplitter/CharacterTextSplitter.ts index 90387e8b..f9427d10 100644 --- a/packages/components/nodes/textsplitters/CharacterTextSplitter/CharacterTextSplitter.ts +++ b/packages/components/nodes/textsplitters/CharacterTextSplitter/CharacterTextSplitter.ts @@ -5,6 +5,7 @@ import { CharacterTextSplitter, CharacterTextSplitterParams } from 'langchain/te class CharacterTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class CharacterTextSplitter_TextSplitters implements INode { constructor() { this.label = 'Character Text Splitter' this.name = 'characterTextSplitter' + this.version = 1.0 this.type = 'CharacterTextSplitter' this.icon = 'textsplitter.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/textsplitters/CodeTextSplitter/CodeTextSplitter.ts b/packages/components/nodes/textsplitters/CodeTextSplitter/CodeTextSplitter.ts index b14655b8..ed643f33 100644 --- a/packages/components/nodes/textsplitters/CodeTextSplitter/CodeTextSplitter.ts +++ b/packages/components/nodes/textsplitters/CodeTextSplitter/CodeTextSplitter.ts @@ -9,6 +9,7 @@ import { class CodeTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class CodeTextSplitter_TextSplitters implements INode { constructor() { this.label = 'Code Text Splitter' this.name = 'codeTextSplitter' + this.version = 1.0 this.type = 'CodeTextSplitter' this.icon = 'codeTextSplitter.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/HtmlToMarkdownTextSplitter.ts b/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/HtmlToMarkdownTextSplitter.ts index 161cb89e..699764e5 100644 --- a/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/HtmlToMarkdownTextSplitter.ts +++ b/packages/components/nodes/textsplitters/HtmlToMarkdownTextSplitter/HtmlToMarkdownTextSplitter.ts @@ -6,6 +6,7 @@ import { NodeHtmlMarkdown } from 'node-html-markdown' class HtmlToMarkdownTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class HtmlToMarkdownTextSplitter_TextSplitters implements INode { constructor() { this.label = 'HtmlToMarkdown Text Splitter' this.name = 'htmlToMarkdownTextSplitter' + this.version = 1.0 this.type = 'HtmlToMarkdownTextSplitter' this.icon = 'htmlToMarkdownTextSplitter.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/textsplitters/MarkdownTextSplitter/MarkdownTextSplitter.ts b/packages/components/nodes/textsplitters/MarkdownTextSplitter/MarkdownTextSplitter.ts index 02c37d8d..0a12845a 100644 --- a/packages/components/nodes/textsplitters/MarkdownTextSplitter/MarkdownTextSplitter.ts +++ b/packages/components/nodes/textsplitters/MarkdownTextSplitter/MarkdownTextSplitter.ts @@ -5,6 +5,7 @@ import { MarkdownTextSplitter, MarkdownTextSplitterParams } from 'langchain/text class MarkdownTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class MarkdownTextSplitter_TextSplitters implements INode { constructor() { this.label = 'Markdown Text Splitter' this.name = 'markdownTextSplitter' + this.version = 1.0 this.type = 'MarkdownTextSplitter' this.icon = 'markdownTextSplitter.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/RecursiveCharacterTextSplitter.ts b/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/RecursiveCharacterTextSplitter.ts index 432b5ca9..dcca70ba 100644 --- a/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/RecursiveCharacterTextSplitter.ts +++ b/packages/components/nodes/textsplitters/RecursiveCharacterTextSplitter/RecursiveCharacterTextSplitter.ts @@ -5,6 +5,7 @@ import { RecursiveCharacterTextSplitter, RecursiveCharacterTextSplitterParams } class RecursiveCharacterTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class RecursiveCharacterTextSplitter_TextSplitters implements INode { constructor() { this.label = 'Recursive Character Text Splitter' this.name = 'recursiveCharacterTextSplitter' + this.version = 1.0 this.type = 'RecursiveCharacterTextSplitter' this.icon = 'textsplitter.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/textsplitters/TokenTextSplitter/TokenTextSplitter.ts b/packages/components/nodes/textsplitters/TokenTextSplitter/TokenTextSplitter.ts index 8c8d6abe..0b11eebc 100644 --- a/packages/components/nodes/textsplitters/TokenTextSplitter/TokenTextSplitter.ts +++ b/packages/components/nodes/textsplitters/TokenTextSplitter/TokenTextSplitter.ts @@ -6,6 +6,7 @@ import { TiktokenEncoding } from '@dqbd/tiktoken' class TokenTextSplitter_TextSplitters implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class TokenTextSplitter_TextSplitters implements INode { constructor() { this.label = 'Token Text Splitter' this.name = 'tokenTextSplitter' + this.version = 1.0 this.type = 'TokenTextSplitter' this.icon = 'tiktoken.svg' this.category = 'Text Splitters' diff --git a/packages/components/nodes/tools/AIPlugin/AIPlugin.ts b/packages/components/nodes/tools/AIPlugin/AIPlugin.ts index ad21f8db..e9c0fa3d 100644 --- a/packages/components/nodes/tools/AIPlugin/AIPlugin.ts +++ b/packages/components/nodes/tools/AIPlugin/AIPlugin.ts @@ -5,6 +5,7 @@ import { getBaseClasses } from '../../../src/utils' class AIPlugin implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class AIPlugin implements INode { constructor() { this.label = 'AI Plugin' this.name = 'aiPlugin' + this.version = 1.0 this.type = 'AIPlugin' this.icon = 'aiplugin.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/BraveSearchAPI/BraveSearchAPI.ts b/packages/components/nodes/tools/BraveSearchAPI/BraveSearchAPI.ts index b84aaccd..9e9c760d 100644 --- a/packages/components/nodes/tools/BraveSearchAPI/BraveSearchAPI.ts +++ b/packages/components/nodes/tools/BraveSearchAPI/BraveSearchAPI.ts @@ -1,37 +1,41 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { BraveSearch } from 'langchain/tools' class BraveSearchAPI_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 = 'BraveSearch API' this.name = 'braveSearchAPI' + this.version = 1.0 this.type = 'BraveSearchAPI' this.icon = 'brave.svg' this.category = 'Tools' this.description = 'Wrapper around BraveSearch API - a real-time API to access Brave search results' - this.inputs = [ - { - label: 'BraveSearch API Key', - name: 'apiKey', - type: 'password' - } - ] + this.inputs = [] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['braveSearchApi'] + } this.baseClasses = [this.type, ...getBaseClasses(BraveSearch)] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.apiKey as string - return new BraveSearch({ apiKey }) + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const braveApiKey = getCredentialParam('braveApiKey', credentialData, nodeData) + return new BraveSearch({ apiKey: braveApiKey }) } } diff --git a/packages/components/nodes/tools/Calculator/Calculator.ts b/packages/components/nodes/tools/Calculator/Calculator.ts index 85284f0f..db1e0b2b 100644 --- a/packages/components/nodes/tools/Calculator/Calculator.ts +++ b/packages/components/nodes/tools/Calculator/Calculator.ts @@ -5,6 +5,7 @@ import { Calculator } from 'langchain/tools/calculator' class Calculator_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -14,6 +15,7 @@ class Calculator_Tools implements INode { constructor() { this.label = 'Calculator' this.name = 'calculator' + this.version = 1.0 this.type = 'Calculator' this.icon = 'calculator.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/ChainTool/ChainTool.ts b/packages/components/nodes/tools/ChainTool/ChainTool.ts index 669b5947..42b5e6e1 100644 --- a/packages/components/nodes/tools/ChainTool/ChainTool.ts +++ b/packages/components/nodes/tools/ChainTool/ChainTool.ts @@ -6,6 +6,7 @@ import { ChainTool } from './core' class ChainTool_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class ChainTool_Tools implements INode { constructor() { this.label = 'Chain Tool' this.name = 'chainTool' + this.version = 1.0 this.type = 'ChainTool' this.icon = 'chaintool.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/CustomTool/CustomTool.ts b/packages/components/nodes/tools/CustomTool/CustomTool.ts index 768e9092..26b30627 100644 --- a/packages/components/nodes/tools/CustomTool/CustomTool.ts +++ b/packages/components/nodes/tools/CustomTool/CustomTool.ts @@ -7,6 +7,7 @@ import { DataSource } from 'typeorm' class CustomTool_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class CustomTool_Tools implements INode { constructor() { this.label = 'Custom Tool' this.name = 'customTool' + this.version = 1.0 this.type = 'CustomTool' this.icon = 'customtool.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/CustomTool/core.ts b/packages/components/nodes/tools/CustomTool/core.ts index 2aa06b54..12dd72f1 100644 --- a/packages/components/nodes/tools/CustomTool/core.ts +++ b/packages/components/nodes/tools/CustomTool/core.ts @@ -2,7 +2,37 @@ import { z } from 'zod' import { CallbackManagerForToolRun } from 'langchain/callbacks' import { StructuredTool, ToolParams } from 'langchain/tools' import { NodeVM } from 'vm2' -import { availableDependencies } from '../../../src/utils' + +/* + * List of dependencies allowed to be import in vm2 + */ +const availableDependencies = [ + '@dqbd/tiktoken', + '@getzep/zep-js', + '@huggingface/inference', + '@pinecone-database/pinecone', + '@supabase/supabase-js', + 'axios', + 'cheerio', + 'chromadb', + 'cohere-ai', + 'd3-dsv', + 'form-data', + 'graphql', + 'html-to-text', + 'langchain', + 'linkifyjs', + 'mammoth', + 'moment', + 'node-fetch', + 'pdf-parse', + 'pdfjs-dist', + 'playwright', + 'puppeteer', + 'srt-parser-2', + 'typeorm', + 'weaviate-ts-client' +] export interface BaseDynamicToolInput extends ToolParams { name: string diff --git a/packages/components/nodes/tools/MakeWebhook/MakeWebhook.ts b/packages/components/nodes/tools/MakeWebhook/MakeWebhook.ts index 38e0cdd1..e30e3874 100644 --- a/packages/components/nodes/tools/MakeWebhook/MakeWebhook.ts +++ b/packages/components/nodes/tools/MakeWebhook/MakeWebhook.ts @@ -5,6 +5,7 @@ import { MakeWebhookTool } from './core' class MakeWebhook_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class MakeWebhook_Tools implements INode { constructor() { this.label = 'Make.com Webhook' this.name = 'makeWebhook' + this.version = 1.0 this.type = 'MakeWebhook' this.icon = 'make.png' this.category = 'Tools' diff --git a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts index d6168061..d1bf3891 100644 --- a/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts +++ b/packages/components/nodes/tools/OpenAPIToolkit/OpenAPIToolkit.ts @@ -1,32 +1,39 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { OpenApiToolkit } from 'langchain/agents' import { JsonSpec, JsonObject } from 'langchain/tools' import { BaseLanguageModel } from 'langchain/base_language' import { load } from 'js-yaml' +import { getCredentialData, getCredentialParam } from '../../../src' class OpenAPIToolkit_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 = 'OpenAPI Toolkit' this.name = 'openAPIToolkit' + this.version = 1.0 this.type = 'OpenAPIToolkit' this.icon = 'openapi.png' this.category = 'Tools' this.description = 'Load OpenAPI specification' + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed if the YAML OpenAPI Spec requires authentication', + optional: true, + credentialNames: ['openAPIAuth'] + } this.inputs = [ - { - label: 'OpenAI API Key', - name: 'openAIApiKey', - type: 'password' - }, { label: 'Language Model', name: 'model', @@ -42,11 +49,13 @@ class OpenAPIToolkit_Tools implements INode { this.baseClasses = [this.type, 'Tool'] } - async init(nodeData: INodeData): Promise { - const openAIApiKey = nodeData.inputs?.openAIApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const model = nodeData.inputs?.model as BaseLanguageModel const yamlFileBase64 = nodeData.inputs?.yamlFile as string + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const openAPIToken = getCredentialParam('openAPIToken', credentialData, nodeData) + const splitDataURI = yamlFileBase64.split(',') splitDataURI.pop() const bf = Buffer.from(splitDataURI.pop() || '', 'base64') @@ -56,10 +65,10 @@ class OpenAPIToolkit_Tools implements INode { throw new Error('Failed to load OpenAPI spec') } - const headers = { - 'Content-Type': 'application/json', - Authorization: `Bearer ${openAIApiKey}` + const headers: ICommonObject = { + 'Content-Type': 'application/json' } + if (openAPIToken) headers.Authorization = `Bearer ${openAPIToken}` const toolkit = new OpenApiToolkit(new JsonSpec(data), model, headers) return toolkit.tools diff --git a/packages/components/nodes/tools/ReadFile/ReadFile.ts b/packages/components/nodes/tools/ReadFile/ReadFile.ts index b6678943..2aa2c66e 100644 --- a/packages/components/nodes/tools/ReadFile/ReadFile.ts +++ b/packages/components/nodes/tools/ReadFile/ReadFile.ts @@ -6,6 +6,7 @@ import { NodeFileStore } from 'langchain/stores/file/node' class ReadFile_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class ReadFile_Tools implements INode { constructor() { this.label = 'Read File' this.name = 'readFile' + this.version = 1.0 this.type = 'ReadFile' this.icon = 'readfile.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/RequestsGet/RequestsGet.ts b/packages/components/nodes/tools/RequestsGet/RequestsGet.ts index 0b7f0ac8..91cff500 100644 --- a/packages/components/nodes/tools/RequestsGet/RequestsGet.ts +++ b/packages/components/nodes/tools/RequestsGet/RequestsGet.ts @@ -5,6 +5,7 @@ import { desc, RequestParameters, RequestsGetTool } from './core' class RequestsGet_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class RequestsGet_Tools implements INode { constructor() { this.label = 'Requests Get' this.name = 'requestsGet' + this.version = 1.0 this.type = 'RequestsGet' this.icon = 'requestsget.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/RequestsPost/RequestsPost.ts b/packages/components/nodes/tools/RequestsPost/RequestsPost.ts index 0e64556f..9ff3d142 100644 --- a/packages/components/nodes/tools/RequestsPost/RequestsPost.ts +++ b/packages/components/nodes/tools/RequestsPost/RequestsPost.ts @@ -5,6 +5,7 @@ import { RequestParameters, desc, RequestsPostTool } from './core' class RequestsPost_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -15,6 +16,7 @@ class RequestsPost_Tools implements INode { constructor() { this.label = 'Requests Post' this.name = 'requestsPost' + this.version = 1.0 this.type = 'RequestsPost' this.icon = 'requestspost.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts index 69432408..b7230c85 100644 --- a/packages/components/nodes/tools/SerpAPI/SerpAPI.ts +++ b/packages/components/nodes/tools/SerpAPI/SerpAPI.ts @@ -1,37 +1,41 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { SerpAPI } from 'langchain/tools' class SerpAPI_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 = 'Serp API' this.name = 'serpAPI' + this.version = 1.0 this.type = 'SerpAPI' this.icon = 'serp.png' this.category = 'Tools' this.description = 'Wrapper around SerpAPI - a real-time API to access Google search results' - this.inputs = [ - { - label: 'Serp Api Key', - name: 'apiKey', - type: 'password' - } - ] + this.inputs = [] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['serpApi'] + } this.baseClasses = [this.type, ...getBaseClasses(SerpAPI)] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.apiKey as string - return new SerpAPI(apiKey) + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const serpApiKey = getCredentialParam('serpApiKey', credentialData, nodeData) + return new SerpAPI(serpApiKey) } } diff --git a/packages/components/nodes/tools/Serper/Serper.ts b/packages/components/nodes/tools/Serper/Serper.ts index 65dff57c..1facdb3d 100644 --- a/packages/components/nodes/tools/Serper/Serper.ts +++ b/packages/components/nodes/tools/Serper/Serper.ts @@ -1,37 +1,41 @@ -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { Serper } from 'langchain/tools' class Serper_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 = 'Serper' this.name = 'serper' + this.version = 1.0 this.type = 'Serper' this.icon = 'serper.png' this.category = 'Tools' this.description = 'Wrapper around Serper.dev - Google Search API' - this.inputs = [ - { - label: 'Serper Api Key', - name: 'apiKey', - type: 'password' - } - ] + this.inputs = [] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['serperApi'] + } this.baseClasses = [this.type, ...getBaseClasses(Serper)] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.apiKey as string - return new Serper(apiKey) + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const serperApiKey = getCredentialParam('serperApiKey', credentialData, nodeData) + return new Serper(serperApiKey) } } diff --git a/packages/components/nodes/tools/WebBrowser/WebBrowser.ts b/packages/components/nodes/tools/WebBrowser/WebBrowser.ts index 09478047..64a093d0 100644 --- a/packages/components/nodes/tools/WebBrowser/WebBrowser.ts +++ b/packages/components/nodes/tools/WebBrowser/WebBrowser.ts @@ -7,6 +7,7 @@ import { Embeddings } from 'langchain/embeddings/base' class WebBrowser_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class WebBrowser_Tools implements INode { constructor() { this.label = 'Web Browser' this.name = 'webBrowser' + this.version = 1.0 this.type = 'WebBrowser' this.icon = 'webBrowser.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/WriteFile/WriteFile.ts b/packages/components/nodes/tools/WriteFile/WriteFile.ts index 208166d8..2eb7843f 100644 --- a/packages/components/nodes/tools/WriteFile/WriteFile.ts +++ b/packages/components/nodes/tools/WriteFile/WriteFile.ts @@ -6,6 +6,7 @@ import { NodeFileStore } from 'langchain/stores/file/node' class WriteFile_Tools implements INode { label: string name: string + version: number description: string type: string icon: string @@ -16,6 +17,7 @@ class WriteFile_Tools implements INode { constructor() { this.label = 'Write File' this.name = 'writeFile' + this.version = 1.0 this.type = 'WriteFile' this.icon = 'writefile.svg' this.category = 'Tools' diff --git a/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts index d16e32e6..49543136 100644 --- a/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts +++ b/packages/components/nodes/tools/ZapierNLA/ZapierNLA.ts @@ -1,39 +1,44 @@ import { ZapierNLAWrapper, ZapierNLAWrapperParams } from 'langchain/tools' -import { INode, INodeData, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { ZapierToolKit } from 'langchain/agents' +import { getCredentialData, getCredentialParam } from '../../../src' class ZapierNLA_Tools implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams constructor() { this.label = 'Zapier NLA' this.name = 'zapierNLA' + this.version = 1.0 this.type = 'ZapierNLA' - this.icon = 'zapier.png' + this.icon = 'zapier.svg' this.category = 'Tools' this.description = "Access to apps and actions on Zapier's platform through a natural language API interface" - this.inputs = [ - { - label: 'Zapier NLA Api Key', - name: 'apiKey', - type: 'password' - } - ] + this.inputs = [] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['zapierNLAApi'] + } this.baseClasses = [this.type, 'Tool'] } - async init(nodeData: INodeData): Promise { - const apiKey = nodeData.inputs?.apiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const zapierNLAApiKey = getCredentialParam('zapierNLAApiKey', credentialData, nodeData) const obj: Partial = { - apiKey + apiKey: zapierNLAApiKey } const zapier = new ZapierNLAWrapper(obj) const toolkit = await ZapierToolKit.fromZapierNLAWrapper(zapier) diff --git a/packages/components/nodes/tools/ZapierNLA/zapier.png b/packages/components/nodes/tools/ZapierNLA/zapier.png deleted file mode 100644 index 769716fa..00000000 Binary files a/packages/components/nodes/tools/ZapierNLA/zapier.png and /dev/null differ diff --git a/packages/components/nodes/tools/ZapierNLA/zapier.svg b/packages/components/nodes/tools/ZapierNLA/zapier.svg new file mode 100644 index 00000000..6ed35f29 --- /dev/null +++ b/packages/components/nodes/tools/ZapierNLA/zapier.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts b/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts index 3ce93e87..8b84d33e 100644 --- a/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts +++ b/packages/components/nodes/vectorstores/Chroma_Existing/Chroma_Existing.ts @@ -6,6 +6,7 @@ import { getBaseClasses } from '../../../src/utils' class Chroma_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class Chroma_Existing_VectorStores implements INode { constructor() { this.label = 'Chroma Load Existing Index' this.name = 'chromaExistingIndex' + this.version = 1.0 this.type = 'Chroma' this.icon = 'chroma.svg' this.category = 'Vector Stores' @@ -69,7 +71,7 @@ class Chroma_Existing_VectorStores implements INode { const chromaURL = nodeData.inputs?.chromaURL as string const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const obj: { collectionName: string diff --git a/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts b/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts index f32fbb67..2be1bb3a 100644 --- a/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts +++ b/packages/components/nodes/vectorstores/Chroma_Upsert/Chroma_Upsert.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class ChromaUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -19,6 +20,7 @@ class ChromaUpsert_VectorStores implements INode { constructor() { this.label = 'Chroma Upsert Document' this.name = 'chromaUpsert' + this.version = 1.0 this.type = 'Chroma' this.icon = 'chroma.svg' this.category = 'Vector Stores' @@ -78,7 +80,7 @@ class ChromaUpsert_VectorStores implements INode { const chromaURL = nodeData.inputs?.chromaURL as string const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const flattenDocs = docs && docs.length ? flatten(docs) : [] const finalDocs = [] diff --git a/packages/components/nodes/vectorstores/Faiss_Existing/Faiss_Existing.ts b/packages/components/nodes/vectorstores/Faiss_Existing/Faiss_Existing.ts index 6dd18594..8c8d03a8 100644 --- a/packages/components/nodes/vectorstores/Faiss_Existing/Faiss_Existing.ts +++ b/packages/components/nodes/vectorstores/Faiss_Existing/Faiss_Existing.ts @@ -6,6 +6,7 @@ import { getBaseClasses } from '../../../src/utils' class Faiss_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -17,6 +18,7 @@ class Faiss_Existing_VectorStores implements INode { constructor() { this.label = 'Faiss Load Existing Index' this.name = 'faissExistingIndex' + this.version = 1.0 this.type = 'Faiss' this.icon = 'faiss.svg' this.category = 'Vector Stores' @@ -64,7 +66,7 @@ class Faiss_Existing_VectorStores implements INode { const basePath = nodeData.inputs?.basePath as string const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const vectorStore = await FaissStore.load(basePath, embeddings) diff --git a/packages/components/nodes/vectorstores/Faiss_Upsert/Faiss_Upsert.ts b/packages/components/nodes/vectorstores/Faiss_Upsert/Faiss_Upsert.ts index 5e5f9028..f56eccdf 100644 --- a/packages/components/nodes/vectorstores/Faiss_Upsert/Faiss_Upsert.ts +++ b/packages/components/nodes/vectorstores/Faiss_Upsert/Faiss_Upsert.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class FaissUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -19,6 +20,7 @@ class FaissUpsert_VectorStores implements INode { constructor() { this.label = 'Faiss Upsert Document' this.name = 'faissUpsert' + this.version = 1.0 this.type = 'Faiss' this.icon = 'faiss.svg' this.category = 'Vector Stores' @@ -73,7 +75,7 @@ class FaissUpsert_VectorStores implements INode { const output = nodeData.outputs?.output as string const basePath = nodeData.inputs?.basePath as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const flattenDocs = docs && docs.length ? flatten(docs) : [] const finalDocs = [] diff --git a/packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts b/packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts index 32a785a5..55a01e2b 100644 --- a/packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts +++ b/packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts @@ -8,6 +8,7 @@ import { flatten } from 'lodash' class InMemoryVectorStore_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -19,6 +20,7 @@ class InMemoryVectorStore_VectorStores implements INode { constructor() { this.label = 'In-Memory Vector Store' this.name = 'memoryVectorStore' + this.version = 1.0 this.type = 'Memory' this.icon = 'memory.svg' this.category = 'Vector Stores' @@ -64,7 +66,7 @@ class InMemoryVectorStore_VectorStores implements INode { const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const flattenDocs = docs && docs.length ? flatten(docs) : [] const finalDocs = [] diff --git a/packages/components/nodes/vectorstores/OpenSearch_Existing/OpenSearch_existing.ts b/packages/components/nodes/vectorstores/OpenSearch_Existing/OpenSearch_existing.ts index 7aeac919..c8d09470 100644 --- a/packages/components/nodes/vectorstores/OpenSearch_Existing/OpenSearch_existing.ts +++ b/packages/components/nodes/vectorstores/OpenSearch_Existing/OpenSearch_existing.ts @@ -7,6 +7,7 @@ import { getBaseClasses } from '../../../src/utils' class OpenSearch_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -18,6 +19,7 @@ class OpenSearch_Existing_VectorStores implements INode { constructor() { this.label = 'OpenSearch Load Existing Index' this.name = 'openSearchExistingIndex' + this.version = 1.0 this.type = 'OpenSearch' this.icon = 'opensearch.png' this.category = 'Vector Stores' @@ -70,7 +72,7 @@ class OpenSearch_Existing_VectorStores implements INode { const indexName = nodeData.inputs?.indexName as string const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const client = new Client({ nodes: [opensearchURL] diff --git a/packages/components/nodes/vectorstores/OpenSearch_Upsert/OpenSearch_Upsert.ts b/packages/components/nodes/vectorstores/OpenSearch_Upsert/OpenSearch_Upsert.ts index 8d54392b..c11d8b11 100644 --- a/packages/components/nodes/vectorstores/OpenSearch_Upsert/OpenSearch_Upsert.ts +++ b/packages/components/nodes/vectorstores/OpenSearch_Upsert/OpenSearch_Upsert.ts @@ -9,6 +9,7 @@ import { getBaseClasses } from '../../../src/utils' class OpenSearchUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string @@ -20,6 +21,7 @@ class OpenSearchUpsert_VectorStores implements INode { constructor() { this.label = 'OpenSearch Upsert Document' this.name = 'openSearchUpsertDocument' + this.version = 1.0 this.type = 'OpenSearch' this.icon = 'opensearch.png' this.category = 'Vector Stores' @@ -79,7 +81,7 @@ class OpenSearchUpsert_VectorStores implements INode { const indexName = nodeData.inputs?.indexName as string const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const flattenDocs = docs && docs.length ? flatten(docs) : [] const finalDocs = [] diff --git a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts index e57da396..2369165d 100644 --- a/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts +++ b/packages/components/nodes/vectorstores/Pinecone_Existing/Pinecone_Existing.ts @@ -1,44 +1,43 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { PineconeClient } from '@pinecone-database/pinecone' import { PineconeLibArgs, PineconeStore } from 'langchain/vectorstores/pinecone' import { Embeddings } from 'langchain/embeddings/base' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' class Pinecone_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Pinecone Load Existing Index' this.name = 'pineconeExistingIndex' + this.version = 1.0 this.type = 'Pinecone' this.icon = 'pinecone.png' this.category = 'Vector Stores' this.description = 'Load existing index from Pinecone (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['pineconeApi'] + } this.inputs = [ { label: 'Embeddings', name: 'embeddings', type: 'Embeddings' }, - { - label: 'Pinecone Api Key', - name: 'pineconeApiKey', - type: 'password' - }, - { - label: 'Pinecone Environment', - name: 'pineconeEnv', - type: 'string' - }, { label: 'Pinecone Index', name: 'pineconeIndex', @@ -83,16 +82,18 @@ class Pinecone_Existing_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { - const pineconeApiKey = nodeData.inputs?.pineconeApiKey as string - const pineconeEnv = nodeData.inputs?.pineconeEnv as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const index = nodeData.inputs?.pineconeIndex as string const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string const pineconeMetadataFilter = nodeData.inputs?.pineconeMetadataFilter const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData) + const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData) const client = new PineconeClient() await client.init({ diff --git a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts index ad1767c2..3d2a6497 100644 --- a/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts +++ b/packages/components/nodes/vectorstores/Pinecone_Upsert/Pinecone_Upsert.ts @@ -1,30 +1,39 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { PineconeClient } from '@pinecone-database/pinecone' import { PineconeLibArgs, PineconeStore } from 'langchain/vectorstores/pinecone' import { Embeddings } from 'langchain/embeddings/base' import { Document } from 'langchain/document' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { flatten } from 'lodash' class PineconeUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Pinecone Upsert Document' this.name = 'pineconeUpsert' + this.version = 1.0 this.type = 'Pinecone' this.icon = 'pinecone.png' this.category = 'Vector Stores' this.description = 'Upsert documents to Pinecone' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['pineconeApi'] + } this.inputs = [ { label: 'Document', @@ -37,16 +46,6 @@ class PineconeUpsert_VectorStores implements INode { name: 'embeddings', type: 'Embeddings' }, - { - label: 'Pinecone Api Key', - name: 'pineconeApiKey', - type: 'password' - }, - { - label: 'Pinecone Environment', - name: 'pineconeEnv', - type: 'string' - }, { label: 'Pinecone Index', name: 'pineconeIndex', @@ -84,16 +83,18 @@ class PineconeUpsert_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { - const pineconeApiKey = nodeData.inputs?.pineconeApiKey as string - const pineconeEnv = nodeData.inputs?.pineconeEnv as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const index = nodeData.inputs?.pineconeIndex as string const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string const docs = nodeData.inputs?.document as Document[] const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData) + const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData) const client = new PineconeClient() await client.init({ diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts b/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts index f1eef8f9..16f83b08 100644 --- a/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts +++ b/packages/components/nodes/vectorstores/Qdrant_Existing/Qdrant_Existing.ts @@ -1,28 +1,39 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { QdrantClient } from '@qdrant/js-client-rest' import { QdrantVectorStore, QdrantLibArgs } from 'langchain/vectorstores/qdrant' import { Embeddings } from 'langchain/embeddings/base' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' class Qdrant_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Qdrant Load Existing Index' this.name = 'qdrantExistingIndex' + this.version = 1.0 this.type = 'Qdrant' - this.icon = 'qdrant_logo.svg' + this.icon = 'qdrant.png' this.category = 'Vector Stores' this.description = 'Load existing index from Qdrant (i.e., documents have been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed when using Qdrant cloud hosted', + optional: true, + credentialNames: ['qdrantApi'] + } this.inputs = [ { label: 'Embeddings', @@ -40,12 +51,6 @@ class Qdrant_Existing_VectorStores implements INode { name: 'qdrantCollection', type: 'string' }, - { - label: 'Qdrant API Key', - name: 'qdrantApiKey', - type: 'password', - optional: true - }, { label: 'Qdrant Collection Cofiguration', name: 'qdrantCollectionCofiguration', @@ -77,17 +82,18 @@ class Qdrant_Existing_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const qdrantServerUrl = nodeData.inputs?.qdrantServerUrl as string const collectionName = nodeData.inputs?.qdrantCollection as string - const qdrantApiKey = nodeData.inputs?.qdrantApiKey as string let qdrantCollectionCofiguration = nodeData.inputs?.qdrantCollectionCofiguration const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData) - // connect to Qdrant Cloud const client = new QdrantClient({ url: qdrantServerUrl, apiKey: qdrantApiKey diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png new file mode 100644 index 00000000..ecb2a56d Binary files /dev/null and b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant.png differ diff --git a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg b/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg deleted file mode 100644 index 82fb8b39..00000000 --- a/packages/components/nodes/vectorstores/Qdrant_Existing/qdrant_logo.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts b/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts index dae1d31d..dcc3099d 100644 --- a/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts +++ b/packages/components/nodes/vectorstores/Qdrant_Upsert/Qdrant_Upsert.ts @@ -1,30 +1,41 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { QdrantClient } from '@qdrant/js-client-rest' import { QdrantVectorStore, QdrantLibArgs } from 'langchain/vectorstores/qdrant' import { Embeddings } from 'langchain/embeddings/base' import { Document } from 'langchain/document' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { flatten } from 'lodash' class QdrantUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Qdrant Upsert Document' this.name = 'qdrantUpsert' + this.version = 1.0 this.type = 'Qdrant' - this.icon = 'qdrant_logo.svg' + this.icon = 'qdrant.png' this.category = 'Vector Stores' this.description = 'Upsert documents to Qdrant' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed when using Qdrant cloud hosted', + optional: true, + credentialNames: ['qdrantApi'] + } this.inputs = [ { label: 'Document', @@ -48,12 +59,6 @@ class QdrantUpsert_VectorStores implements INode { name: 'qdrantCollection', type: 'string' }, - { - label: 'Qdrant API Key', - name: 'qdrantApiKey', - type: 'password', - optional: true - }, { label: 'Top K', name: 'topK', @@ -78,17 +83,18 @@ class QdrantUpsert_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const qdrantServerUrl = nodeData.inputs?.qdrantServerUrl as string const collectionName = nodeData.inputs?.qdrantCollection as string - const qdrantApiKey = nodeData.inputs?.qdrantApiKey as string const docs = nodeData.inputs?.document as Document[] const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const qdrantApiKey = getCredentialParam('qdrantApiKey', credentialData, nodeData) - // connect to Qdrant Cloud const client = new QdrantClient({ url: qdrantServerUrl, apiKey: qdrantApiKey diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png new file mode 100644 index 00000000..ecb2a56d Binary files /dev/null and b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant.png differ diff --git a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg b/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg deleted file mode 100644 index 82fb8b39..00000000 --- a/packages/components/nodes/vectorstores/Qdrant_Upsert/qdrant_logo.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/components/nodes/vectorstores/Singlestore_Existing/Singlestore_Existing.ts b/packages/components/nodes/vectorstores/Singlestore_Existing/Singlestore_Existing.ts index 1b37a400..c5f6fbce 100644 --- a/packages/components/nodes/vectorstores/Singlestore_Existing/Singlestore_Existing.ts +++ b/packages/components/nodes/vectorstores/Singlestore_Existing/Singlestore_Existing.ts @@ -1,27 +1,38 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { SingleStoreVectorStore, SingleStoreVectorStoreConfig } from 'langchain/vectorstores/singlestore' class SingleStoreExisting_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'SingleStore Load Existing Table' this.name = 'singlestoreExisting' + this.version = 1.0 this.type = 'SingleStore' this.icon = 'singlestore.svg' this.category = 'Vector Stores' this.description = 'Load existing document from SingleStore' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Needed when using SingleStore cloud hosted', + optional: true, + credentialNames: ['singleStoreApi'] + } this.inputs = [ { label: 'Embeddings', @@ -33,16 +44,6 @@ class SingleStoreExisting_VectorStores implements INode { name: 'host', type: 'string' }, - { - label: 'User', - name: 'user', - type: 'string' - }, - { - label: 'Password', - name: 'password', - type: 'password' - }, { label: 'Database', name: 'database', @@ -103,13 +104,17 @@ class SingleStoreExisting_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const user = getCredentialParam('user', credentialData, nodeData) + const password = getCredentialParam('password', credentialData, nodeData) + const singleStoreConnectionConfig = { connectionOptions: { host: nodeData.inputs?.host as string, port: 3306, - user: nodeData.inputs?.user as string, - password: nodeData.inputs?.password as string, + user, + password, database: nodeData.inputs?.database as string }, ...(nodeData.inputs?.tableName ? { tableName: nodeData.inputs.tableName as string } : {}), @@ -121,7 +126,7 @@ class SingleStoreExisting_VectorStores implements INode { const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 let vectorStore: SingleStoreVectorStore diff --git a/packages/components/nodes/vectorstores/Singlestore_Upsert/Singlestore_Upsert.ts b/packages/components/nodes/vectorstores/Singlestore_Upsert/Singlestore_Upsert.ts index eb00381d..9889a154 100644 --- a/packages/components/nodes/vectorstores/Singlestore_Upsert/Singlestore_Upsert.ts +++ b/packages/components/nodes/vectorstores/Singlestore_Upsert/Singlestore_Upsert.ts @@ -1,29 +1,40 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' import { Document } from 'langchain/document' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { SingleStoreVectorStore, SingleStoreVectorStoreConfig } from 'langchain/vectorstores/singlestore' import { flatten } from 'lodash' class SingleStoreUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'SingleStore Upsert Document' this.name = 'singlestoreUpsert' + this.version = 1.0 this.type = 'SingleStore' this.icon = 'singlestore.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to SingleStore' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Needed when using SingleStore cloud hosted', + optional: true, + credentialNames: ['singleStoreApi'] + } this.inputs = [ { label: 'Document', @@ -41,16 +52,6 @@ class SingleStoreUpsert_VectorStores implements INode { name: 'host', type: 'string' }, - { - label: 'User', - name: 'user', - type: 'string' - }, - { - label: 'Password', - name: 'password', - type: 'password' - }, { label: 'Database', name: 'database', @@ -111,13 +112,17 @@ class SingleStoreUpsert_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const user = getCredentialParam('user', credentialData, nodeData) + const password = getCredentialParam('password', credentialData, nodeData) + const singleStoreConnectionConfig = { connectionOptions: { host: nodeData.inputs?.host as string, port: 3306, - user: nodeData.inputs?.user as string, - password: nodeData.inputs?.password as string, + user, + password, database: nodeData.inputs?.database as string }, ...(nodeData.inputs?.tableName ? { tableName: nodeData.inputs.tableName as string } : {}), @@ -130,7 +135,7 @@ class SingleStoreUpsert_VectorStores implements INode { const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 const flattenDocs = docs && docs.length ? flatten(docs) : [] const finalDocs = [] diff --git a/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts b/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts index 173660ca..ed6febb5 100644 --- a/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts +++ b/packages/components/nodes/vectorstores/Supabase_Existing/Supabase_Exisiting.ts @@ -1,39 +1,43 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { SupabaseLibArgs, SupabaseVectorStore } from 'langchain/vectorstores/supabase' import { createClient } from '@supabase/supabase-js' class Supabase_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Supabase Load Existing Index' this.name = 'supabaseExistingIndex' + this.version = 1.0 this.type = 'Supabase' this.icon = 'supabase.svg' this.category = 'Vector Stores' this.description = 'Load existing index from Supabase (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['supabaseApi'] + } this.inputs = [ { label: 'Embeddings', name: 'embeddings', type: 'Embeddings' }, - { - label: 'Supabase API Key', - name: 'supabaseApiKey', - type: 'password' - }, { label: 'Supabase Project URL', name: 'supabaseProjUrl', @@ -80,8 +84,7 @@ class Supabase_Existing_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { - const supabaseApiKey = nodeData.inputs?.supabaseApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const supabaseProjUrl = nodeData.inputs?.supabaseProjUrl as string const tableName = nodeData.inputs?.tableName as string const queryName = nodeData.inputs?.queryName as string @@ -89,7 +92,10 @@ class Supabase_Existing_VectorStores implements INode { const supabaseMetadataFilter = nodeData.inputs?.supabaseMetadataFilter const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData) const client = createClient(supabaseProjUrl, supabaseApiKey) diff --git a/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts b/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts index 69997a56..90fe2121 100644 --- a/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts +++ b/packages/components/nodes/vectorstores/Supabase_Upsert/Supabase_Upsert.ts @@ -1,7 +1,7 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' import { Document } from 'langchain/document' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { SupabaseVectorStore } from 'langchain/vectorstores/supabase' import { createClient } from '@supabase/supabase-js' import { flatten } from 'lodash' @@ -9,22 +9,31 @@ import { flatten } from 'lodash' class SupabaseUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Supabase Upsert Document' this.name = 'supabaseUpsert' + this.version = 1.0 this.type = 'Supabase' this.icon = 'supabase.svg' this.category = 'Vector Stores' this.description = 'Upsert documents to Supabase' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['supabaseApi'] + } this.inputs = [ { label: 'Document', @@ -37,11 +46,6 @@ class SupabaseUpsert_VectorStores implements INode { name: 'embeddings', type: 'Embeddings' }, - { - label: 'Supabase API Key', - name: 'supabaseApiKey', - type: 'password' - }, { label: 'Supabase Project URL', name: 'supabaseProjUrl', @@ -81,8 +85,7 @@ class SupabaseUpsert_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { - const supabaseApiKey = nodeData.inputs?.supabaseApiKey as string + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const supabaseProjUrl = nodeData.inputs?.supabaseProjUrl as string const tableName = nodeData.inputs?.tableName as string const queryName = nodeData.inputs?.queryName as string @@ -90,7 +93,10 @@ class SupabaseUpsert_VectorStores implements INode { const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const supabaseApiKey = getCredentialParam('supabaseApiKey', credentialData, nodeData) const client = createClient(supabaseProjUrl, supabaseApiKey) diff --git a/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts b/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts index 595691bd..e35a3917 100644 --- a/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts +++ b/packages/components/nodes/vectorstores/Weaviate_Existing/Weaviate_Existing.ts @@ -1,28 +1,39 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import weaviate, { WeaviateClient, ApiKey } from 'weaviate-ts-client' import { WeaviateLibArgs, WeaviateStore } from 'langchain/vectorstores/weaviate' class Weaviate_Existing_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Weaviate Load Existing Index' this.name = 'weaviateExistingIndex' + this.version = 1.0 this.type = 'Weaviate' this.icon = 'weaviate.png' this.category = 'Vector Stores' this.description = 'Load existing index from Weaviate (i.e: Document has been upserted)' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed when using Weaviate cloud hosted', + optional: true, + credentialNames: ['weaviateApi'] + } this.inputs = [ { label: 'Embeddings', @@ -57,12 +68,6 @@ class Weaviate_Existing_VectorStores implements INode { type: 'string', placeholder: 'Test' }, - { - label: 'Weaviate API Key', - name: 'weaviateApiKey', - type: 'password', - optional: true - }, { label: 'Weaviate Text Key', name: 'weaviateTextKey', @@ -104,17 +109,19 @@ class Weaviate_Existing_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const weaviateScheme = nodeData.inputs?.weaviateScheme as string const weaviateHost = nodeData.inputs?.weaviateHost as string const weaviateIndex = nodeData.inputs?.weaviateIndex as string - const weaviateApiKey = nodeData.inputs?.weaviateApiKey as string const weaviateTextKey = nodeData.inputs?.weaviateTextKey as string const weaviateMetadataKeys = nodeData.inputs?.weaviateMetadataKeys as string const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData) const clientConfig: any = { scheme: weaviateScheme, diff --git a/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts b/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts index 06137426..a2f82831 100644 --- a/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts +++ b/packages/components/nodes/vectorstores/Weaviate_Upsert/Weaviate_Upsert.ts @@ -1,7 +1,7 @@ -import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { Embeddings } from 'langchain/embeddings/base' import { Document } from 'langchain/document' -import { getBaseClasses } from '../../../src/utils' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { WeaviateLibArgs, WeaviateStore } from 'langchain/vectorstores/weaviate' import weaviate, { WeaviateClient, ApiKey } from 'weaviate-ts-client' import { flatten } from 'lodash' @@ -9,22 +9,33 @@ import { flatten } from 'lodash' class WeaviateUpsert_VectorStores implements INode { label: string name: string + version: number description: string type: string icon: string category: string baseClasses: string[] inputs: INodeParams[] + credential: INodeParams outputs: INodeOutputsValue[] constructor() { this.label = 'Weaviate Upsert Document' this.name = 'weaviateUpsert' + this.version = 1.0 this.type = 'Weaviate' this.icon = 'weaviate.png' this.category = 'Vector Stores' this.description = 'Upsert documents to Weaviate' this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + description: 'Only needed when using Weaviate cloud hosted', + optional: true, + credentialNames: ['weaviateApi'] + } this.inputs = [ { label: 'Document', @@ -65,12 +76,6 @@ class WeaviateUpsert_VectorStores implements INode { type: 'string', placeholder: 'Test' }, - { - label: 'Weaviate API Key', - name: 'weaviateApiKey', - type: 'password', - optional: true - }, { label: 'Weaviate Text Key', name: 'weaviateTextKey', @@ -112,18 +117,20 @@ class WeaviateUpsert_VectorStores implements INode { ] } - async init(nodeData: INodeData): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const weaviateScheme = nodeData.inputs?.weaviateScheme as string const weaviateHost = nodeData.inputs?.weaviateHost as string const weaviateIndex = nodeData.inputs?.weaviateIndex as string - const weaviateApiKey = nodeData.inputs?.weaviateApiKey as string const weaviateTextKey = nodeData.inputs?.weaviateTextKey as string const weaviateMetadataKeys = nodeData.inputs?.weaviateMetadataKeys as string const docs = nodeData.inputs?.document as Document[] const embeddings = nodeData.inputs?.embeddings as Embeddings const output = nodeData.outputs?.output as string const topK = nodeData.inputs?.topK as string - const k = topK ? parseInt(topK, 10) : 4 + const k = topK ? parseFloat(topK) : 4 + + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const weaviateApiKey = getCredentialParam('weaviateApiKey', credentialData, nodeData) const clientConfig: any = { scheme: weaviateScheme, diff --git a/packages/components/package.json b/packages/components/package.json index e6dd178d..8a3eca6e 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "flowise-components", - "version": "1.2.17", + "version": "1.3.1", "description": "Flowiseai Components", "main": "dist/src/index", "types": "dist/src/index.d.ts", @@ -22,9 +22,9 @@ "@huggingface/inference": "^2.6.1", "@notionhq/client": "^2.2.8", "@opensearch-project/opensearch": "^1.2.0", - "@pinecone-database/pinecone": "^0.0.12", + "@pinecone-database/pinecone": "^0.0.14", "@qdrant/js-client-rest": "^1.2.2", - "@supabase/supabase-js": "^2.21.0", + "@supabase/supabase-js": "^2.29.0", "@types/js-yaml": "^4.0.5", "@types/jsdom": "^21.1.1", "axios": "^0.27.2", @@ -38,7 +38,7 @@ "form-data": "^4.0.0", "graphql": "^16.6.0", "html-to-text": "^9.0.5", - "langchain": "^0.0.112", + "langchain": "^0.0.117", "linkifyjs": "^4.1.1", "mammoth": "^1.5.1", "moment": "^2.29.3", diff --git a/packages/components/src/Interface.ts b/packages/components/src/Interface.ts index 47b5aba2..e883d056 100644 --- a/packages/components/src/Interface.ts +++ b/packages/components/src/Interface.ts @@ -59,6 +59,7 @@ export interface INodeParams { description?: string warning?: string options?: Array + credentialNames?: Array optional?: boolean | INodeDisplay step?: number rows?: number @@ -83,6 +84,7 @@ export interface INodeProperties { name: string type: string icon: string + version: number category: string baseClasses: string[] description?: string @@ -104,10 +106,18 @@ export interface INodeData extends INodeProperties { id: string inputs?: ICommonObject outputs?: ICommonObject + credential?: string instance?: any loadMethod?: string // method to load async options } +export interface INodeCredential { + label: string + name: string + description?: string + inputs?: INodeParams[] +} + export interface IMessage { message: string type: MessageType diff --git a/packages/components/src/utils.ts b/packages/components/src/utils.ts index e00f74e6..363dd026 100644 --- a/packages/components/src/utils.ts +++ b/packages/components/src/utils.ts @@ -3,6 +3,9 @@ import { load } from 'cheerio' import * as fs from 'fs' import * as path from 'path' import { JSDOM } from 'jsdom' +import { DataSource } from 'typeorm' +import { ICommonObject, IDatabaseEntity, INodeData } from './Interface' +import { AES, enc } from 'crypto-js' export const numberOrExpressionRegex = '^(\\d+\\.?\\d*|{{.*}})$' //return true if string consists only numbers OR expression {{}} export const notEmptyRegex = '(.|\\s)*\\S(.|\\s)*' //return true if string is not empty or blank @@ -336,7 +339,6 @@ export async function xmlScrape(currentURL: string, limit: number): Promise { @@ -347,6 +349,93 @@ export const getEnvironmentVariable = (name: string): string | undefined => { } } +/** + * Returns the path of encryption key + * @returns {string} + */ +const getEncryptionKeyFilePath = (): string => { + const checkPaths = [ + path.join(__dirname, '..', '..', 'encryption.key'), + path.join(__dirname, '..', '..', 'server', 'encryption.key'), + path.join(__dirname, '..', '..', '..', 'encryption.key'), + path.join(__dirname, '..', '..', '..', 'server', 'encryption.key'), + path.join(__dirname, '..', '..', '..', '..', 'encryption.key'), + path.join(__dirname, '..', '..', '..', '..', 'server', 'encryption.key'), + path.join(__dirname, '..', '..', '..', '..', '..', 'encryption.key'), + path.join(__dirname, '..', '..', '..', '..', '..', 'server', 'encryption.key') + ] + for (const checkPath of checkPaths) { + if (fs.existsSync(checkPath)) { + return checkPath + } + } + return '' +} + +const getEncryptionKeyPath = (): string => { + return process.env.SECRETKEY_PATH ? path.join(process.env.SECRETKEY_PATH, 'encryption.key') : getEncryptionKeyFilePath() +} + +/** + * Returns the encryption key + * @returns {Promise} + */ +const getEncryptionKey = async (): Promise => { + try { + return await fs.promises.readFile(getEncryptionKeyPath(), 'utf8') + } catch (error) { + throw new Error(error) + } +} + +/** + * Decrypt credential data + * @param {string} encryptedData + * @param {string} componentCredentialName + * @param {IComponentCredentials} componentCredentials + * @returns {Promise} + */ +const decryptCredentialData = async (encryptedData: string): Promise => { + const encryptKey = await getEncryptionKey() + const decryptedData = AES.decrypt(encryptedData, encryptKey) + try { + return JSON.parse(decryptedData.toString(enc.Utf8)) + } catch (e) { + console.error(e) + throw new Error('Credentials could not be decrypted.') + } +} + +/** + * Get credential data + * @param {string} selectedCredentialId + * @param {ICommonObject} options + * @returns {Promise} + */ +export const getCredentialData = async (selectedCredentialId: string, options: ICommonObject): Promise => { + const appDataSource = options.appDataSource as DataSource + const databaseEntities = options.databaseEntities as IDatabaseEntity + + try { + const credential = await appDataSource.getRepository(databaseEntities['Credential']).findOneBy({ + id: selectedCredentialId + }) + + if (!credential) return {} + + // Decrpyt credentialData + const decryptedCredentialData = await decryptCredentialData(credential.encryptedData) + + return decryptedCredentialData + } catch (e) { + throw new Error(e) + } +} + +export const getCredentialParam = (paramName: string, credentialData: ICommonObject, nodeData: INodeData): any => { + return (nodeData.inputs as ICommonObject)[paramName] ?? credentialData[paramName] ?? undefined +} + // reference https://www.freeformatter.com/json-escape.html const jsonEscapeCharacters = [ { escape: '"', value: 'FLOWISE_DOUBLE_QUOTE' }, @@ -381,37 +470,6 @@ export function handleEscapeCharacters(input: any, reverse: Boolean): any { return input } -/* - * List of dependencies allowed to be import in vm2 - */ -export const availableDependencies = [ - '@dqbd/tiktoken', - '@getzep/zep-js', - '@huggingface/inference', - '@pinecone-database/pinecone', - '@supabase/supabase-js', - 'axios', - 'cheerio', - 'chromadb', - 'cohere-ai', - 'd3-dsv', - 'form-data', - 'graphql', - 'html-to-text', - 'langchain', - 'linkifyjs', - 'mammoth', - 'moment', - 'node-fetch', - 'pdf-parse', - 'pdfjs-dist', - 'playwright', - 'puppeteer', - 'srt-parser-2', - 'typeorm', - 'weaviate-ts-client' -] - export const getUserHome = (): string => { let variableName = 'HOME' if (process.platform === 'win32') { @@ -419,8 +477,7 @@ export const getUserHome = (): string => { } if (process.env[variableName] === undefined) { - // If for some reason the variable does not exist - // fall back to current folder + // If for some reason the variable does not exist, fall back to current folder return process.cwd() } return process.env[variableName] as string diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index f4bdbd6a..d213dabc 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -16,5 +16,5 @@ "declaration": true, "module": "commonjs" }, - "include": ["src", "nodes"] + "include": ["src", "nodes", "credentials"] } diff --git a/packages/server/.env.example b/packages/server/.env.example index 1b33382b..1e10452c 100644 --- a/packages/server/.env.example +++ b/packages/server/.env.example @@ -1,19 +1,21 @@ PORT=3000 -OVERRIDE_DATABASE=true -DATABASE_TYPE=sqlite +PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key # DATABASE_PATH=/your_database_path/.flowise -# When database is not sqlite +# APIKEY_PATH=/your_api_key_path/.flowise +# SECRETKEY_PATH=/your_api_key_path/.flowise +# LOG_PATH=/your_log_path/.flowise/logs + +# DATABASE_TYPE=postgres # DATABASE_PORT="" # DATABASE_HOST="" # DATABASE_NAME="flowise" # DATABASE_USER="" # DATABASE_PASSWORD="" +# OVERRIDE_DATABASE=true # FLOWISE_USERNAME=user # FLOWISE_PASSWORD=1234 # DEBUG=true -# APIKEY_PATH=/your_api_key_path/.flowise -# LOG_PATH=/your_log_path/.flowise/logs # LOG_LEVEL=debug (error | warn | info | verbose | debug) # EXECUTION_MODE=main (child | main) # TOOL_FUNCTION_BUILTIN_DEP=crypto,fs diff --git a/packages/server/README.md b/packages/server/README.md index e95a1643..6c3bc7f9 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -31,28 +31,7 @@ FLOWISE_PASSWORD=1234 ## 🌱 Env Variables -Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables) - -| Variable | Description | Type | Default | -| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- | -| PORT | The HTTP port Flowise runs on | Number | 3000 | -| FLOWISE_USERNAME | Username to login | String | | -| FLOWISE_PASSWORD | Password to login | String | | -| DEBUG | Print logs from components | Boolean | | -| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` | -| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` | -| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` | -| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` | -| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | | -| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | | -| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` | -| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` | -| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` | -| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_USERNAME | Database username (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | | -| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | | +Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://github.com/FlowiseAI/Flowise/blob/main/CONTRIBUTING.md#-env-variables) You can also specify the env variables when using `npx`. For example: diff --git a/packages/server/marketplaces/chatflows/API Agent OpenAI.json b/packages/server/marketplaces/chatflows/API Agent OpenAI.json new file mode 100644 index 00000000..01e3d8f9 --- /dev/null +++ b/packages/server/marketplaces/chatflows/API Agent OpenAI.json @@ -0,0 +1,650 @@ +{ + "description": "Use OpenAI Function Agent and Chain to automatically decide which API to call, generating url and body request from conversation", + "nodes": [ + { + "width": 300, + "height": 510, + "id": "openApiChain_1", + "position": { + "x": 1203.1825726424859, + "y": 300.7226683414998 + }, + "type": "customNode", + "data": { + "id": "openApiChain_1", + "label": "OpenAPI Chain", + "name": "openApiChain", + "version": 1, + "type": "OpenAPIChain", + "baseClasses": ["OpenAPIChain", "BaseChain"], + "category": "Chains", + "description": "Chain that automatically select and call APIs based only on an OpenAPI spec", + "inputParams": [ + { + "label": "YAML Link", + "name": "yamlLink", + "type": "string", + "placeholder": "https://api.speak.com/openapi.yaml", + "description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead", + "id": "openApiChain_1-input-yamlLink-string" + }, + { + "label": "YAML File", + "name": "yamlFile", + "type": "file", + "fileType": ".yaml", + "description": "If YAML link is provided, uploaded YAML File will be ignored and YAML link will be used instead", + "id": "openApiChain_1-input-yamlFile-file" + }, + { + "label": "Headers", + "name": "headers", + "type": "json", + "additionalParams": true, + "optional": true, + "id": "openApiChain_1-input-headers-json" + } + ], + "inputAnchors": [ + { + "label": "ChatOpenAI Model", + "name": "model", + "type": "ChatOpenAI", + "id": "openApiChain_1-input-model-ChatOpenAI" + } + ], + "inputs": { + "model": "{{chatOpenAI_1.data.instance}}", + "yamlLink": "https://gist.githubusercontent.com/roaldnefs/053e505b2b7a807290908fe9aa3e1f00/raw/0a212622ebfef501163f91e23803552411ed00e4/openapi.yaml", + "headers": "" + }, + "outputAnchors": [ + { + "id": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain", + "name": "openApiChain", + "label": "OpenAPIChain", + "type": "OpenAPIChain | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1203.1825726424859, + "y": 300.7226683414998 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_1", + "position": { + "x": 792.3201947594027, + "y": 293.61889966751846 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_1", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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_1-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_1-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_1-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 792.3201947594027, + "y": 293.61889966751846 + }, + "dragging": false + }, + { + "width": 300, + "height": 602, + "id": "chainTool_0", + "position": { + "x": 1635.3466862861876, + "y": 272.3189405402944 + }, + "type": "customNode", + "data": { + "id": "chainTool_0", + "label": "Chain Tool", + "name": "chainTool", + "version": 1, + "type": "ChainTool", + "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Use a chain as allowed tool for agent", + "inputParams": [ + { + "label": "Chain Name", + "name": "name", + "type": "string", + "placeholder": "state-of-union-qa", + "id": "chainTool_0-input-name-string" + }, + { + "label": "Chain Description", + "name": "description", + "type": "string", + "rows": 3, + "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", + "id": "chainTool_0-input-description-string" + }, + { + "label": "Return Direct", + "name": "returnDirect", + "type": "boolean", + "optional": true, + "id": "chainTool_0-input-returnDirect-boolean" + } + ], + "inputAnchors": [ + { + "label": "Base Chain", + "name": "baseChain", + "type": "BaseChain", + "id": "chainTool_0-input-baseChain-BaseChain" + } + ], + "inputs": { + "name": "comic-qa", + "description": "useful for when you need to ask question about comic", + "returnDirect": "", + "baseChain": "{{openApiChain_1.data.instance}}" + }, + "outputAnchors": [ + { + "id": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool", + "name": "chainTool", + "label": "ChainTool", + "type": "ChainTool | DynamicTool | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1635.3466862861876, + "y": 272.3189405402944 + }, + "dragging": false + }, + { + "width": 300, + "height": 383, + "id": "openAIFunctionAgent_0", + "position": { + "x": 2076.1829525256576, + "y": 706.1299276365058 + }, + "type": "customNode", + "data": { + "id": "openAIFunctionAgent_0", + "label": "OpenAI Function Agent", + "name": "openAIFunctionAgent", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call", + "inputParams": [ + { + "label": "System Message", + "name": "systemMessage", + "type": "string", + "rows": 4, + "optional": true, + "additionalParams": true, + "id": "openAIFunctionAgent_0-input-systemMessage-string" + } + ], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "openAIFunctionAgent_0-input-tools-Tool" + }, + { + "label": "Memory", + "name": "memory", + "type": "BaseChatMemory", + "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory" + }, + { + "label": "OpenAI Chat Model", + "name": "model", + "description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info", + "type": "BaseChatModel", + "id": "openAIFunctionAgent_0-input-model-BaseChatModel" + } + ], + "inputs": { + "tools": ["{{chainTool_0.data.instance}}"], + "memory": "{{bufferMemory_0.data.instance}}", + "model": "{{chatOpenAI_2.data.instance}}", + "systemMessage": "" + }, + "outputAnchors": [ + { + "id": "openAIFunctionAgent_0-output-openAIFunctionAgent-AgentExecutor|BaseChain", + "name": "openAIFunctionAgent", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2076.1829525256576, + "y": 706.1299276365058 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_2", + "position": { + "x": 1645.450699499575, + "y": 992.6341744217375 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_2", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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_2-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_2-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_2-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_2-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1645.450699499575, + "y": 992.6341744217375 + }, + "dragging": false + }, + { + "width": 300, + "height": 376, + "id": "bufferMemory_0", + "position": { + "x": 1148.8461056155377, + "y": 967.8215757228843 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_0", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_0-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1148.8461056155377, + "y": 967.8215757228843 + }, + "selected": false + } + ], + "edges": [ + { + "source": "chatOpenAI_1", + "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "openApiChain_1", + "targetHandle": "openApiChain_1-input-model-ChatOpenAI", + "type": "buttonedge", + "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openApiChain_1-openApiChain_1-input-model-ChatOpenAI", + "data": { + "label": "" + } + }, + { + "source": "openApiChain_1", + "sourceHandle": "openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain", + "target": "chainTool_0", + "targetHandle": "chainTool_0-input-baseChain-BaseChain", + "type": "buttonedge", + "id": "openApiChain_1-openApiChain_1-output-openApiChain-OpenAPIChain|BaseChain-chainTool_0-chainTool_0-input-baseChain-BaseChain", + "data": { + "label": "" + } + }, + { + "source": "chainTool_0", + "sourceHandle": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool", + "target": "openAIFunctionAgent_0", + "targetHandle": "openAIFunctionAgent_0-input-tools-Tool", + "type": "buttonedge", + "id": "chainTool_0-chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_2", + "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "openAIFunctionAgent_0", + "targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel", + "data": { + "label": "" + } + }, + { + "source": "bufferMemory_0", + "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "target": "openAIFunctionAgent_0", + "targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory", + "type": "buttonedge", + "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory", + "data": { + "label": "" + } + } + ] +} diff --git a/packages/server/marketplaces/chatflows/API Agent.json b/packages/server/marketplaces/chatflows/API Agent.json index 8ca79926..b9862add 100644 --- a/packages/server/marketplaces/chatflows/API Agent.json +++ b/packages/server/marketplaces/chatflows/API Agent.json @@ -14,6 +14,7 @@ "id": "getApiChain_0", "label": "GET API Chain", "name": "getApiChain", + "version": 1, "type": "GETApiChain", "baseClasses": ["GETApiChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -89,89 +90,6 @@ }, "dragging": false }, - { - "width": 300, - "height": 383, - "id": "conversationalAgent_0", - "position": { - "x": 1993.8540808923876, - "y": 952.6297081192247 - }, - "type": "customNode", - "data": { - "id": "conversationalAgent_0", - "label": "Conversational Agent", - "name": "conversationalAgent", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], - "category": "Agents", - "description": "Conversational agent for a chat model. It will utilize chat specific prompts", - "inputParams": [ - { - "label": "System Message", - "name": "systemMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "conversationalAgent_0-input-systemMessage-string" - }, - { - "label": "Human Message", - "name": "humanMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "conversationalAgent_0-input-humanMessage-string" - } - ], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "conversationalAgent_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "conversationalAgent_0-input-model-BaseLanguageModel" - }, - { - "label": "Memory", - "name": "memory", - "type": "BaseChatMemory", - "id": "conversationalAgent_0-input-memory-BaseChatMemory" - } - ], - "inputs": { - "tools": ["{{chainTool_0.data.instance}}", "{{chainTool_1.data.instance}}"], - "model": "{{chatOpenAI_0.data.instance}}", - "memory": "{{bufferMemory_0.data.instance}}", - "systemMessage": "", - "humanMessage": "" - }, - "outputAnchors": [ - { - "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain|BaseLangChain", - "name": "conversationalAgent", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1993.8540808923876, - "y": 952.6297081192247 - }, - "dragging": false - }, { "width": 300, "height": 602, @@ -185,6 +103,7 @@ "id": "chainTool_0", "label": "Chain Tool", "name": "chainTool", + "version": 1, "type": "ChainTool", "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], "category": "Tools", @@ -245,157 +164,6 @@ }, "dragging": false }, - { - "width": 300, - "height": 524, - "id": "chatOpenAI_0", - "position": { - "x": 1270.7548070814019, - "y": 1565.864417576483 - }, - "type": "customNode", - "data": { - "id": "chatOpenAI_0", - "label": "ChatOpenAI", - "name": "chatOpenAI", - "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], - "category": "Chat Models", - "description": "Wrapper around OpenAI large language models that use the Chat endpoint", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" - }, - { - "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", - "default": 0.9, - "optional": true, - "id": "chatOpenAI_0-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-topP-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-presencePenalty-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "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" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "gpt-3.5-turbo", - "temperature": 0.9, - "maxTokens": "", - "topP": "", - "frequencyPenalty": "", - "presencePenalty": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "name": "chatOpenAI", - "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1270.7548070814019, - "y": 1565.864417576483 - }, - "dragging": false - }, { "width": 300, "height": 376, @@ -409,6 +177,7 @@ "id": "bufferMemory_0", "label": "Buffer Memory", "name": "bufferMemory", + "version": 1, "type": "BufferMemory", "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], "category": "Memory", @@ -454,143 +223,66 @@ }, { "width": 300, - "height": 524, - "id": "chatOpenAI_1", + "height": 602, + "id": "chainTool_1", "position": { - "x": 865.4424095725009, - "y": 350.7505181391267 + "x": 1284.7746596034926, + "y": 895.1444797047182 }, "type": "customNode", "data": { - "id": "chatOpenAI_1", - "label": "ChatOpenAI", - "name": "chatOpenAI", - "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], - "category": "Chat Models", - "description": "Wrapper around OpenAI large language models that use the Chat endpoint", + "id": "chainTool_1", + "label": "Chain Tool", + "name": "chainTool", + "version": 1, + "type": "ChainTool", + "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Use a chain as allowed tool for agent", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" - }, - { - "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_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.9, - "optional": true, - "id": "chatOpenAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-topP-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-presencePenalty-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", + "label": "Chain Name", + "name": "name", "type": "string", + "placeholder": "state-of-union-qa", + "id": "chainTool_1-input-name-string" + }, + { + "label": "Chain Description", + "name": "description", + "type": "string", + "rows": 3, + "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", + "id": "chainTool_1-input-description-string" + }, + { + "label": "Return Direct", + "name": "returnDirect", + "type": "boolean", "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-basepath-string" + "id": "chainTool_1-input-returnDirect-boolean" + } + ], + "inputAnchors": [ + { + "label": "Base Chain", + "name": "baseChain", + "type": "BaseChain", + "id": "chainTool_1-input-baseChain-BaseChain" } ], - "inputAnchors": [], "inputs": { - "modelName": "gpt-3.5-turbo", - "temperature": 0.9, - "maxTokens": "", - "topP": "", - "frequencyPenalty": "", - "presencePenalty": "", - "timeout": "" + "name": "discord-bot", + "description": "useful for when you need to send message to Discord", + "returnDirect": "", + "baseChain": "{{postApiChain_0.data.instance}}" }, "outputAnchors": [ { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "name": "chatOpenAI", - "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "id": "chainTool_1-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", + "name": "chainTool", + "label": "ChainTool", + "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" } ], "outputs": {}, @@ -598,34 +290,125 @@ }, "selected": false, "positionAbsolute": { - "x": 865.4424095725009, - "y": 350.7505181391267 + "x": 1284.7746596034926, + "y": 895.1444797047182 }, "dragging": false }, { "width": 300, - "height": 524, + "height": 459, + "id": "postApiChain_0", + "position": { + "x": 933.3631140153886, + "y": 974.8756002461283 + }, + "type": "customNode", + "data": { + "id": "postApiChain_0", + "label": "POST API Chain", + "name": "postApiChain", + "version": 1, + "type": "POSTApiChain", + "baseClasses": ["POSTApiChain", "BaseChain", "BaseLangChain"], + "category": "Chains", + "description": "Chain to run queries against POST API", + "inputParams": [ + { + "label": "API Documentation", + "name": "apiDocs", + "type": "string", + "description": "Description of how API works. Please refer to more examples", + "rows": 4, + "id": "postApiChain_0-input-apiDocs-string" + }, + { + "label": "Headers", + "name": "headers", + "type": "json", + "additionalParams": true, + "optional": true, + "id": "postApiChain_0-input-headers-json" + }, + { + "label": "URL Prompt", + "name": "urlPrompt", + "type": "string", + "description": "Prompt used to tell LLMs how to construct the URL. Must contains {api_docs} and {question}", + "default": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string:", + "rows": 4, + "additionalParams": true, + "id": "postApiChain_0-input-urlPrompt-string" + }, + { + "label": "Answer Prompt", + "name": "ansPrompt", + "type": "string", + "description": "Prompt used to tell LLMs how to return the API response. Must contains {api_response}, {api_url}, and {question}", + "default": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string: {api_url_body}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:", + "rows": 4, + "additionalParams": true, + "id": "postApiChain_0-input-ansPrompt-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "postApiChain_0-input-model-BaseLanguageModel" + } + ], + "inputs": { + "model": "{{chatOpenAI_2.data.instance}}", + "apiDocs": "API documentation:\nEndpoint: https://eog776prcv6dg0j.m.pipedream.net\n\nThis API is for sending Discord message\n\nQuery body table:\nmessage | string | Message to send | required\n\nResponse schema (string):\nresult | string", + "headers": "", + "urlPrompt": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string:", + "ansPrompt": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string: {api_url_body}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:" + }, + "outputAnchors": [ + { + "id": "postApiChain_0-output-postApiChain-POSTApiChain|BaseChain|BaseLangChain", + "name": "postApiChain", + "label": "POSTApiChain", + "type": "POSTApiChain | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 933.3631140153886, + "y": 974.8756002461283 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, "id": "chatOpenAI_2", "position": { - "x": 587.6425146349426, - "y": 917.1494176892741 + "x": 572.8941615312035, + "y": 937.8425220917356 }, "type": "customNode", "data": { "id": "chatOpenAI_2", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_2-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_2-input-credential-credential" }, { "label": "Model Name", @@ -734,14 +517,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -749,72 +533,153 @@ }, "selected": false, "positionAbsolute": { - "x": 587.6425146349426, - "y": 917.1494176892741 + "x": 572.8941615312035, + "y": 937.8425220917356 }, "dragging": false }, { "width": 300, - "height": 602, - "id": "chainTool_1", + "height": 523, + "id": "chatOpenAI_1", "position": { - "x": 1284.7746596034926, - "y": 895.1444797047182 + "x": 828.7788305309582, + "y": 302.8996144964516 }, "type": "customNode", "data": { - "id": "chainTool_1", - "label": "Chain Tool", - "name": "chainTool", - "type": "ChainTool", - "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Use a chain as allowed tool for agent", + "id": "chatOpenAI_1", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "Chain Name", - "name": "name", - "type": "string", - "placeholder": "state-of-union-qa", - "id": "chainTool_1-input-name-string" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_1-input-credential-credential" }, { - "label": "Chain Description", - "name": "description", - "type": "string", - "rows": 3, - "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", - "id": "chainTool_1-input-description-string" - }, - { - "label": "Return Direct", - "name": "returnDirect", - "type": "boolean", + "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": "chainTool_1-input-returnDirect-boolean" - } - ], - "inputAnchors": [ + "id": "chatOpenAI_1-input-modelName-options" + }, { - "label": "Base Chain", - "name": "baseChain", - "type": "BaseChain", - "id": "chainTool_1-input-baseChain-BaseChain" + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_1-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_1-input-basepath-string" } ], + "inputAnchors": [], "inputs": { - "name": "discord-bot", - "description": "useful for when you need to send message to Discord", - "returnDirect": "", - "baseChain": "{{postApiChain_0.data.instance}}" + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chainTool_1-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", - "name": "chainTool", - "label": "ChainTool", - "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" + "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -822,98 +687,239 @@ }, "selected": false, "positionAbsolute": { - "x": 1284.7746596034926, - "y": 895.1444797047182 + "x": 828.7788305309582, + "y": 302.8996144964516 }, "dragging": false }, { "width": 300, - "height": 459, - "id": "postApiChain_0", + "height": 523, + "id": "chatOpenAI_3", "position": { - "x": 933.3631140153886, - "y": 974.8756002461283 + "x": 1148.338912314111, + "y": 1561.0888070167944 }, "type": "customNode", "data": { - "id": "postApiChain_0", - "label": "POST API Chain", - "name": "postApiChain", - "type": "POSTApiChain", - "baseClasses": ["POSTApiChain", "BaseChain", "BaseLangChain"], - "category": "Chains", - "description": "Chain to run queries against POST API", + "id": "chatOpenAI_3", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "category": "Chat Models", + "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "API Documentation", - "name": "apiDocs", - "type": "string", - "description": "Description of how API works. Please refer to more examples", - "rows": 4, - "id": "postApiChain_0-input-apiDocs-string" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_3-input-credential-credential" }, { - "label": "Headers", - "name": "headers", - "type": "json", - "additionalParams": true, + "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": "postApiChain_0-input-headers-json" + "id": "chatOpenAI_3-input-modelName-options" }, { - "label": "URL Prompt", - "name": "urlPrompt", - "type": "string", - "description": "Prompt used to tell LLMs how to construct the URL. Must contains {api_docs} and {question}", - "default": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string:", - "rows": 4, - "additionalParams": true, - "id": "postApiChain_0-input-urlPrompt-string" + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_3-input-temperature-number" }, { - "label": "Answer Prompt", - "name": "ansPrompt", - "type": "string", - "description": "Prompt used to tell LLMs how to return the API response. Must contains {api_response}, {api_url}, and {question}", - "default": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string: {api_url_body}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:", - "rows": 4, + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, "additionalParams": true, - "id": "postApiChain_0-input-ansPrompt-string" + "id": "chatOpenAI_3-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_3-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_3-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_3-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_3-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_3-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_3-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1148.338912314111, + "y": 1561.0888070167944 + }, + "dragging": false + }, + { + "width": 300, + "height": 383, + "id": "conversationalAgent_0", + "position": { + "x": 2114.071431691489, + "y": 941.7926368551367 + }, + "type": "customNode", + "data": { + "id": "conversationalAgent_0", + "label": "Conversational Agent", + "name": "conversationalAgent", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "Conversational agent for a chat model. It will utilize chat specific prompts", + "inputParams": [ + { + "label": "System Message", + "name": "systemMessage", + "type": "string", + "rows": 4, + "default": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.", + "optional": true, + "additionalParams": true, + "id": "conversationalAgent_0-input-systemMessage-string" } ], "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "conversationalAgent_0-input-tools-Tool" + }, { "label": "Language Model", "name": "model", "type": "BaseLanguageModel", - "id": "postApiChain_0-input-model-BaseLanguageModel" + "id": "conversationalAgent_0-input-model-BaseLanguageModel" + }, + { + "label": "Memory", + "name": "memory", + "type": "BaseChatMemory", + "id": "conversationalAgent_0-input-memory-BaseChatMemory" } ], "inputs": { - "model": "{{chatOpenAI_2.data.instance}}", - "apiDocs": "API documentation:\nEndpoint: https://eog776prcv6dg0j.m.pipedream.net\n\nThis API is for sending Discord message\n\nQuery body table:\nmessage | string | Message to send | required\n\nResponse schema (string):\nresult | string", - "headers": "", - "urlPrompt": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string:", - "ansPrompt": "You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, which is the API url to call for answering the user question.\nThe value of \"data\" should be a dictionary of key-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string.\nYou should build the json string in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\njson string: {api_url_body}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:" + "tools": ["{{chainTool_0.data.instance}}", "{{chainTool_1.data.instance}}"], + "model": "{{chatOpenAI_3.data.instance}}", + "memory": "{{bufferMemory_0.data.instance}}", + "systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist." }, "outputAnchors": [ { - "id": "postApiChain_0-output-postApiChain-POSTApiChain|BaseChain|BaseLangChain", - "name": "postApiChain", - "label": "POSTApiChain", - "type": "POSTApiChain | BaseChain | BaseLangChain" + "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain", + "name": "conversationalAgent", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" } ], "outputs": {}, "selected": false }, "selected": false, + "dragging": false, "positionAbsolute": { - "x": 933.3631140153886, - "y": 974.8756002461283 - }, - "dragging": false + "x": 2114.071431691489, + "y": 941.7926368551367 + } } ], "edges": [ @@ -928,50 +934,6 @@ "label": "" } }, - { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "conversationalAgent_0", - "targetHandle": "conversationalAgent_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "bufferMemory_0", - "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "target": "conversationalAgent_0", - "targetHandle": "conversationalAgent_0-input-memory-BaseChatMemory", - "type": "buttonedge", - "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-conversationalAgent_0-conversationalAgent_0-input-memory-BaseChatMemory", - "data": { - "label": "" - } - }, - { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "getApiChain_0", - "targetHandle": "getApiChain_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-getApiChain_0-getApiChain_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "chatOpenAI_2", - "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "postApiChain_0", - "targetHandle": "postApiChain_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-postApiChain_0-postApiChain_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "postApiChain_0", "sourceHandle": "postApiChain_0-output-postApiChain-POSTApiChain|BaseChain|BaseLangChain", @@ -983,6 +945,28 @@ "label": "" } }, + { + "source": "chatOpenAI_2", + "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "postApiChain_0", + "targetHandle": "postApiChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-postApiChain_0-postApiChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_1", + "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "getApiChain_0", + "targetHandle": "getApiChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-getApiChain_0-getApiChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, { "source": "chainTool_0", "sourceHandle": "chainTool_0-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", @@ -1004,6 +988,28 @@ "data": { "label": "" } + }, + { + "source": "chatOpenAI_3", + "sourceHandle": "chatOpenAI_3-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "conversationalAgent_0", + "targetHandle": "conversationalAgent_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_3-chatOpenAI_3-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "bufferMemory_0", + "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "target": "conversationalAgent_0", + "targetHandle": "conversationalAgent_0-input-memory-BaseChatMemory", + "type": "buttonedge", + "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-conversationalAgent_0-conversationalAgent_0-input-memory-BaseChatMemory", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Antonym.json b/packages/server/marketplaces/chatflows/Antonym.json index 817e3ee9..95d3c151 100644 --- a/packages/server/marketplaces/chatflows/Antonym.json +++ b/packages/server/marketplaces/chatflows/Antonym.json @@ -14,6 +14,7 @@ "id": "fewShotPromptTemplate_1", "label": "Few Shot Prompt Template", "name": "fewShotPromptTemplate", + "version": 1, "type": "FewShotPromptTemplate", "baseClasses": ["FewShotPromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -102,239 +103,6 @@ }, "dragging": false }, - { - "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 1224.5139327142097, - "y": -30.864315286062364 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": 0.7, - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1224.5139327142097, - "y": -30.864315286062364 - }, - "dragging": false - }, - { - "width": 300, - "height": 405, - "id": "llmChain_1", - "position": { - "x": 1635.363191180743, - "y": 450.00105475193766 - }, - "type": "customNode", - "data": { - "id": "llmChain_1", - "label": "LLM Chain", - "name": "llmChain", - "type": "LLMChain", - "baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"], - "category": "Chains", - "description": "Chain to run queries against LLMs", - "inputParams": [ - { - "label": "Chain Name", - "name": "chainName", - "type": "string", - "placeholder": "Name Your Chain", - "optional": true, - "id": "llmChain_1-input-chainName-string" - } - ], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "llmChain_1-input-model-BaseLanguageModel" - }, - { - "label": "Prompt", - "name": "prompt", - "type": "BasePromptTemplate", - "id": "llmChain_1-input-prompt-BasePromptTemplate" - } - ], - "inputs": { - "model": "{{openAI_1.data.instance}}", - "prompt": "{{fewShotPromptTemplate_1.data.instance}}", - "chainName": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "llmChain_1-output-llmChain-LLMChain|BaseChain|BaseLangChain", - "name": "llmChain", - "label": "LLM Chain", - "type": "LLMChain | BaseChain | BaseLangChain" - }, - { - "id": "llmChain_1-output-outputPrediction-string|json", - "name": "outputPrediction", - "label": "Output Prediction", - "type": "string | json" - } - ], - "default": "llmChain" - } - ], - "outputs": { - "output": "llmChain" - }, - "selected": false - }, - "positionAbsolute": { - "x": 1635.363191180743, - "y": 450.00105475193766 - }, - "selected": false, - "dragging": false - }, { "width": 300, "height": 475, @@ -348,6 +116,7 @@ "id": "promptTemplate_0", "label": "Prompt Template", "name": "promptTemplate", + "version": 1, "type": "PromptTemplate", "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -393,31 +162,244 @@ "y": -33.31673494170347 }, "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 1226.7977900193628, + "y": 48.01100655894436 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1226.7977900193628, + "y": 48.01100655894436 + }, + "dragging": false + }, + { + "width": 300, + "height": 405, + "id": "llmChain_0", + "position": { + "x": 1573.7490072386481, + "y": 429.1905949837192 + }, + "type": "customNode", + "data": { + "id": "llmChain_0", + "label": "LLM Chain", + "name": "llmChain", + "version": 1, + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_0-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_0-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_0-input-prompt-BasePromptTemplate" + } + ], + "inputs": { + "model": "{{chatOpenAI_0.data.instance}}", + "prompt": "{{fewShotPromptTemplate_1.data.instance}}", + "chainName": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_0-output-llmChain-LLMChain|BaseChain", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain" + }, + { + "id": "llmChain_0-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1573.7490072386481, + "y": 429.1905949837192 + }, + "dragging": false } ], "edges": [ - { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-llmChain_1-llmChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "fewShotPromptTemplate_1", - "sourceHandle": "fewShotPromptTemplate_1-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-prompt-BasePromptTemplate", - "type": "buttonedge", - "id": "fewShotPromptTemplate_1-fewShotPromptTemplate_1-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_1-llmChain_1-input-prompt-BasePromptTemplate", - "data": { - "label": "" - } - }, { "source": "promptTemplate_0", "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", @@ -428,6 +410,28 @@ "data": { "label": "" } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-llmChain_0-llmChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "fewShotPromptTemplate_1", + "sourceHandle": "fewShotPromptTemplate_1-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-prompt-BasePromptTemplate", + "type": "buttonedge", + "id": "fewShotPromptTemplate_1-fewShotPromptTemplate_1-output-fewShotPromptTemplate-FewShotPromptTemplate|BaseStringPromptTemplate|BasePromptTemplate-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/AutoGPT.json b/packages/server/marketplaces/chatflows/AutoGPT.json index 47926272..53837151 100644 --- a/packages/server/marketplaces/chatflows/AutoGPT.json +++ b/packages/server/marketplaces/chatflows/AutoGPT.json @@ -3,7 +3,7 @@ "nodes": [ { "width": 300, - "height": 629, + "height": 627, "id": "autoGPT_0", "position": { "x": 1627.8124366169843, @@ -14,6 +14,7 @@ "id": "autoGPT_0", "label": "AutoGPT", "name": "autoGPT", + "version": 1, "type": "AutoGPT", "baseClasses": ["AutoGPT"], "category": "Agents", @@ -67,8 +68,8 @@ ], "inputs": { "tools": ["{{readFile_0.data.instance}}", "{{writeFile_1.data.instance}}", "{{serpAPI_0.data.instance}}"], - "model": "{{chatOpenAI_1.data.instance}}", - "vectorStoreRetriever": "{{pineconeExistingIndex_1.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", + "vectorStoreRetriever": "{{pineconeExistingIndex_0.data.instance}}", "aiName": "", "aiRole": "", "maxLoop": 5 @@ -93,27 +94,176 @@ }, { "width": 300, - "height": 526, - "id": "chatOpenAI_1", + "height": 278, + "id": "writeFile_1", "position": { - "x": 168.57515834535457, - "y": -90.74139976987627 + "x": 539.4976647298655, + "y": 36.45930212160803 }, "type": "customNode", "data": { - "id": "chatOpenAI_1", + "id": "writeFile_1", + "label": "Write File", + "name": "writeFile", + "version": 1, + "type": "WriteFile", + "baseClasses": ["WriteFile", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Write file to disk", + "inputParams": [ + { + "label": "Base Path", + "name": "basePath", + "placeholder": "C:\\Users\\User\\Desktop", + "type": "string", + "optional": true, + "id": "writeFile_1-input-basePath-string" + } + ], + "inputAnchors": [], + "inputs": { + "basePath": "" + }, + "outputAnchors": [ + { + "id": "writeFile_1-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain", + "name": "writeFile", + "label": "WriteFile", + "type": "WriteFile | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 539.4976647298655, + "y": 36.45930212160803 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 278, + "id": "readFile_0", + "position": { + "x": 881.2568465391292, + "y": -112.9631005153393 + }, + "type": "customNode", + "data": { + "id": "readFile_0", + "label": "Read File", + "name": "readFile", + "version": 1, + "type": "ReadFile", + "baseClasses": ["ReadFile", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Read file from disk", + "inputParams": [ + { + "label": "Base Path", + "name": "basePath", + "placeholder": "C:\\Users\\User\\Desktop", + "type": "string", + "optional": true, + "id": "readFile_0-input-basePath-string" + } + ], + "inputAnchors": [], + "inputs": { + "basePath": "" + }, + "outputAnchors": [ + { + "id": "readFile_0-output-readFile-ReadFile|Tool|StructuredTool|BaseLangChain", + "name": "readFile", + "label": "ReadFile", + "type": "ReadFile | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 881.2568465391292, + "y": -112.9631005153393 + }, + "dragging": false + }, + { + "width": 300, + "height": 277, + "id": "serpAPI_0", + "position": { + "x": 1247.066832724479, + "y": -193.77467220135756 + }, + "type": "customNode", + "data": { + "id": "serpAPI_0", + "label": "Serp API", + "name": "serpAPI", + "version": 1, + "type": "SerpAPI", + "baseClasses": ["SerpAPI", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Wrapper around SerpAPI - a real-time API to access Google search results", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["serpApi"], + "id": "serpAPI_0-input-credential-credential" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool", + "name": "serpAPI", + "label": "SerpAPI", + "type": "SerpAPI | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1247.066832724479, + "y": -193.77467220135756 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 176.69787776192283, + "y": -116.3808686218022 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -155,7 +305,7 @@ ], "default": "gpt-3.5-turbo", "optional": true, - "id": "chatOpenAI_1-input-modelName-options" + "id": "chatOpenAI_0-input-modelName-options" }, { "label": "Temperature", @@ -163,7 +313,7 @@ "type": "number", "default": 0.9, "optional": true, - "id": "chatOpenAI_1-input-temperature-number" + "id": "chatOpenAI_0-input-temperature-number" }, { "label": "Max Tokens", @@ -171,7 +321,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-maxTokens-number" + "id": "chatOpenAI_0-input-maxTokens-number" }, { "label": "Top Probability", @@ -179,7 +329,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-topP-number" + "id": "chatOpenAI_0-input-topP-number" }, { "label": "Frequency Penalty", @@ -187,7 +337,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-frequencyPenalty-number" + "id": "chatOpenAI_0-input-frequencyPenalty-number" }, { "label": "Presence Penalty", @@ -195,7 +345,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-presencePenalty-number" + "id": "chatOpenAI_0-input-presencePenalty-number" }, { "label": "Timeout", @@ -203,7 +353,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-timeout-number" + "id": "chatOpenAI_0-input-timeout-number" }, { "label": "BasePath", @@ -211,25 +361,26 @@ "type": "string", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-basepath-string" + "id": "chatOpenAI_0-input-basepath-string" } ], "inputAnchors": [], "inputs": { "modelName": "gpt-3.5-turbo", - "temperature": "0", + "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -237,177 +388,36 @@ }, "selected": false, "positionAbsolute": { - "x": 168.57515834535457, - "y": -90.74139976987627 + "x": 176.69787776192283, + "y": -116.3808686218022 }, "dragging": false }, { "width": 300, - "height": 279, - "id": "writeFile_1", - "position": { - "x": 546.3440710182241, - "y": 55.28691941459434 - }, - "type": "customNode", - "data": { - "id": "writeFile_1", - "label": "Write File", - "name": "writeFile", - "type": "WriteFile", - "baseClasses": ["WriteFile", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Write file to disk", - "inputParams": [ - { - "label": "Base Path", - "name": "basePath", - "placeholder": "C:\\Users\\User\\Desktop", - "type": "string", - "optional": true, - "id": "writeFile_1-input-basePath-string" - } - ], - "inputAnchors": [], - "inputs": { - "basePath": "" - }, - "outputAnchors": [ - { - "id": "writeFile_1-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain", - "name": "writeFile", - "label": "WriteFile", - "type": "WriteFile | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 546.3440710182241, - "y": 55.28691941459434 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 279, - "id": "readFile_0", - "position": { - "x": 881.2568465391292, - "y": -112.9631005153393 - }, - "type": "customNode", - "data": { - "id": "readFile_0", - "label": "Read File", - "name": "readFile", - "type": "ReadFile", - "baseClasses": ["ReadFile", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Read file from disk", - "inputParams": [ - { - "label": "Base Path", - "name": "basePath", - "placeholder": "C:\\Users\\User\\Desktop", - "type": "string", - "optional": true, - "id": "readFile_0-input-basePath-string" - } - ], - "inputAnchors": [], - "inputs": { - "basePath": "" - }, - "outputAnchors": [ - { - "id": "readFile_0-output-readFile-ReadFile|Tool|StructuredTool|BaseLangChain", - "name": "readFile", - "label": "ReadFile", - "type": "ReadFile | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 881.2568465391292, - "y": -112.9631005153393 - }, - "dragging": false - }, - { - "width": 300, - "height": 279, - "id": "serpAPI_0", - "position": { - "x": 1244.740380161344, - "y": -193.9135818023827 - }, - "type": "customNode", - "data": { - "id": "serpAPI_0", - "label": "Serp API", - "name": "serpAPI", - "type": "SerpAPI", - "baseClasses": ["SerpAPI", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Wrapper around SerpAPI - a real-time API to access Google search results", - "inputParams": [ - { - "label": "Serp Api Key", - "name": "apiKey", - "type": "password", - "id": "serpAPI_0-input-apiKey-password" - } - ], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", - "name": "serpAPI", - "label": "SerpAPI", - "type": "SerpAPI | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1244.740380161344, - "y": -193.9135818023827 - }, - "dragging": false - }, - { - "width": 300, - "height": 331, + "height": 329, "id": "openAIEmbeddings_0", "position": { - "x": 530.4714276286077, - "y": 487.0228196121594 + "x": 606.7317612889267, + "y": 439.5269912996025 }, "type": "customNode", "data": { "id": "openAIEmbeddings_0", "label": "OpenAI Embeddings", "name": "openAIEmbeddings", + "version": 1, "type": "OpenAIEmbeddings", "baseClasses": ["OpenAIEmbeddings", "Embeddings"], "category": "Embeddings", "description": "OpenAI API to generate embeddings for a given text", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAIEmbeddings_0-input-credential-credential" }, { "label": "Strip New Lines", @@ -446,7 +456,8 @@ "inputs": { "stripNewLines": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { @@ -459,57 +470,53 @@ "outputs": {}, "selected": false }, - "positionAbsolute": { - "x": 530.4714276286077, - "y": 487.0228196121594 - }, "selected": false, + "positionAbsolute": { + "x": 606.7317612889267, + "y": 439.5269912996025 + }, "dragging": false }, { "width": 300, - "height": 652, - "id": "pineconeExistingIndex_1", + "height": 505, + "id": "pineconeExistingIndex_0", "position": { - "x": 943.1601557586332, - "y": 404.9622062733608 + "x": 1001.3784758268554, + "y": 415.24072209485803 }, "type": "customNode", "data": { - "id": "pineconeExistingIndex_1", + "id": "pineconeExistingIndex_0", "label": "Pinecone Load Existing Index", "name": "pineconeExistingIndex", + "version": 1, "type": "Pinecone", "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "category": "Vector Stores", "description": "Load existing index from Pinecone (i.e: Document has been upserted)", "inputParams": [ { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeExistingIndex_1-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeEnv-string" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" }, { "label": "Pinecone Index", "name": "pineconeIndex", "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeIndex-string" + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" }, { "label": "Pinecone Namespace", "name": "pineconeNamespace", "type": "string", "placeholder": "my-first-namespace", - "optional": true, "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeNamespace-string" + "optional": true, + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" }, { "label": "Pinecone Metadata Filter", @@ -517,7 +524,7 @@ "type": "json", "optional": true, "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeMetadataFilter-json" + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" }, { "label": "Top K", @@ -527,7 +534,7 @@ "type": "number", "additionalParams": true, "optional": true, - "id": "pineconeExistingIndex_1-input-topK-number" + "id": "pineconeExistingIndex_0-input-topK-number" } ], "inputAnchors": [ @@ -535,14 +542,15 @@ "label": "Embeddings", "name": "embeddings", "type": "Embeddings", - "id": "pineconeExistingIndex_1-input-embeddings-Embeddings" + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" } ], "inputs": { "embeddings": "{{openAIEmbeddings_0.data.instance}}", - "pineconeEnv": "us-west4-gcp", "pineconeIndex": "", - "pineconeNamespace": "" + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" }, "outputAnchors": [ { @@ -551,13 +559,13 @@ "type": "options", "options": [ { - "id": "pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", "name": "retriever", "label": "Pinecone Retriever", "type": "Pinecone | VectorStoreRetriever | BaseRetriever" }, { - "id": "pineconeExistingIndex_1-output-vectorStore-Pinecone|VectorStore", + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", "name": "vectorStore", "label": "Pinecone Vector Store", "type": "Pinecone | VectorStore" @@ -572,47 +580,14 @@ "selected": false }, "selected": false, + "dragging": false, "positionAbsolute": { - "x": 943.1601557586332, - "y": 404.9622062733608 - }, - "dragging": false + "x": 1001.3784758268554, + "y": 415.24072209485803 + } } ], "edges": [ - { - "source": "pineconeExistingIndex_1", - "sourceHandle": "pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "target": "autoGPT_0", - "targetHandle": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever", - "type": "buttonedge", - "id": "pineconeExistingIndex_1-pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-autoGPT_0-autoGPT_0-input-vectorStoreRetriever-BaseRetriever", - "data": { - "label": "" - } - }, - { - "source": "openAIEmbeddings_0", - "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeExistingIndex_1", - "targetHandle": "pineconeExistingIndex_1-input-embeddings-Embeddings", - "type": "buttonedge", - "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_1-pineconeExistingIndex_1-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, - { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "autoGPT_0", - "targetHandle": "autoGPT_0-input-model-BaseChatModel", - "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-autoGPT_0-autoGPT_0-input-model-BaseChatModel", - "data": { - "label": "" - } - }, { "source": "writeFile_1", "sourceHandle": "writeFile_1-output-writeFile-WriteFile|Tool|StructuredTool|BaseLangChain", @@ -635,13 +610,46 @@ "label": "" } }, + { + "source": "pineconeExistingIndex_0", + "sourceHandle": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-autoGPT_0-autoGPT_0-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + }, + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "autoGPT_0", + "targetHandle": "autoGPT_0-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-autoGPT_0-autoGPT_0-input-model-BaseChatModel", + "data": { + "label": "" + } + }, { "source": "serpAPI_0", - "sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", + "sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool", "target": "autoGPT_0", "targetHandle": "autoGPT_0-input-tools-Tool", "type": "buttonedge", - "id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain-autoGPT_0-autoGPT_0-input-tools-Tool", + "id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool-autoGPT_0-autoGPT_0-input-tools-Tool", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/BabyAGI.json b/packages/server/marketplaces/chatflows/BabyAGI.json index 572d73f1..c2897531 100644 --- a/packages/server/marketplaces/chatflows/BabyAGI.json +++ b/packages/server/marketplaces/chatflows/BabyAGI.json @@ -3,220 +3,93 @@ "nodes": [ { "width": 300, - "height": 331, - "id": "openAIEmbeddings_1", + "height": 379, + "id": "babyAGI_1", "position": { - "x": -84.60344342694289, - "y": -189.6930708050951 + "x": 950.8042093214954, + "y": 66.00028106865324 }, "type": "customNode", "data": { - "id": "openAIEmbeddings_1", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", + "id": "babyAGI_1", + "label": "BabyAGI", + "name": "babyAGI", + "version": 1, + "type": "BabyAGI", + "baseClasses": ["BabyAGI"], + "category": "Agents", + "description": "Task Driven Autonomous Agent which creates new task and reprioritizes task list based on objective", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_1-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", + "label": "Task Loop", + "name": "taskLoop", "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-basepath-string" + "default": 3, + "id": "babyAGI_1-input-taskLoop-number" + } + ], + "inputAnchors": [ + { + "label": "Chat Model", + "name": "model", + "type": "BaseChatModel", + "id": "babyAGI_1-input-model-BaseChatModel" + }, + { + "label": "Vector Store", + "name": "vectorStore", + "type": "VectorStore", + "id": "babyAGI_1-input-vectorStore-VectorStore" } ], - "inputAnchors": [], "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" + "model": "{{chatOpenAI_0.data.instance}}", + "vectorStore": "{{pineconeExistingIndex_0.data.instance}}", + "taskLoop": 3 }, "outputAnchors": [ { - "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" + "id": "babyAGI_1-output-babyAGI-BabyAGI", + "name": "babyAGI", + "label": "BabyAGI", + "type": "BabyAGI" } ], "outputs": {}, "selected": false }, - "positionAbsolute": { - "x": -84.60344342694289, - "y": -189.6930708050951 - }, "selected": false, - "dragging": false + "dragging": false, + "positionAbsolute": { + "x": 950.8042093214954, + "y": 66.00028106865324 + } }, { "width": 300, - "height": 652, - "id": "pineconeExistingIndex_1", + "height": 523, + "id": "chatOpenAI_0", "position": { - "x": 264.729293346415, - "y": -190.36689763560724 + "x": 587.1798180512677, + "y": -355.9845878719703 }, "type": "customNode", "data": { - "id": "pineconeExistingIndex_1", - "label": "Pinecone Load Existing Index", - "name": "pineconeExistingIndex", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Pinecone (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeExistingIndex_1-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeNamespace-string" - }, - { - "label": "Pinecone Metadata Filter", - "name": "pineconeMetadataFilter", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeMetadataFilter-json" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeExistingIndex_1-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeExistingIndex_1-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_1.data.instance}}", - "pineconeEnv": "us-west4-gcp", - "pineconeIndex": "", - "pineconeNamespace": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeExistingIndex_1-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "vectorStore" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 264.729293346415, - "y": -190.36689763560724 - }, - "dragging": false - }, - { - "width": 300, - "height": 526, - "id": "chatOpenAI_1", - "position": { - "x": 590.3367401418911, - "y": -374.0329977259934 - }, - "type": "customNode", - "data": { - "id": "chatOpenAI_1", + "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -258,7 +131,7 @@ ], "default": "gpt-3.5-turbo", "optional": true, - "id": "chatOpenAI_1-input-modelName-options" + "id": "chatOpenAI_0-input-modelName-options" }, { "label": "Temperature", @@ -266,7 +139,7 @@ "type": "number", "default": 0.9, "optional": true, - "id": "chatOpenAI_1-input-temperature-number" + "id": "chatOpenAI_0-input-temperature-number" }, { "label": "Max Tokens", @@ -274,7 +147,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-maxTokens-number" + "id": "chatOpenAI_0-input-maxTokens-number" }, { "label": "Top Probability", @@ -282,7 +155,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-topP-number" + "id": "chatOpenAI_0-input-topP-number" }, { "label": "Frequency Penalty", @@ -290,7 +163,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-frequencyPenalty-number" + "id": "chatOpenAI_0-input-frequencyPenalty-number" }, { "label": "Presence Penalty", @@ -298,7 +171,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-presencePenalty-number" + "id": "chatOpenAI_0-input-presencePenalty-number" }, { "label": "Timeout", @@ -306,7 +179,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-timeout-number" + "id": "chatOpenAI_0-input-timeout-number" }, { "label": "BasePath", @@ -314,131 +187,262 @@ "type": "string", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-basepath-string" + "id": "chatOpenAI_0-input-basepath-string" } ], "inputAnchors": [], "inputs": { "modelName": "gpt-3.5-turbo", - "temperature": "0", + "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, "selected": false }, "selected": false, - "dragging": false, "positionAbsolute": { - "x": 590.3367401418911, - "y": -374.0329977259934 - } + "x": 587.1798180512677, + "y": -355.9845878719703 + }, + "dragging": false }, { "width": 300, - "height": 380, - "id": "babyAGI_1", + "height": 329, + "id": "openAIEmbeddings_0", "position": { - "x": 950.8042093214954, - "y": 66.00028106865324 + "x": -111.82510263637522, + "y": -224.88655030419665 }, "type": "customNode", "data": { - "id": "babyAGI_1", - "label": "BabyAGI", - "name": "babyAGI", - "type": "BabyAGI", - "baseClasses": ["BabyAGI"], - "category": "Agents", - "description": "Task Driven Autonomous Agent which creates new task and reprioritizes task list based on objective", + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "type": "OpenAIEmbeddings", + "baseClasses": ["OpenAIEmbeddings", "Embeddings"], + "category": "Embeddings", + "description": "OpenAI API to generate embeddings for a given text", "inputParams": [ { - "label": "Task Loop", - "name": "taskLoop", + "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", - "default": 3, - "id": "babyAGI_1-input-taskLoop-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, + "positionAbsolute": { + "x": -111.82510263637522, + "y": -224.88655030419665 + }, + "dragging": false + }, + { + "width": 300, + "height": 505, + "id": "pineconeExistingIndex_0", + "position": { + "x": 241.78764591331816, + "y": -38.438460915613945 + }, + "type": "customNode", + "data": { + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" + }, + { + "label": "Pinecone Metadata Filter", + "name": "pineconeMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-topK-number" } ], "inputAnchors": [ { - "label": "Chat Model", - "name": "model", - "type": "BaseChatModel", - "id": "babyAGI_1-input-model-BaseChatModel" - }, - { - "label": "Vector Store", - "name": "vectorStore", - "type": "VectorStore", - "id": "babyAGI_1-input-vectorStore-VectorStore" + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" } ], "inputs": { - "model": "{{chatOpenAI_1.data.instance}}", - "vectorStore": "{{pineconeExistingIndex_1.data.instance}}", - "taskLoop": 3 + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "newindex", + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" }, "outputAnchors": [ { - "id": "babyAGI_1-output-babyAGI-BabyAGI", - "name": "babyAGI", - "label": "BabyAGI", - "type": "BabyAGI" + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" } ], - "outputs": {}, + "outputs": { + "output": "vectorStore" + }, "selected": false }, "selected": false, - "dragging": false, "positionAbsolute": { - "x": 950.8042093214954, - "y": 66.00028106865324 - } + "x": 241.78764591331816, + "y": -38.438460915613945 + }, + "dragging": false } ], "edges": [ { - "source": "openAIEmbeddings_1", - "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeExistingIndex_1", - "targetHandle": "pineconeExistingIndex_1-input-embeddings-Embeddings", - "type": "buttonedge", - "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_1-pineconeExistingIndex_1-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, - { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "babyAGI_1", - "targetHandle": "babyAGI_1-input-model-BaseChatModel", - "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-babyAGI_1-babyAGI_1-input-model-BaseChatModel", - "data": { - "label": "" - } - }, - { - "source": "pineconeExistingIndex_1", - "sourceHandle": "pineconeExistingIndex_1-output-vectorStore-Pinecone|VectorStore", + "source": "pineconeExistingIndex_0", + "sourceHandle": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", "target": "babyAGI_1", "targetHandle": "babyAGI_1-input-vectorStore-VectorStore", "type": "buttonedge", - "id": "pineconeExistingIndex_1-pineconeExistingIndex_1-output-vectorStore-Pinecone|VectorStore-babyAGI_1-babyAGI_1-input-vectorStore-VectorStore", + "id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore-babyAGI_1-babyAGI_1-input-vectorStore-VectorStore", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "babyAGI_1", + "targetHandle": "babyAGI_1-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-babyAGI_1-babyAGI_1-input-model-BaseChatModel", + "data": { + "label": "" + } + }, + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/CSV Agent.json b/packages/server/marketplaces/chatflows/CSV Agent.json new file mode 100644 index 00000000..1515fcad --- /dev/null +++ b/packages/server/marketplaces/chatflows/CSV Agent.json @@ -0,0 +1,228 @@ +{ + "description": "Analyse and summarize CSV data", + "nodes": [ + { + "width": 300, + "height": 377, + "id": "csvAgent_0", + "position": { + "x": 1064.0780498701288, + "y": 284.44352695304724 + }, + "type": "customNode", + "data": { + "id": "csvAgent_0", + "label": "CSV Agent", + "name": "csvAgent", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "Agent used to to answer queries on CSV data", + "inputParams": [ + { + "label": "Csv File", + "name": "csvFile", + "type": "file", + "fileType": ".csv", + "id": "csvAgent_0-input-csvFile-file" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "csvAgent_0-input-model-BaseLanguageModel" + } + ], + "inputs": { + "model": "{{chatOpenAI_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "csvAgent_0-output-csvAgent-AgentExecutor|BaseChain", + "name": "csvAgent", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1064.0780498701288, + "y": 284.44352695304724 + }, + "dragging": false + }, + { + "width": 300, + "height": 522, + "id": "chatOpenAI_0", + "position": { + "x": 657.3762197414501, + "y": 220.2950766042332 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 657.3762197414501, + "y": 220.2950766042332 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "csvAgent_0", + "targetHandle": "csvAgent_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-csvAgent_0-csvAgent_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + } + ] +} diff --git a/packages/server/marketplaces/chatflows/ChatGPTPlugin.json b/packages/server/marketplaces/chatflows/ChatGPTPlugin.json index 76964a09..471853ba 100644 --- a/packages/server/marketplaces/chatflows/ChatGPTPlugin.json +++ b/packages/server/marketplaces/chatflows/ChatGPTPlugin.json @@ -14,6 +14,7 @@ "id": "aiPlugin_0", "label": "AI Plugin", "name": "aiPlugin", + "version": 1, "type": "AIPlugin", "baseClasses": ["AIPlugin", "Tool"], "category": "Tools", @@ -60,6 +61,7 @@ "id": "requestsGet_0", "label": "Requests Get", "name": "requestsGet", + "version": 1, "type": "RequestsGet", "baseClasses": ["RequestsGet", "Tool", "StructuredTool", "BaseLangChain"], "category": "Tools", @@ -131,6 +133,7 @@ "id": "requestsPost_0", "label": "Requests Post", "name": "requestsPost", + "version": 1, "type": "RequestsPost", "baseClasses": ["RequestsPost", "Tool", "StructuredTool", "BaseLangChain"], "category": "Tools", @@ -201,82 +204,29 @@ }, { "width": 300, - "height": 280, - "id": "mrklAgentChat_0", - "position": { - "x": 1416.2054860029416, - "y": 451.43299014109715 - }, - "type": "customNode", - "data": { - "id": "mrklAgentChat_0", - "label": "MRKL Agent for Chat Models", - "name": "mrklAgentChat", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], - "category": "Agents", - "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with Chat Models", - "inputParams": [], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "mrklAgentChat_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "mrklAgentChat_0-input-model-BaseLanguageModel" - } - ], - "inputs": { - "tools": ["{{requestsGet_0.data.instance}}", "{{requestsPost_0.data.instance}}", "{{aiPlugin_0.data.instance}}"], - "model": "{{chatOpenAI_0.data.instance}}" - }, - "outputAnchors": [ - { - "id": "mrklAgentChat_0-output-mrklAgentChat-AgentExecutor|BaseChain|BaseLangChain", - "name": "mrklAgentChat", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1416.2054860029416, - "y": 451.43299014109715 - }, - "dragging": false - }, - { - "width": 300, - "height": 524, + "height": 523, "id": "chatOpenAI_0", "position": { - "x": 797.0574814814245, - "y": 578.7641992971934 + "x": 802.0103755177098, + "y": 576.0760341170851 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -385,14 +335,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -400,24 +351,69 @@ }, "selected": false, "positionAbsolute": { - "x": 797.0574814814245, - "y": 578.7641992971934 + "x": 802.0103755177098, + "y": 576.0760341170851 + }, + "dragging": false + }, + { + "width": 300, + "height": 280, + "id": "mrklAgentChat_0", + "position": { + "x": 1425.5853300862047, + "y": 441.06218012993924 + }, + "type": "customNode", + "data": { + "id": "mrklAgentChat_0", + "label": "MRKL Agent for Chat Models", + "name": "mrklAgentChat", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with Chat Models", + "inputParams": [], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "mrklAgentChat_0-input-tools-Tool" + }, + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "mrklAgentChat_0-input-model-BaseLanguageModel" + } + ], + "inputs": { + "tools": ["{{requestsGet_0.data.instance}}", "{{requestsPost_0.data.instance}}", "{{aiPlugin_0.data.instance}}"], + "model": "{{chatOpenAI_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "mrklAgentChat_0-output-mrklAgentChat-AgentExecutor|BaseChain", + "name": "mrklAgentChat", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1425.5853300862047, + "y": 441.06218012993924 }, "dragging": false } ], "edges": [ - { - "source": "requestsGet_0", - "sourceHandle": "requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", - "type": "buttonedge", - "id": "requestsGet_0-requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool", - "data": { - "label": "" - } - }, { "source": "aiPlugin_0", "sourceHandle": "aiPlugin_0-output-aiPlugin-AIPlugin|Tool", @@ -429,6 +425,17 @@ "label": "" } }, + { + "source": "requestsGet_0", + "sourceHandle": "requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain", + "target": "mrklAgentChat_0", + "targetHandle": "mrklAgentChat_0-input-tools-Tool", + "type": "buttonedge", + "id": "requestsGet_0-requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool", + "data": { + "label": "" + } + }, { "source": "requestsPost_0", "sourceHandle": "requestsPost_0-output-requestsPost-RequestsPost|Tool|StructuredTool|BaseLangChain", @@ -442,11 +449,11 @@ }, { "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "mrklAgentChat_0", "targetHandle": "mrklAgentChat_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-mrklAgentChat_0-mrklAgentChat_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Claude LLM.json b/packages/server/marketplaces/chatflows/Claude LLM.json new file mode 100644 index 00000000..243d2600 --- /dev/null +++ b/packages/server/marketplaces/chatflows/Claude LLM.json @@ -0,0 +1,416 @@ +{ + "description": "Use Anthropic Claude with 100k context window to ingest whole document for QnA", + "nodes": [ + { + "width": 300, + "height": 376, + "id": "bufferMemory_0", + "position": { + "x": 451.4449437285705, + "y": 118.30026803362762 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_0", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_0-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 451.4449437285705, + "y": 118.30026803362762 + }, + "dragging": false + }, + { + "width": 300, + "height": 383, + "id": "conversationChain_0", + "position": { + "x": 1176.1569322079652, + "y": 303.56879146735974 + }, + "type": "customNode", + "data": { + "id": "conversationChain_0", + "label": "Conversation Chain", + "name": "conversationChain", + "version": 1, + "type": "ConversationChain", + "baseClasses": ["ConversationChain", "LLMChain", "BaseChain"], + "category": "Chains", + "description": "Chat models specific conversational chain with memory", + "inputParams": [ + { + "label": "System Message", + "name": "systemMessagePrompt", + "type": "string", + "rows": 4, + "additionalParams": true, + "optional": true, + "placeholder": "You are a helpful assistant that write codes", + "id": "conversationChain_0-input-systemMessagePrompt-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseChatModel", + "id": "conversationChain_0-input-model-BaseChatModel" + }, + { + "label": "Memory", + "name": "memory", + "type": "BaseMemory", + "id": "conversationChain_0-input-memory-BaseMemory" + }, + { + "label": "Document", + "name": "document", + "type": "Document", + "description": "Include whole document into the context window", + "optional": true, + "list": true, + "id": "conversationChain_0-input-document-Document" + } + ], + "inputs": { + "model": "{{chatAnthropic_0.data.instance}}", + "memory": "{{bufferMemory_0.data.instance}}", + "document": ["{{pdfFile_0.data.instance}}"], + "systemMessagePrompt": "" + }, + "outputAnchors": [ + { + "id": "conversationChain_0-output-conversationChain-ConversationChain|LLMChain|BaseChain", + "name": "conversationChain", + "label": "ConversationChain", + "type": "ConversationChain | LLMChain | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1176.1569322079652, + "y": 303.56879146735974 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatAnthropic_0", + "position": { + "x": 800.5525382783799, + "y": -76.7988221837009 + }, + "type": "customNode", + "data": { + "id": "chatAnthropic_0", + "label": "ChatAnthropic", + "name": "chatAnthropic", + "version": 1, + "type": "ChatAnthropic", + "baseClasses": ["ChatAnthropic", "BaseChatModel", "BaseLanguageModel"], + "category": "Chat Models", + "description": "Wrapper around ChatAnthropic large language models that use the Chat endpoint", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["anthropicApi"], + "id": "chatAnthropic_0-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "claude-2", + "name": "claude-2", + "description": "Claude 2 latest major version, automatically get updates to the model as they are released" + }, + { + "label": "claude-instant-1", + "name": "claude-instant-1", + "description": "Claude Instant latest major version, automatically get updates to the model as they are released" + }, + { + "label": "claude-v1", + "name": "claude-v1" + }, + { + "label": "claude-v1-100k", + "name": "claude-v1-100k" + }, + { + "label": "claude-v1.0", + "name": "claude-v1.0" + }, + { + "label": "claude-v1.2", + "name": "claude-v1.2" + }, + { + "label": "claude-v1.3", + "name": "claude-v1.3" + }, + { + "label": "claude-v1.3-100k", + "name": "claude-v1.3-100k" + }, + { + "label": "claude-instant-v1", + "name": "claude-instant-v1" + }, + { + "label": "claude-instant-v1-100k", + "name": "claude-instant-v1-100k" + }, + { + "label": "claude-instant-v1.0", + "name": "claude-instant-v1.0" + }, + { + "label": "claude-instant-v1.1", + "name": "claude-instant-v1.1" + }, + { + "label": "claude-instant-v1.1-100k", + "name": "claude-instant-v1.1-100k" + } + ], + "default": "claude-v1", + "optional": true, + "id": "chatAnthropic_0-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.9, + "optional": true, + "id": "chatAnthropic_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokensToSample", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatAnthropic_0-input-maxTokensToSample-number" + }, + { + "label": "Top P", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatAnthropic_0-input-topP-number" + }, + { + "label": "Top K", + "name": "topK", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatAnthropic_0-input-topK-number" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "claude-2", + "temperature": 0.9, + "maxTokensToSample": "", + "topP": "", + "topK": "" + }, + "outputAnchors": [ + { + "id": "chatAnthropic_0-output-chatAnthropic-ChatAnthropic|BaseChatModel|BaseLanguageModel", + "name": "chatAnthropic", + "label": "ChatAnthropic", + "type": "ChatAnthropic | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 800.5525382783799, + "y": -76.7988221837009 + }, + "dragging": false + }, + { + "width": 300, + "height": 507, + "id": "pdfFile_0", + "position": { + "x": 94.16886576108482, + "y": 37.12056504707391 + }, + "type": "customNode", + "data": { + "id": "pdfFile_0", + "label": "Pdf File", + "name": "pdfFile", + "version": 1, + "type": "Document", + "baseClasses": ["Document"], + "category": "Document Loaders", + "description": "Load data from PDF files", + "inputParams": [ + { + "label": "Pdf File", + "name": "pdfFile", + "type": "file", + "fileType": ".pdf", + "id": "pdfFile_0-input-pdfFile-file" + }, + { + "label": "Usage", + "name": "usage", + "type": "options", + "options": [ + { + "label": "One document per page", + "name": "perPage" + }, + { + "label": "One document per file", + "name": "perFile" + } + ], + "default": "perPage", + "id": "pdfFile_0-input-usage-options" + }, + { + "label": "Use Legacy Build", + "name": "legacyBuild", + "type": "boolean", + "optional": true, + "additionalParams": true, + "id": "pdfFile_0-input-legacyBuild-boolean" + }, + { + "label": "Metadata", + "name": "metadata", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pdfFile_0-input-metadata-json" + } + ], + "inputAnchors": [ + { + "label": "Text Splitter", + "name": "textSplitter", + "type": "TextSplitter", + "optional": true, + "id": "pdfFile_0-input-textSplitter-TextSplitter" + } + ], + "inputs": { + "textSplitter": "", + "usage": "perPage", + "legacyBuild": "", + "metadata": "" + }, + "outputAnchors": [ + { + "id": "pdfFile_0-output-pdfFile-Document", + "name": "pdfFile", + "label": "Document", + "type": "Document" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 94.16886576108482, + "y": 37.12056504707391 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "bufferMemory_0", + "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "target": "conversationChain_0", + "targetHandle": "conversationChain_0-input-memory-BaseMemory", + "type": "buttonedge", + "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-conversationChain_0-conversationChain_0-input-memory-BaseMemory", + "data": { + "label": "" + } + }, + { + "source": "chatAnthropic_0", + "sourceHandle": "chatAnthropic_0-output-chatAnthropic-ChatAnthropic|BaseChatModel|BaseLanguageModel", + "target": "conversationChain_0", + "targetHandle": "conversationChain_0-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatAnthropic_0-chatAnthropic_0-output-chatAnthropic-ChatAnthropic|BaseChatModel|BaseLanguageModel-conversationChain_0-conversationChain_0-input-model-BaseChatModel", + "data": { + "label": "" + } + }, + { + "source": "pdfFile_0", + "sourceHandle": "pdfFile_0-output-pdfFile-Document", + "target": "conversationChain_0", + "targetHandle": "conversationChain_0-input-document-Document", + "type": "buttonedge", + "id": "pdfFile_0-pdfFile_0-output-pdfFile-Document-conversationChain_0-conversationChain_0-input-document-Document", + "data": { + "label": "" + } + } + ] +} diff --git a/packages/server/marketplaces/chatflows/Conversational Agent.json b/packages/server/marketplaces/chatflows/Conversational Agent.json index b0295fd6..55475b3e 100644 --- a/packages/server/marketplaces/chatflows/Conversational Agent.json +++ b/packages/server/marketplaces/chatflows/Conversational Agent.json @@ -3,27 +3,172 @@ "nodes": [ { "width": 300, - "height": 524, - "id": "chatOpenAI_1", + "height": 143, + "id": "calculator_1", "position": { - "x": 56.646518061018355, - "y": 71.07043412525425 + "x": 800.5125025564965, + "y": 72.40592063242738 }, "type": "customNode", "data": { - "id": "chatOpenAI_1", + "id": "calculator_1", + "label": "Calculator", + "name": "calculator", + "version": 1, + "type": "Calculator", + "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Perform calculations on response", + "inputParams": [], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain", + "name": "calculator", + "label": "Calculator", + "type": "Calculator | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 800.5125025564965, + "y": 72.40592063242738 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 376, + "id": "bufferMemory_1", + "position": { + "x": 607.6260576768354, + "y": 584.7920541862369 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_1", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_1-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_1-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_1-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 607.6260576768354, + "y": 584.7920541862369 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 277, + "id": "serpAPI_0", + "position": { + "x": 451.83740798447855, + "y": 53.2843022150486 + }, + "type": "customNode", + "data": { + "id": "serpAPI_0", + "label": "Serp API", + "name": "serpAPI", + "version": 1, + "type": "SerpAPI", + "baseClasses": ["SerpAPI", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Wrapper around SerpAPI - a real-time API to access Google search results", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["serpApi"], + "id": "serpAPI_0-input-credential-credential" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool", + "name": "serpAPI", + "label": "SerpAPI", + "type": "SerpAPI | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 451.83740798447855, + "y": 53.2843022150486 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 97.01321406237057, + "y": 63.67664262280914 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -65,7 +210,7 @@ ], "default": "gpt-3.5-turbo", "optional": true, - "id": "chatOpenAI_1-input-modelName-options" + "id": "chatOpenAI_0-input-modelName-options" }, { "label": "Temperature", @@ -73,7 +218,7 @@ "type": "number", "default": 0.9, "optional": true, - "id": "chatOpenAI_1-input-temperature-number" + "id": "chatOpenAI_0-input-temperature-number" }, { "label": "Max Tokens", @@ -81,7 +226,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-maxTokens-number" + "id": "chatOpenAI_0-input-maxTokens-number" }, { "label": "Top Probability", @@ -89,7 +234,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-topP-number" + "id": "chatOpenAI_0-input-topP-number" }, { "label": "Frequency Penalty", @@ -97,7 +242,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-frequencyPenalty-number" + "id": "chatOpenAI_0-input-frequencyPenalty-number" }, { "label": "Presence Penalty", @@ -105,7 +250,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-presencePenalty-number" + "id": "chatOpenAI_0-input-presencePenalty-number" }, { "label": "Timeout", @@ -113,7 +258,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-timeout-number" + "id": "chatOpenAI_0-input-timeout-number" }, { "label": "BasePath", @@ -121,25 +266,26 @@ "type": "string", "optional": true, "additionalParams": true, - "id": "chatOpenAI_1-input-basepath-string" + "id": "chatOpenAI_0-input-basepath-string" } ], "inputAnchors": [], "inputs": { "modelName": "gpt-3.5-turbo", - "temperature": "0", + "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -147,165 +293,27 @@ }, "selected": false, "positionAbsolute": { - "x": 56.646518061018355, - "y": 71.07043412525425 + "x": 97.01321406237057, + "y": 63.67664262280914 }, "dragging": false }, - { - "width": 300, - "height": 278, - "id": "serpAPI_1", - "position": { - "x": 436.94138168947336, - "y": 39.517825311262044 - }, - "type": "customNode", - "data": { - "id": "serpAPI_1", - "label": "Serp API", - "name": "serpAPI", - "type": "SerpAPI", - "baseClasses": ["SerpAPI", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Wrapper around SerpAPI - a real-time API to access Google search results", - "inputParams": [ - { - "label": "Serp Api Key", - "name": "apiKey", - "type": "password", - "id": "serpAPI_1-input-apiKey-password" - } - ], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", - "name": "serpAPI", - "label": "SerpAPI", - "type": "SerpAPI | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 436.94138168947336, - "y": 39.517825311262044 - }, - "dragging": false - }, - { - "width": 300, - "height": 143, - "id": "calculator_1", - "position": { - "x": 800.5125025564965, - "y": 72.40592063242738 - }, - "type": "customNode", - "data": { - "id": "calculator_1", - "label": "Calculator", - "name": "calculator", - "type": "Calculator", - "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Perform calculations on response", - "inputParams": [], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain", - "name": "calculator", - "label": "Calculator", - "type": "Calculator | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 800.5125025564965, - "y": 72.40592063242738 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 376, - "id": "bufferMemory_1", - "position": { - "x": 573.479796337051, - "y": 575.8843338367278 - }, - "type": "customNode", - "data": { - "id": "bufferMemory_1", - "label": "Buffer Memory", - "name": "bufferMemory", - "type": "BufferMemory", - "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], - "category": "Memory", - "description": "Remembers previous conversational back and forths directly", - "inputParams": [ - { - "label": "Memory Key", - "name": "memoryKey", - "type": "string", - "default": "chat_history", - "id": "bufferMemory_1-input-memoryKey-string" - }, - { - "label": "Input Key", - "name": "inputKey", - "type": "string", - "default": "input", - "id": "bufferMemory_1-input-inputKey-string" - } - ], - "inputAnchors": [], - "inputs": { - "memoryKey": "chat_history", - "inputKey": "input" - }, - "outputAnchors": [ - { - "id": "bufferMemory_1-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "name": "bufferMemory", - "label": "BufferMemory", - "type": "BufferMemory | BaseChatMemory | BaseMemory" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 573.479796337051, - "y": 575.8843338367278 - }, - "selected": false, - "dragging": false - }, { "width": 300, "height": 383, "id": "conversationalAgent_0", "position": { - "x": 1206.1996037716035, - "y": 227.39579577603587 + "x": 1164.4550359451973, + "y": 283.40041124403075 }, "type": "customNode", "data": { "id": "conversationalAgent_0", "label": "Conversational Agent", "name": "conversationalAgent", + "version": 1, "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], + "baseClasses": ["AgentExecutor", "BaseChain"], "category": "Agents", "description": "Conversational agent for a chat model. It will utilize chat specific prompts", "inputParams": [ @@ -314,18 +322,10 @@ "name": "systemMessage", "type": "string", "rows": 4, + "default": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.", "optional": true, "additionalParams": true, "id": "conversationalAgent_0-input-systemMessage-string" - }, - { - "label": "Human Message", - "name": "humanMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "conversationalAgent_0-input-humanMessage-string" } ], "inputAnchors": [ @@ -350,18 +350,17 @@ } ], "inputs": { - "tools": ["{{calculator_1.data.instance}}", "{{serpAPI_1.data.instance}}"], - "model": "{{chatOpenAI_1.data.instance}}", + "tools": ["{{calculator_1.data.instance}}", "{{serpAPI_0.data.instance}}"], + "model": "{{chatOpenAI_0.data.instance}}", "memory": "{{bufferMemory_1.data.instance}}", - "systemMessage": "", - "humanMessage": "" + "systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist." }, "outputAnchors": [ { - "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain|BaseLangChain", + "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain", "name": "conversationalAgent", "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" + "type": "AgentExecutor | BaseChain" } ], "outputs": {}, @@ -369,8 +368,8 @@ }, "selected": false, "positionAbsolute": { - "x": 1206.1996037716035, - "y": 227.39579577603587 + "x": 1164.4550359451973, + "y": 283.40041124403075 }, "dragging": false } @@ -388,23 +387,23 @@ } }, { - "source": "serpAPI_1", - "sourceHandle": "serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", + "source": "serpAPI_0", + "sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool", "target": "conversationalAgent_0", "targetHandle": "conversationalAgent_0-input-tools-Tool", "type": "buttonedge", - "id": "serpAPI_1-serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain-conversationalAgent_0-conversationalAgent_0-input-tools-Tool", + "id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool-conversationalAgent_0-conversationalAgent_0-input-tools-Tool", "data": { "label": "" } }, { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "conversationalAgent_0", "targetHandle": "conversationalAgent_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json b/packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json index e267214e..bf27e443 100644 --- a/packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json +++ b/packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json @@ -3,165 +3,29 @@ "nodes": [ { "width": 300, - "height": 376, - "id": "recursiveCharacterTextSplitter_1", - "position": { - "x": 422.81091375202413, - "y": 122.99825010325736 - }, - "type": "customNode", - "data": { - "id": "recursiveCharacterTextSplitter_1", - "label": "Recursive Character Text Splitter", - "name": "recursiveCharacterTextSplitter", - "type": "RecursiveCharacterTextSplitter", - "baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"], - "category": "Text Splitters", - "description": "Split documents recursively by different characters - starting with \"\n\n\", then \"\n\", then \" \"", - "inputParams": [ - { - "label": "Chunk Size", - "name": "chunkSize", - "type": "number", - "default": 1000, - "optional": true, - "id": "recursiveCharacterTextSplitter_1-input-chunkSize-number" - }, - { - "label": "Chunk Overlap", - "name": "chunkOverlap", - "type": "number", - "optional": true, - "id": "recursiveCharacterTextSplitter_1-input-chunkOverlap-number" - } - ], - "inputAnchors": [], - "inputs": { - "chunkSize": 1000, - "chunkOverlap": "" - }, - "outputAnchors": [ - { - "id": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", - "name": "recursiveCharacterTextSplitter", - "label": "RecursiveCharacterTextSplitter", - "type": "RecursiveCharacterTextSplitter | TextSplitter" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 422.81091375202413, - "y": 122.99825010325736 - }, - "dragging": false - }, - { - "width": 300, - "height": 330, - "id": "openAIEmbeddings_1", - "position": { - "x": 817.2208258595176, - "y": 586.8095386455508 - }, - "type": "customNode", - "data": { - "id": "openAIEmbeddings_1", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_1-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 817.2208258595176, - "y": 586.8095386455508 - }, - "dragging": false - }, - { - "width": 300, - "height": 524, + "height": 522, "id": "chatOpenAI_0", "position": { - "x": 1200.565568471151, - "y": -33.648143275380406 + "x": 1184.1176114500388, + "y": -44.15535835370571 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -265,19 +129,104 @@ "inputAnchors": [], "inputs": { "modelName": "gpt-3.5-turbo", - "temperature": "0.5", + "temperature": "0", "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1184.1176114500388, + "y": -44.15535835370571 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 328, + "id": "openAIEmbeddings_0", + "position": { + "x": 795.6162477805387, + "y": 603.260214150876 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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": {}, @@ -285,26 +234,259 @@ }, "selected": false, "positionAbsolute": { - "x": 1200.565568471151, - "y": -33.648143275380406 + "x": 795.6162477805387, + "y": 603.260214150876 }, "dragging": false }, { "width": 300, - "height": 480, + "height": 554, + "id": "pineconeUpsert_0", + "position": { + "x": 1191.1792786926865, + "y": 514.2126330994578 + }, + "type": "customNode", + "data": { + "id": "pineconeUpsert_0", + "label": "Pinecone Upsert Document", + "name": "pineconeUpsert", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Upsert documents to Pinecone", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeUpsert_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeUpsert_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-pineconeNamespace-string" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Document", + "name": "document", + "type": "Document", + "list": true, + "id": "pineconeUpsert_0-input-document-Document" + }, + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeUpsert_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "document": ["{{textFile_0.data.instance}}"], + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeUpsert_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1191.1792786926865, + "y": 514.2126330994578 + }, + "dragging": false + }, + { + "width": 300, + "height": 376, + "id": "recursiveCharacterTextSplitter_0", + "position": { + "x": 406.08456707531263, + "y": 197.66460328693972 + }, + "type": "customNode", + "data": { + "id": "recursiveCharacterTextSplitter_0", + "label": "Recursive Character Text Splitter", + "name": "recursiveCharacterTextSplitter", + "version": 1, + "type": "RecursiveCharacterTextSplitter", + "baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"], + "category": "Text Splitters", + "description": "Split documents recursively by different characters - starting with \"\\n\\n\", then \"\\n\", then \" \"", + "inputParams": [ + { + "label": "Chunk Size", + "name": "chunkSize", + "type": "number", + "default": 1000, + "optional": true, + "id": "recursiveCharacterTextSplitter_0-input-chunkSize-number" + }, + { + "label": "Chunk Overlap", + "name": "chunkOverlap", + "type": "number", + "optional": true, + "id": "recursiveCharacterTextSplitter_0-input-chunkOverlap-number" + } + ], + "inputAnchors": [], + "inputs": { + "chunkSize": 1000, + "chunkOverlap": "" + }, + "outputAnchors": [ + { + "id": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", + "name": "recursiveCharacterTextSplitter", + "label": "RecursiveCharacterTextSplitter", + "type": "RecursiveCharacterTextSplitter | TextSplitter" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 406.08456707531263, + "y": 197.66460328693972 + }, + "dragging": false + }, + { + "width": 300, + "height": 410, + "id": "textFile_0", + "position": { + "x": 786.5497697231324, + "y": 140.09563157584407 + }, + "type": "customNode", + "data": { + "id": "textFile_0", + "label": "Text File", + "name": "textFile", + "version": 1, + "type": "Document", + "baseClasses": ["Document"], + "category": "Document Loaders", + "description": "Load data from text files", + "inputParams": [ + { + "label": "Txt File", + "name": "txtFile", + "type": "file", + "fileType": ".txt", + "id": "textFile_0-input-txtFile-file" + }, + { + "label": "Metadata", + "name": "metadata", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "textFile_0-input-metadata-json" + } + ], + "inputAnchors": [ + { + "label": "Text Splitter", + "name": "textSplitter", + "type": "TextSplitter", + "optional": true, + "id": "textFile_0-input-textSplitter-TextSplitter" + } + ], + "inputs": { + "textSplitter": "{{recursiveCharacterTextSplitter_0.data.instance}}", + "metadata": "" + }, + "outputAnchors": [ + { + "id": "textFile_0-output-textFile-Document", + "name": "textFile", + "label": "Document", + "type": "Document" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 786.5497697231324, + "y": 140.09563157584407 + }, + "dragging": false + }, + { + "width": 300, + "height": 479, "id": "conversationalRetrievalQAChain_0", "position": { - "x": 1627.1855024401737, - "y": 394.42287890442145 + "x": 1558.6564094656787, + "y": 386.60217819991124 }, "type": "customNode", "data": { "id": "conversationalRetrievalQAChain_0", "label": "Conversational Retrieval QA Chain", "name": "conversationalRetrievalQAChain", + "version": 1, "type": "ConversationalRetrievalQAChain", - "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], + "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"], "category": "Chains", "description": "Document QA - built on RetrievalQAChain to provide a chat history component", "inputParams": [ @@ -367,231 +549,57 @@ { "label": "Memory", "name": "memory", - "type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory", + "type": "BaseMemory", "optional": true, - "description": "If no memory connected, default BufferMemory will be used", - "id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory" + "description": "If left empty, a default BufferMemory will be used", + "id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory" } ], "inputs": { "model": "{{chatOpenAI_0.data.instance}}", - "vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}" + "vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}", + "memory": "", + "returnSourceDocuments": "", + "systemMessagePrompt": "", + "chainOption": "" }, "outputAnchors": [ { - "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain|BaseLangChain", + "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain", "name": "conversationalRetrievalQAChain", "label": "ConversationalRetrievalQAChain", - "type": "ConversationalRetrievalQAChain | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1627.1855024401737, - "y": 394.42287890442145 - }, - "dragging": false - }, - { - "width": 300, - "height": 411, - "id": "textFile_0", - "position": { - "x": 806.1207502345, - "y": 98.75458062792087 - }, - "type": "customNode", - "data": { - "id": "textFile_0", - "label": "Text File", - "name": "textFile", - "type": "Document", - "baseClasses": ["Document"], - "category": "Document Loaders", - "description": "Load data from text files", - "inputParams": [ - { - "label": "Txt File", - "name": "txtFile", - "type": "file", - "fileType": ".txt", - "id": "textFile_0-input-txtFile-file" - }, - { - "label": "Metadata", - "name": "metadata", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "textFile_0-input-metadata-json" - } - ], - "inputAnchors": [ - { - "label": "Text Splitter", - "name": "textSplitter", - "type": "TextSplitter", - "optional": true, - "id": "textFile_0-input-textSplitter-TextSplitter" - } - ], - "inputs": { - "textSplitter": "{{recursiveCharacterTextSplitter_1.data.instance}}", - "metadata": "" - }, - "outputAnchors": [ - { - "id": "textFile_0-output-textFile-Document", - "name": "textFile", - "label": "Document", - "type": "Document" + "type": "ConversationalRetrievalQAChain | BaseChain" } ], "outputs": {}, "selected": false }, "positionAbsolute": { - "x": 806.1207502345, - "y": 98.75458062792087 + "x": 1558.6564094656787, + "y": 386.60217819991124 }, "selected": false - }, - { - "width": 300, - "height": 655, - "id": "pineconeUpsert_0", - "position": { - "x": 1206.7979889462367, - "y": 526.4616330622748 - }, - "type": "customNode", - "data": { - "id": "pineconeUpsert_0", - "label": "Pinecone Upsert Document", - "name": "pineconeUpsert", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Upsert documents to Pinecone", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeUpsert_0-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeUpsert_0-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeUpsert_0-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "additionalParams": true, - "optional": true, - "id": "pineconeUpsert_0-input-pineconeNamespace-string" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeUpsert_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Document", - "name": "document", - "type": "Document", - "list": true, - "id": "pineconeUpsert_0-input-document-Document" - }, - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeUpsert_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "document": ["{{textFile_0.data.instance}}"], - "embeddings": "{{openAIEmbeddings_1.data.instance}}", - "pineconeEnv": "", - "pineconeIndex": "", - "pineconeNamespace": "", - "topK": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeUpsert_0-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "retriever" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1206.7979889462367, - "y": 526.4616330622748 - }, - "dragging": false } ], "edges": [ { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "conversationalRetrievalQAChain_0", - "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeUpsert_0", + "targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings", "data": { "label": "" } }, { - "source": "recursiveCharacterTextSplitter_1", - "sourceHandle": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", + "source": "recursiveCharacterTextSplitter_0", + "sourceHandle": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", "target": "textFile_0", "targetHandle": "textFile_0-input-textSplitter-TextSplitter", "type": "buttonedge", - "id": "recursiveCharacterTextSplitter_1-recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-textFile_0-textFile_0-input-textSplitter-TextSplitter", + "id": "recursiveCharacterTextSplitter_0-recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-textFile_0-textFile_0-input-textSplitter-TextSplitter", "data": { "label": "" } @@ -608,12 +616,12 @@ } }, { - "source": "openAIEmbeddings_1", - "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeUpsert_0", - "targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings", + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Github Repo QnA.json b/packages/server/marketplaces/chatflows/Flowise Docs QnA.json similarity index 67% rename from packages/server/marketplaces/chatflows/Github Repo QnA.json rename to packages/server/marketplaces/chatflows/Flowise Docs QnA.json index 73fbf304..6d11f3d2 100644 --- a/packages/server/marketplaces/chatflows/Github Repo QnA.json +++ b/packages/server/marketplaces/chatflows/Flowise Docs QnA.json @@ -1,23 +1,24 @@ { - "description": "Github repo QnA using conversational retrieval QA chain", + "description": "Flowise Docs Github QnA using conversational retrieval QA chain", "nodes": [ { "width": 300, "height": 376, - "id": "recursiveCharacterTextSplitter_1", + "id": "markdownTextSplitter_0", "position": { - "x": 447.1038086695898, - "y": 126.52301921543597 + "x": 1081.1540334344143, + "y": -113.73571627207801 }, "type": "customNode", "data": { - "id": "recursiveCharacterTextSplitter_1", - "label": "Recursive Character Text Splitter", - "name": "recursiveCharacterTextSplitter", - "type": "RecursiveCharacterTextSplitter", - "baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"], + "id": "markdownTextSplitter_0", + "label": "Markdown Text Splitter", + "name": "markdownTextSplitter", + "version": 1, + "type": "MarkdownTextSplitter", + "baseClasses": ["MarkdownTextSplitter", "RecursiveCharacterTextSplitter", "TextSplitter", "BaseDocumentTransformer"], "category": "Text Splitters", - "description": "Split documents recursively by different characters - starting with \"\n\n\", then \"\n\", then \" \"", + "description": "Split your content into documents based on the Markdown headers", "inputParams": [ { "label": "Chunk Size", @@ -25,115 +26,27 @@ "type": "number", "default": 1000, "optional": true, - "id": "recursiveCharacterTextSplitter_1-input-chunkSize-number" + "id": "markdownTextSplitter_0-input-chunkSize-number" }, { "label": "Chunk Overlap", "name": "chunkOverlap", "type": "number", "optional": true, - "id": "recursiveCharacterTextSplitter_1-input-chunkOverlap-number" + "id": "markdownTextSplitter_0-input-chunkOverlap-number" } ], "inputAnchors": [], "inputs": { - "chunkSize": 1000, + "chunkSize": "4000", "chunkOverlap": "" }, "outputAnchors": [ { - "id": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", - "name": "recursiveCharacterTextSplitter", - "label": "RecursiveCharacterTextSplitter", - "type": "RecursiveCharacterTextSplitter | TextSplitter" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 447.1038086695898, - "y": 126.52301921543597 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 578, - "id": "github_1", - "position": { - "x": 836.9660489009947, - "y": -44.04171088580361 - }, - "type": "customNode", - "data": { - "id": "github_1", - "label": "Github", - "name": "github", - "type": "Document", - "baseClasses": ["Document"], - "category": "Document Loaders", - "description": "Load data from a GitHub repository", - "inputParams": [ - { - "label": "Repo Link", - "name": "repoLink", - "type": "string", - "placeholder": "https://github.com/FlowiseAI/Flowise", - "id": "github_1-input-repoLink-string" - }, - { - "label": "Branch", - "name": "branch", - "type": "string", - "default": "main", - "id": "github_1-input-branch-string" - }, - { - "label": "Access Token", - "name": "accessToken", - "type": "password", - "placeholder": "", - "optional": true, - "id": "github_1-input-accessToken-password" - }, - { - "label": "Recursive", - "name": "recursive", - "type": "boolean", - "optional": true, - "id": "github_1-input-recursive-boolean" - }, - { - "label": "Metadata", - "name": "metadata", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "github_1-input-metadata-json" - } - ], - "inputAnchors": [ - { - "label": "Text Splitter", - "name": "textSplitter", - "type": "TextSplitter", - "optional": true, - "id": "github_1-input-textSplitter-TextSplitter" - } - ], - "inputs": { - "repoLink": "", - "branch": "main", - "textSplitter": "{{recursiveCharacterTextSplitter_1.data.instance}}" - }, - "outputAnchors": [ - { - "id": "github_1-output-github-Document", - "name": "github", - "label": "Document", - "type": "Document" + "id": "markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer", + "name": "markdownTextSplitter", + "label": "MarkdownTextSplitter", + "type": "MarkdownTextSplitter | RecursiveCharacterTextSplitter | TextSplitter | BaseDocumentTransformer" } ], "outputs": {}, @@ -141,146 +54,38 @@ }, "selected": false, "positionAbsolute": { - "x": 836.9660489009947, - "y": -44.04171088580361 + "x": 1081.1540334344143, + "y": -113.73571627207801 }, "dragging": false }, { "width": 300, - "height": 330, - "id": "openAIEmbeddings_1", + "height": 405, + "id": "memoryVectorStore_0", "position": { - "x": 833.4085562012468, - "y": 541.7875676090047 + "x": 1844.88052464165, + "y": 484.60473328470243 }, "type": "customNode", "data": { - "id": "openAIEmbeddings_1", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_1-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 833.4085562012468, - "y": 541.7875676090047 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 702, - "id": "pineconeUpsert_1", - "position": { - "x": 1268.7946529279823, - "y": 382.77997896801634 - }, - "type": "customNode", - "data": { - "id": "pineconeUpsert_1", - "label": "Pinecone Upsert Document", - "name": "pineconeUpsert", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "id": "memoryVectorStore_0", + "label": "In-Memory Vector Store", + "name": "memoryVectorStore", + "version": 1, + "type": "Memory", + "baseClasses": ["Memory", "VectorStoreRetriever", "BaseRetriever"], "category": "Vector Stores", - "description": "Upsert documents to Pinecone", + "description": "In-memory vectorstore that stores embeddings and does an exact, linear search for the most similar embeddings.", "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeUpsert_1-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeUpsert_1-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeUpsert_1-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeUpsert_1-input-pineconeNamespace-string" - }, { "label": "Top K", "name": "topK", "description": "Number of top results to fetch. Default to 4", "placeholder": "4", "type": "number", - "additionalParams": true, "optional": true, - "id": "pineconeUpsert_1-input-topK-number" + "id": "memoryVectorStore_0-input-topK-number" } ], "inputAnchors": [ @@ -289,21 +94,19 @@ "name": "document", "type": "Document", "list": true, - "id": "pineconeUpsert_1-input-document-Document" + "id": "memoryVectorStore_0-input-document-Document" }, { "label": "Embeddings", "name": "embeddings", "type": "Embeddings", - "id": "pineconeUpsert_1-input-embeddings-Embeddings" + "id": "memoryVectorStore_0-input-embeddings-Embeddings" } ], "inputs": { - "document": ["{{github_1.data.instance}}"], - "embeddings": "{{openAIEmbeddings_1.data.instance}}", - "pineconeEnv": "us-west4-gcp", - "pineconeIndex": "myindex", - "pineconeNamespace": "mynamespace" + "document": ["{{github_0.data.instance}}"], + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "topK": "" }, "outputAnchors": [ { @@ -312,16 +115,16 @@ "type": "options", "options": [ { - "id": "pineconeUpsert_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "id": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever", "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + "label": "Memory Retriever", + "type": "Memory | VectorStoreRetriever | BaseRetriever" }, { - "id": "pineconeUpsert_1-output-vectorStore-Pinecone|VectorStore", + "id": "memoryVectorStore_0-output-vectorStore-Memory|VectorStore", "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" + "label": "Memory Vector Store", + "type": "Memory | VectorStore" } ], "default": "retriever" @@ -333,35 +136,239 @@ "selected": false }, "selected": false, + "positionAbsolute": { + "x": 1844.88052464165, + "y": 484.60473328470243 + }, + "dragging": false + }, + { + "width": 300, + "height": 479, + "id": "conversationalRetrievalQAChain_0", + "position": { + "x": 2311.697827287373, + "y": 228.14841720207832 + }, + "type": "customNode", + "data": { + "id": "conversationalRetrievalQAChain_0", + "label": "Conversational Retrieval QA Chain", + "name": "conversationalRetrievalQAChain", + "version": 1, + "type": "ConversationalRetrievalQAChain", + "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"], + "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": true, + "systemMessagePrompt": "", + "chainOption": "" + }, + "outputAnchors": [ + { + "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain", + "name": "conversationalRetrievalQAChain", + "label": "ConversationalRetrievalQAChain", + "type": "ConversationalRetrievalQAChain | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, "dragging": false, "positionAbsolute": { - "x": 1268.7946529279823, - "y": 382.77997896801634 + "x": 2311.697827287373, + "y": 228.14841720207832 } }, { "width": 300, - "height": 524, + "height": 673, + "id": "github_0", + "position": { + "x": 1460.1858988997, + "y": -137.83585695472374 + }, + "type": "customNode", + "data": { + "id": "github_0", + "label": "Github", + "name": "github", + "version": 1, + "type": "Document", + "baseClasses": ["Document"], + "category": "Document Loaders", + "description": "Load data from a GitHub repository", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "description": "Only needed when accessing private repo", + "optional": true, + "credentialNames": ["githubApi"], + "id": "github_0-input-credential-credential" + }, + { + "label": "Repo Link", + "name": "repoLink", + "type": "string", + "placeholder": "https://github.com/FlowiseAI/Flowise", + "id": "github_0-input-repoLink-string" + }, + { + "label": "Branch", + "name": "branch", + "type": "string", + "default": "main", + "id": "github_0-input-branch-string" + }, + { + "label": "Recursive", + "name": "recursive", + "type": "boolean", + "optional": true, + "id": "github_0-input-recursive-boolean" + }, + { + "label": "Metadata", + "name": "metadata", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "github_0-input-metadata-json" + } + ], + "inputAnchors": [ + { + "label": "Text Splitter", + "name": "textSplitter", + "type": "TextSplitter", + "optional": true, + "id": "github_0-input-textSplitter-TextSplitter" + } + ], + "inputs": { + "repoLink": "https://github.com/FlowiseAI/FlowiseDocs", + "branch": "main", + "recursive": true, + "textSplitter": "{{markdownTextSplitter_0.data.instance}}", + "metadata": "" + }, + "outputAnchors": [ + { + "id": "github_0-output-github-Document", + "name": "github", + "label": "Document", + "type": "Document" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1460.1858988997, + "y": -137.83585695472374 + }, + "dragging": false + }, + { + "width": 300, + "height": 522, "id": "chatOpenAI_0", "position": { - "x": 1271.1300438358664, - "y": -169.75707425097968 + "x": 1857.367353502965, + "y": -104.25095383414119 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -465,19 +472,20 @@ "inputAnchors": [], "inputs": { "modelName": "gpt-3.5-turbo", - "temperature": "0.5", + "temperature": 0.9, "maxTokens": "", "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -485,169 +493,148 @@ }, "selected": false, "positionAbsolute": { - "x": 1271.1300438358664, - "y": -169.75707425097968 + "x": 1857.367353502965, + "y": -104.25095383414119 }, "dragging": false }, { "width": 300, - "height": 280, - "id": "conversationalRetrievalQAChain_0", + "height": 328, + "id": "openAIEmbeddings_0", "position": { - "x": 1653.6177539108153, - "y": 266.4856653480158 + "x": 1299.9983863833309, + "y": 581.8406384863323 }, "type": "customNode", "data": { - "id": "conversationalRetrievalQAChain_0", - "label": "Conversational Retrieval QA Chain", - "name": "conversationalRetrievalQAChain", - "type": "ConversationalRetrievalQAChain", - "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], - "category": "Chains", - "description": "Document QA - built on RetrievalQAChain to provide a chat history component", + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "type": "OpenAIEmbeddings", + "baseClasses": ["OpenAIEmbeddings", "Embeddings"], + "category": "Embeddings", + "description": "OpenAI API to generate embeddings for a given text", "inputParams": [ { - "label": "Return Source Documents", - "name": "returnSourceDocuments", + "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, - "id": "conversationalRetrievalQAChain_0-input-returnSourceDocuments-boolean" + "additionalParams": true, + "id": "openAIEmbeddings_0-input-stripNewLines-boolean" }, { - "label": "System Message", - "name": "systemMessagePrompt", + "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", - "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": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory", - "optional": true, - "description": "If no memory connected, default BufferMemory will be used", - "id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory" + "id": "openAIEmbeddings_0-input-basepath-string" } ], + "inputAnchors": [], "inputs": { - "model": "{{chatOpenAI_0.data.instance}}", - "vectorStoreRetriever": "{{pineconeUpsert_1.data.instance}}" + "stripNewLines": "", + "batchSize": "", + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain|BaseLangChain", - "name": "conversationalRetrievalQAChain", - "label": "ConversationalRetrievalQAChain", - "type": "ConversationalRetrievalQAChain | BaseChain | BaseLangChain" + "id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "name": "openAIEmbeddings", + "label": "OpenAIEmbeddings", + "type": "OpenAIEmbeddings | Embeddings" } ], "outputs": {}, "selected": false }, "selected": false, + "dragging": false, "positionAbsolute": { - "x": 1653.6177539108153, - "y": 266.4856653480158 - }, - "dragging": false + "x": 1299.9983863833309, + "y": 581.8406384863323 + } } ], "edges": [ { - "source": "github_1", - "sourceHandle": "github_1-output-github-Document", - "target": "pineconeUpsert_1", - "targetHandle": "pineconeUpsert_1-input-document-Document", + "source": "memoryVectorStore_0", + "sourceHandle": "memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", "type": "buttonedge", - "id": "github_1-github_1-output-github-Document-pineconeUpsert_1-pineconeUpsert_1-input-document-Document", + "id": "memoryVectorStore_0-memoryVectorStore_0-output-retriever-Memory|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", "data": { "label": "" } }, { - "source": "openAIEmbeddings_1", - "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeUpsert_1", - "targetHandle": "pineconeUpsert_1-input-embeddings-Embeddings", + "source": "markdownTextSplitter_0", + "sourceHandle": "markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer", + "target": "github_0", + "targetHandle": "github_0-input-textSplitter-TextSplitter", "type": "buttonedge", - "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_1-pineconeUpsert_1-input-embeddings-Embeddings", + "id": "markdownTextSplitter_0-markdownTextSplitter_0-output-markdownTextSplitter-MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer-github_0-github_0-input-textSplitter-TextSplitter", "data": { "label": "" } }, { - "source": "recursiveCharacterTextSplitter_1", - "sourceHandle": "recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter", - "target": "github_1", - "targetHandle": "github_1-input-textSplitter-TextSplitter", + "source": "github_0", + "sourceHandle": "github_0-output-github-Document", + "target": "memoryVectorStore_0", + "targetHandle": "memoryVectorStore_0-input-document-Document", "type": "buttonedge", - "id": "recursiveCharacterTextSplitter_1-recursiveCharacterTextSplitter_1-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-github_1-github_1-input-textSplitter-TextSplitter", + "id": "github_0-github_0-output-github-Document-memoryVectorStore_0-memoryVectorStore_0-input-document-Document", "data": { "label": "" } }, { "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "conversationalRetrievalQAChain_0", "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "data": { "label": "" } }, { - "source": "pineconeUpsert_1", - "sourceHandle": "pineconeUpsert_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "target": "conversationalRetrievalQAChain_0", - "targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "memoryVectorStore_0", + "targetHandle": "memoryVectorStore_0-input-embeddings-Embeddings", "type": "buttonedge", - "id": "pineconeUpsert_1-pineconeUpsert_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-memoryVectorStore_0-memoryVectorStore_0-input-embeddings-Embeddings", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/HuggingFace LLM Chain.json b/packages/server/marketplaces/chatflows/HuggingFace LLM Chain.json index 63a04b03..6e159a28 100644 --- a/packages/server/marketplaces/chatflows/HuggingFace LLM Chain.json +++ b/packages/server/marketplaces/chatflows/HuggingFace LLM Chain.json @@ -14,6 +14,7 @@ "id": "llmChain_1", "label": "LLM Chain", "name": "llmChain", + "version": 1, "type": "LLMChain", "baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -81,120 +82,6 @@ "selected": false, "dragging": false }, - { - "width": 300, - "height": 429, - "id": "huggingFaceInference_LLMs_0", - "position": { - "x": 503.5630827259226, - "y": 50.79125094823999 - }, - "type": "customNode", - "data": { - "id": "huggingFaceInference_LLMs_0", - "label": "HuggingFace Inference", - "name": "huggingFaceInference_LLMs", - "type": "HuggingFaceInference", - "baseClasses": ["HuggingFaceInference", "LLM", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around HuggingFace large language models", - "inputParams": [ - { - "label": "Model", - "name": "model", - "type": "string", - "placeholder": "gpt2", - "id": "huggingFaceInference_LLMs_0-input-model-string" - }, - { - "label": "HuggingFace Api Key", - "name": "apiKey", - "type": "password", - "id": "huggingFaceInference_LLMs_0-input-apiKey-password" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "description": "Temperature parameter may not apply to certain model. Please check available model parameters", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "description": "Max Tokens parameter may not apply to certain model. Please check available model parameters", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "description": "Top Probability parameter may not apply to certain model. Please check available model parameters", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-topP-number" - }, - { - "label": "Top K", - "name": "hfTopK", - "type": "number", - "description": "Top K parameter may not apply to certain model. Please check available model parameters", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-hfTopK-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "description": "Frequency Penalty parameter may not apply to certain model. Please check available model parameters", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-frequencyPenalty-number" - }, - { - "label": "Endpoint", - "name": "endpoint", - "type": "string", - "placeholder": "https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2", - "description": "Using your own inference endpoint", - "optional": true, - "additionalParams": true, - "id": "huggingFaceInference_LLMs_0-input-endpoint-string" - } - ], - "inputAnchors": [], - "inputs": { - "model": "tiiuae/falcon-7b-instruct", - "temperature": "", - "maxTokens": "200", - "topP": "", - "hfTopK": "10", - "frequencyPenalty": "" - }, - "outputAnchors": [ - { - "id": "huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "huggingFaceInference_LLMs", - "label": "HuggingFaceInference", - "type": "HuggingFaceInference | LLM | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 503.5630827259226, - "y": 50.79125094823999 - }, - "dragging": false - }, { "width": 300, "height": 475, @@ -208,6 +95,7 @@ "id": "promptTemplate_0", "label": "Prompt Template", "name": "promptTemplate", + "version": 1, "type": "PromptTemplate", "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -253,20 +141,127 @@ "y": 504.50766458127396 }, "dragging": false + }, + { + "width": 300, + "height": 526, + "id": "huggingFaceInference_LLMs_0", + "position": { + "x": 498.8594464193537, + "y": -44.91050256311678 + }, + "type": "customNode", + "data": { + "id": "huggingFaceInference_LLMs_0", + "label": "HuggingFace Inference", + "name": "huggingFaceInference_LLMs", + "version": 1, + "type": "HuggingFaceInference", + "baseClasses": ["HuggingFaceInference", "LLM", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around HuggingFace large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["huggingFaceApi"], + "id": "huggingFaceInference_LLMs_0-input-credential-credential" + }, + { + "label": "Model", + "name": "model", + "type": "string", + "description": "If using own inference endpoint, leave this blank", + "placeholder": "gpt2", + "optional": true, + "id": "huggingFaceInference_LLMs_0-input-model-string" + }, + { + "label": "Endpoint", + "name": "endpoint", + "type": "string", + "placeholder": "https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2", + "description": "Using your own inference endpoint", + "optional": true, + "id": "huggingFaceInference_LLMs_0-input-endpoint-string" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "description": "Temperature parameter may not apply to certain model. Please check available model parameters", + "optional": true, + "additionalParams": true, + "id": "huggingFaceInference_LLMs_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "description": "Max Tokens parameter may not apply to certain model. Please check available model parameters", + "optional": true, + "additionalParams": true, + "id": "huggingFaceInference_LLMs_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "description": "Top Probability parameter may not apply to certain model. Please check available model parameters", + "optional": true, + "additionalParams": true, + "id": "huggingFaceInference_LLMs_0-input-topP-number" + }, + { + "label": "Top K", + "name": "hfTopK", + "type": "number", + "description": "Top K parameter may not apply to certain model. Please check available model parameters", + "optional": true, + "additionalParams": true, + "id": "huggingFaceInference_LLMs_0-input-hfTopK-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "description": "Frequency Penalty parameter may not apply to certain model. Please check available model parameters", + "optional": true, + "additionalParams": true, + "id": "huggingFaceInference_LLMs_0-input-frequencyPenalty-number" + } + ], + "inputAnchors": [], + "inputs": { + "model": "tiiuae/falcon-7b-instruct", + "endpoint": "", + "temperature": "", + "maxTokens": "", + "topP": "", + "hfTopK": "", + "frequencyPenalty": "" + }, + "outputAnchors": [ + { + "id": "huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel", + "name": "huggingFaceInference_LLMs", + "label": "HuggingFaceInference", + "type": "HuggingFaceInference | LLM | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 498.8594464193537, + "y": -44.91050256311678 + }, + "dragging": false } ], "edges": [ - { - "source": "huggingFaceInference_LLMs_0", - "sourceHandle": "huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "huggingFaceInference_LLMs_0-huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel|BaseLangChain-llmChain_1-llmChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "promptTemplate_0", "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", @@ -277,6 +272,17 @@ "data": { "label": "" } + }, + { + "source": "huggingFaceInference_LLMs_0", + "sourceHandle": "huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "huggingFaceInference_LLMs_0-huggingFaceInference_LLMs_0-output-huggingFaceInference_LLMs-HuggingFaceInference|LLM|BaseLLM|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Local QnA.json b/packages/server/marketplaces/chatflows/Local QnA.json index 5265c428..9d9f5ec8 100644 --- a/packages/server/marketplaces/chatflows/Local QnA.json +++ b/packages/server/marketplaces/chatflows/Local QnA.json @@ -14,6 +14,7 @@ "id": "recursiveCharacterTextSplitter_1", "label": "Recursive Character Text Splitter", "name": "recursiveCharacterTextSplitter", + "version": 1, "type": "RecursiveCharacterTextSplitter", "baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"], "category": "Text Splitters", @@ -71,6 +72,7 @@ "id": "conversationalRetrievalQAChain_0", "label": "Conversational Retrieval QA Chain", "name": "conversationalRetrievalQAChain", + "version": 1, "type": "ConversationalRetrievalQAChain", "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -135,15 +137,16 @@ { "label": "Memory", "name": "memory", - "type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory", + "type": "BaseMemory", "optional": true, - "description": "If no memory connected, default BufferMemory will be used", - "id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory" + "description": "If left empty, a default BufferMemory will be used", + "id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory" } ], "inputs": { "model": "{{chatLocalAI_0.data.instance}}", - "vectorStoreRetriever": "{{faissUpsert_0.data.instance}}" + "vectorStoreRetriever": "{{faissUpsert_0.data.instance}}", + "memory": "" }, "outputAnchors": [ { @@ -176,6 +179,7 @@ "id": "faissUpsert_0", "label": "Faiss Upsert Document", "name": "faissUpsert", + "version": 1, "type": "Faiss", "baseClasses": ["Faiss", "VectorStoreRetriever", "BaseRetriever"], "category": "Vector Stores", @@ -268,6 +272,7 @@ "id": "chatLocalAI_0", "label": "ChatLocalAI", "name": "chatLocalAI", + "version": 1, "type": "ChatLocalAI", "baseClasses": ["ChatLocalAI", "BaseChatModel", "LLM", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], "category": "Chat Models", @@ -360,6 +365,7 @@ "id": "textFile_0", "label": "Text File", "name": "textFile", + "version": 1, "type": "Document", "baseClasses": ["Document"], "category": "Document Loaders", @@ -425,6 +431,7 @@ "id": "localAIEmbeddings_0", "label": "LocalAI Embeddings", "name": "localAIEmbeddings", + "version": 1, "type": "LocalAI Embeddings", "baseClasses": ["LocalAI Embeddings", "Embeddings"], "category": "Embeddings", diff --git a/packages/server/marketplaces/chatflows/Long Term Memory.json b/packages/server/marketplaces/chatflows/Long Term Memory.json new file mode 100644 index 00000000..07669f82 --- /dev/null +++ b/packages/server/marketplaces/chatflows/Long Term Memory.json @@ -0,0 +1,647 @@ +{ + "description": "Use long term memory Zep to differentiate conversations between users with sessionId", + "nodes": [ + { + "width": 300, + "height": 480, + "id": "conversationalRetrievalQAChain_0", + "position": { + "x": 1999.7302950816731, + "y": 365.33064907894243 + }, + "type": "customNode", + "data": { + "id": "conversationalRetrievalQAChain_0", + "label": "Conversational Retrieval QA Chain", + "name": "conversationalRetrievalQAChain", + "version": 1, + "type": "ConversationalRetrievalQAChain", + "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], + "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": "{{pineconeExistingIndex_0.data.instance}}", + "memory": "{{ZepMemory_0.data.instance}}", + "returnSourceDocuments": true + }, + "outputAnchors": [ + { + "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain|BaseLangChain", + "name": "conversationalRetrievalQAChain", + "label": "ConversationalRetrievalQAChain", + "type": "ConversationalRetrievalQAChain | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1999.7302950816731, + "y": 365.33064907894243 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 1554.3875781165111, + "y": -14.792508259787212 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1554.3875781165111, + "y": -14.792508259787212 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_0", + "position": { + "x": 789.6839176356616, + "y": 167.70165941305987 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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, + "positionAbsolute": { + "x": 789.6839176356616, + "y": 167.70165941305987 + }, + "dragging": false + }, + { + "width": 300, + "height": 505, + "id": "pineconeExistingIndex_0", + "position": { + "x": 1167.128201355349, + "y": 71.89355115516406 + }, + "type": "customNode", + "data": { + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" + }, + { + "label": "Pinecone Metadata Filter", + "name": "pineconeMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1167.128201355349, + "y": 71.89355115516406 + }, + "dragging": false + }, + { + "width": 300, + "height": 623, + "id": "ZepMemory_0", + "position": { + "x": 1552.2067611642792, + "y": 560.8352147865392 + }, + "type": "customNode", + "data": { + "id": "ZepMemory_0", + "label": "Zep Memory", + "name": "ZepMemory", + "version": 1, + "type": "ZepMemory", + "baseClasses": ["ZepMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Summarizes the conversation and stores the memory in zep server", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "optional": true, + "description": "Configure JWT authentication on your Zep instance (Optional)", + "credentialNames": ["zepMemoryApi"], + "id": "ZepMemory_0-input-credential-credential" + }, + { + "label": "Base URL", + "name": "baseURL", + "type": "string", + "default": "http://127.0.0.1:8000", + "id": "ZepMemory_0-input-baseURL-string" + }, + { + "label": "Auto Summary", + "name": "autoSummary", + "type": "boolean", + "default": true, + "id": "ZepMemory_0-input-autoSummary-boolean" + }, + { + "label": "Session Id", + "name": "sessionId", + "type": "string", + "description": "if empty, chatId will be used automatically", + "default": "", + "additionalParams": true, + "optional": true, + "id": "ZepMemory_0-input-sessionId-string" + }, + { + "label": "Size", + "name": "k", + "type": "number", + "default": "10", + "step": 1, + "description": "Window of size k to surface the last k back-and-forths to use as memory.", + "id": "ZepMemory_0-input-k-number" + }, + { + "label": "Auto Summary Template", + "name": "autoSummaryTemplate", + "type": "string", + "default": "This is the summary of the following conversation:\n{summary}", + "additionalParams": true, + "id": "ZepMemory_0-input-autoSummaryTemplate-string" + }, + { + "label": "AI Prefix", + "name": "aiPrefix", + "type": "string", + "default": "ai", + "additionalParams": true, + "id": "ZepMemory_0-input-aiPrefix-string" + }, + { + "label": "Human Prefix", + "name": "humanPrefix", + "type": "string", + "default": "human", + "additionalParams": true, + "id": "ZepMemory_0-input-humanPrefix-string" + }, + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "additionalParams": true, + "id": "ZepMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "additionalParams": true, + "id": "ZepMemory_0-input-inputKey-string" + }, + { + "label": "Output Key", + "name": "outputKey", + "type": "string", + "default": "text", + "additionalParams": true, + "id": "ZepMemory_0-input-outputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "baseURL": "http://127.0.0.1:8000", + "autoSummary": true, + "sessionId": "", + "k": "10", + "autoSummaryTemplate": "This is the summary of the following conversation:\n{summary}", + "aiPrefix": "ai", + "humanPrefix": "human", + "memoryKey": "chat_history", + "inputKey": "input", + "outputKey": "text" + }, + "outputAnchors": [ + { + "id": "ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory", + "name": "ZepMemory", + "label": "ZepMemory", + "type": "ZepMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1552.2067611642792, + "y": 560.8352147865392 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "pineconeExistingIndex_0", + "sourceHandle": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + }, + { + "source": "ZepMemory_0", + "sourceHandle": "ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-memory-BaseMemory", + "type": "buttonedge", + "id": "ZepMemory_0-ZepMemory_0-output-ZepMemory-ZepMemory|BaseChatMemory|BaseMemory-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-memory-BaseMemory", + "data": { + "label": "" + } + } + ] +} diff --git a/packages/server/marketplaces/chatflows/MRKLAgent.json b/packages/server/marketplaces/chatflows/MRKLAgent.json index 257123e0..f851b0ed 100644 --- a/packages/server/marketplaces/chatflows/MRKLAgent.json +++ b/packages/server/marketplaces/chatflows/MRKLAgent.json @@ -1,51 +1,6 @@ { "description": "An agent that uses the React Framework to decide what action to take", "nodes": [ - { - "width": 300, - "height": 278, - "id": "serpAPI_1", - "position": { - "x": 312.0655985817535, - "y": 112.09909989842703 - }, - "type": "customNode", - "data": { - "id": "serpAPI_1", - "label": "Serp API", - "name": "serpAPI", - "type": "SerpAPI", - "baseClasses": ["SerpAPI", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Wrapper around SerpAPI - a real-time API to access Google search results", - "inputParams": [ - { - "label": "Serp Api Key", - "name": "apiKey", - "type": "password", - "id": "serpAPI_1-input-apiKey-password" - } - ], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", - "name": "serpAPI", - "label": "SerpAPI", - "type": "SerpAPI | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 312.0655985817535, - "y": 112.09909989842703 - }, - "dragging": false - }, { "width": 300, "height": 143, @@ -59,6 +14,7 @@ "id": "calculator_1", "label": "Calculator", "name": "calculator", + "version": 1, "type": "Calculator", "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain"], "category": "Tools", @@ -84,159 +40,6 @@ "selected": false, "dragging": false }, - { - "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 663.1307301893027, - "y": 394.7618562930441 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": 0.7, - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 663.1307301893027, - "y": 394.7618562930441 - }, - "dragging": false - }, { "width": 300, "height": 280, @@ -250,6 +53,7 @@ "id": "mrklAgentLLM_0", "label": "MRKL Agent for LLMs", "name": "mrklAgentLLM", + "version": 1, "type": "AgentExecutor", "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], "category": "Agents", @@ -271,8 +75,8 @@ } ], "inputs": { - "tools": ["{{calculator_1.data.instance}}", "{{serpAPI_1.data.instance}}"], - "model": "{{openAI_1.data.instance}}" + "tools": ["{{calculator_1.data.instance}}", "{{serper_0.data.instance}}"], + "model": "{{chatOpenAI_0.data.instance}}" }, "outputAnchors": [ { @@ -291,6 +95,207 @@ "y": 245.36098016819074 }, "dragging": false + }, + { + "width": 300, + "height": 277, + "id": "serper_0", + "position": { + "x": 330.964079024626, + "y": 109.83185250619351 + }, + "type": "customNode", + "data": { + "id": "serper_0", + "label": "Serper", + "name": "serper", + "version": 1, + "type": "Serper", + "baseClasses": ["Serper", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Wrapper around Serper.dev - Google Search API", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["serperApi"], + "id": "serper_0-input-credential-credential" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "serper_0-output-serper-Serper|Tool|StructuredTool", + "name": "serper", + "label": "Serper", + "type": "Serper | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 330.964079024626, + "y": 109.83185250619351 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 333.58931284721206, + "y": 416.98420974875927 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 333.58931284721206, + "y": 416.98420974875927 + }, + "dragging": false } ], "edges": [ @@ -306,23 +311,23 @@ } }, { - "source": "serpAPI_1", - "sourceHandle": "serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", + "source": "serper_0", + "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool", "target": "mrklAgentLLM_0", "targetHandle": "mrklAgentLLM_0-input-tools-Tool", "type": "buttonedge", - "id": "serpAPI_1-serpAPI_1-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-tools-Tool", + "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool-mrklAgentLLM_0-mrklAgentLLM_0-input-tools-Tool", "data": { "label": "" } }, { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "mrklAgentLLM_0", "targetHandle": "mrklAgentLLM_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Metadata Filter Load.json b/packages/server/marketplaces/chatflows/Metadata Filter Load.json index 61dad1c4..b6ca91e3 100644 --- a/packages/server/marketplaces/chatflows/Metadata Filter Load.json +++ b/packages/server/marketplaces/chatflows/Metadata Filter Load.json @@ -3,364 +3,18 @@ "nodes": [ { "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 1195.6182217299724, - "y": -12.958591115085468 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": "0", - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1195.6182217299724, - "y": -12.958591115085468 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 330, - "id": "openAIEmbeddings_1", - "position": { - "x": 777.5098693425334, - "y": 308.4221448953297 - }, - "type": "customNode", - "data": { - "id": "openAIEmbeddings_1", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_1-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 777.5098693425334, - "y": 308.4221448953297 - }, - "dragging": false - }, - { - "width": 300, - "height": 703, - "id": "pineconeExistingIndex_0", - "position": { - "x": 1187.519066203033, - "y": 542.6635399602128 - }, - "type": "customNode", - "data": { - "id": "pineconeExistingIndex_0", - "label": "Pinecone Load Existing Index", - "name": "pineconeExistingIndex", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Pinecone (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeExistingIndex_0-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeExistingIndex_0-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeExistingIndex_0-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" - }, - { - "label": "Pinecone Metadata Filter", - "name": "pineconeMetadataFilter", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeExistingIndex_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_1.data.instance}}", - "pineconeEnv": "northamerica-northeast1-gcp", - "pineconeIndex": "myindex", - "pineconeNamespace": "my-namespace", - "pineconeMetadataFilter": "{\"id\":\"doc1\"}" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "retriever" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1187.519066203033, - "y": 542.6635399602128 - }, - "dragging": false - }, - { - "width": 300, - "height": 280, + "height": 480, "id": "conversationalRetrievalQAChain_0", "position": { - "x": 1585.900129303412, - "y": 405.9784391258126 + "x": 1643.035168558474, + "y": 360.96295365212774 }, "type": "customNode", "data": { "id": "conversationalRetrievalQAChain_0", "label": "Conversational Retrieval QA Chain", "name": "conversationalRetrievalQAChain", + "version": 1, "type": "ConversationalRetrievalQAChain", "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -425,14 +79,14 @@ { "label": "Memory", "name": "memory", - "type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory", + "type": "BaseMemory", "optional": true, - "description": "If no memory connected, default BufferMemory will be used", - "id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory" + "description": "If left empty, a default BufferMemory will be used", + "id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory" } ], "inputs": { - "model": "{{openAI_1.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", "vectorStoreRetriever": "{{pineconeExistingIndex_0.data.instance}}" }, "outputAnchors": [ @@ -448,31 +102,378 @@ }, "selected": false, "positionAbsolute": { - "x": 1585.900129303412, - "y": 405.9784391258126 + "x": 1643.035168558474, + "y": 360.96295365212774 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 1197.7264239788542, + "y": -16.177600120515933 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1197.7264239788542, + "y": -16.177600120515933 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_0", + "position": { + "x": 805.2662010688601, + "y": 389.3163571296623 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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, + "positionAbsolute": { + "x": 805.2662010688601, + "y": 389.3163571296623 + }, + "dragging": false + }, + { + "width": 300, + "height": 505, + "id": "pineconeExistingIndex_0", + "position": { + "x": 1194.8300385699242, + "y": 542.8247838029442 + }, + "type": "customNode", + "data": { + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" + }, + { + "label": "Pinecone Metadata Filter", + "name": "pineconeMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1194.8300385699242, + "y": 542.8247838029442 }, "dragging": false } ], "edges": [ { - "source": "openAIEmbeddings_1", - "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", "target": "pineconeExistingIndex_0", "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", "type": "buttonedge", - "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", "data": { "label": "" } }, { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "conversationalRetrievalQAChain_0", "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Metadata Filter Upsert.json b/packages/server/marketplaces/chatflows/Metadata Filter Upsert.json index f2273825..e70b11f7 100644 --- a/packages/server/marketplaces/chatflows/Metadata Filter Upsert.json +++ b/packages/server/marketplaces/chatflows/Metadata Filter Upsert.json @@ -14,6 +14,7 @@ "id": "recursiveCharacterTextSplitter_1", "label": "Recursive Character Text Splitter", "name": "recursiveCharacterTextSplitter", + "version": 1, "type": "RecursiveCharacterTextSplitter", "baseClasses": ["RecursiveCharacterTextSplitter", "TextSplitter"], "category": "Text Splitters", @@ -58,240 +59,6 @@ }, "dragging": false }, - { - "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 1159.184721109528, - "y": -38.76565405456694 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": "0", - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1159.184721109528, - "y": -38.76565405456694 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 330, - "id": "openAIEmbeddings_1", - "position": { - "x": 749.4044250705479, - "y": 858.4858399327618 - }, - "type": "customNode", - "data": { - "id": "openAIEmbeddings_1", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_1-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 749.4044250705479, - "y": 858.4858399327618 - }, - "dragging": false - }, { "width": 300, "height": 392, @@ -305,6 +72,7 @@ "id": "textFile_0", "label": "Text File", "name": "textFile", + "version": 1, "type": "Document", "baseClasses": ["Document"], "category": "Document Loaders", @@ -370,6 +138,7 @@ "id": "pdfFile_0", "label": "Pdf File", "name": "pdfFile", + "version": 1, "type": "Document", "baseClasses": ["Document"], "category": "Document Loaders", @@ -442,119 +211,7 @@ }, { "width": 300, - "height": 702, - "id": "pineconeUpsert_0", - "position": { - "x": 1161.8813042660154, - "y": 537.0216614326227 - }, - "type": "customNode", - "data": { - "id": "pineconeUpsert_0", - "label": "Pinecone Upsert Document", - "name": "pineconeUpsert", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Upsert documents to Pinecone", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeUpsert_0-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeUpsert_0-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeUpsert_0-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeUpsert_0-input-pineconeNamespace-string" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeUpsert_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Document", - "name": "document", - "type": "Document", - "list": true, - "id": "pineconeUpsert_0-input-document-Document" - }, - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeUpsert_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "document": ["{{pdfFile_0.data.instance}}", "{{textFile_0.data.instance}}"], - "embeddings": "{{openAIEmbeddings_1.data.instance}}", - "pineconeEnv": "northamerica-northeast1-gcp", - "pineconeIndex": "myindex", - "pineconeNamespace": "my-namespace" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeUpsert_0-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "retriever" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1161.8813042660154, - "y": 537.0216614326227 - }, - "dragging": false - }, - { - "width": 300, - "height": 280, + "height": 480, "id": "conversationalRetrievalQAChain_0", "position": { "x": 1570.3859788160953, @@ -565,6 +222,7 @@ "id": "conversationalRetrievalQAChain_0", "label": "Conversational Retrieval QA Chain", "name": "conversationalRetrievalQAChain", + "version": 1, "type": "ConversationalRetrievalQAChain", "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -629,14 +287,14 @@ { "label": "Memory", "name": "memory", - "type": "DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory", + "type": "BaseMemory", "optional": true, - "description": "If no memory connected, default BufferMemory will be used", - "id": "conversationalRetrievalQAChain_0-input-memory-DynamoDBChatMemory | RedisBackedChatMemory | ZepMemory" + "description": "If left empty, a default BufferMemory will be used", + "id": "conversationalRetrievalQAChain_0-input-memory-BaseMemory" } ], "inputs": { - "model": "{{openAI_1.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", "vectorStoreRetriever": "{{pineconeUpsert_0.data.instance}}" }, "outputAnchors": [ @@ -656,6 +314,352 @@ "y": 423.6687850109136 }, "dragging": false + }, + { + "width": 300, + "height": 555, + "id": "pineconeUpsert_0", + "position": { + "x": 1161.2426252201622, + "y": 549.7917156049002 + }, + "type": "customNode", + "data": { + "id": "pineconeUpsert_0", + "label": "Pinecone Upsert Document", + "name": "pineconeUpsert", + "type": "Pinecone", + "version": 1, + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Upsert documents to Pinecone", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeUpsert_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeUpsert_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-pineconeNamespace-string" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Document", + "name": "document", + "type": "Document", + "list": true, + "id": "pineconeUpsert_0-input-document-Document" + }, + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeUpsert_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "document": ["{{textFile_0.data.instance}}", "{{pdfFile_0.data.instance}}"], + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeUpsert_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1161.2426252201622, + "y": 549.7917156049002 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 1164.9667590264419, + "y": -44.2076264967032 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": 0.9, + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1164.9667590264419, + "y": -44.2076264967032 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_0", + "position": { + "x": 772.0706424639393, + "y": 862.6189553323906 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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, + "positionAbsolute": { + "x": 772.0706424639393, + "y": 862.6189553323906 + }, + "dragging": false } ], "edges": [ @@ -682,23 +686,12 @@ } }, { - "source": "openAIEmbeddings_1", - "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", "target": "pineconeUpsert_0", "targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings", "type": "buttonedge", - "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, - { - "source": "pdfFile_0", - "sourceHandle": "pdfFile_0-output-pdfFile-Document", - "target": "pineconeUpsert_0", - "targetHandle": "pineconeUpsert_0-input-document-Document", - "type": "buttonedge", - "id": "pdfFile_0-pdfFile_0-output-pdfFile-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings", "data": { "label": "" } @@ -715,12 +708,23 @@ } }, { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "source": "pdfFile_0", + "sourceHandle": "pdfFile_0-output-pdfFile-Document", + "target": "pineconeUpsert_0", + "targetHandle": "pineconeUpsert_0-input-document-Document", + "type": "buttonedge", + "id": "pdfFile_0-pdfFile_0-output-pdfFile-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "conversationalRetrievalQAChain_0", "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Multi Prompt Chain.json b/packages/server/marketplaces/chatflows/Multi Prompt Chain.json index 339476e7..cf86df5b 100644 --- a/packages/server/marketplaces/chatflows/Multi Prompt Chain.json +++ b/packages/server/marketplaces/chatflows/Multi Prompt Chain.json @@ -14,6 +14,7 @@ "id": "promptRetriever_0", "label": "Prompt Retriever", "name": "promptRetriever", + "version": 1, "type": "PromptRetriever", "baseClasses": ["PromptRetriever"], "category": "Retrievers", @@ -81,6 +82,7 @@ "id": "multiPromptChain_0", "label": "Multi Prompt Chain", "name": "multiPromptChain", + "version": 1, "type": "MultiPromptChain", "baseClasses": ["MultiPromptChain", "MultiRouteChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -140,6 +142,7 @@ "id": "promptRetriever_1", "label": "Prompt Retriever", "name": "promptRetriever", + "version": 1, "type": "PromptRetriever", "baseClasses": ["PromptRetriever"], "category": "Retrievers", @@ -207,6 +210,7 @@ "id": "promptRetriever_2", "label": "Prompt Retriever", "name": "promptRetriever", + "version": 1, "type": "PromptRetriever", "baseClasses": ["PromptRetriever"], "category": "Retrievers", @@ -263,27 +267,29 @@ }, { "width": 300, - "height": 524, + "height": 523, "id": "chatOpenAI_0", "position": { - "x": 1230.07368145571, - "y": -296.44522826934826 + "x": 1228.4059611466973, + "y": -326.46419383157513 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -392,14 +398,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -407,8 +414,8 @@ }, "selected": false, "positionAbsolute": { - "x": 1230.07368145571, - "y": -296.44522826934826 + "x": 1228.4059611466973, + "y": -326.46419383157513 }, "dragging": false } @@ -449,11 +456,11 @@ }, { "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "multiPromptChain_0", "targetHandle": "multiPromptChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-multiPromptChain_0-multiPromptChain_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-multiPromptChain_0-multiPromptChain_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Multi Retrieval QA Chain.json b/packages/server/marketplaces/chatflows/Multi Retrieval QA Chain.json index 04df2fee..f5604bf6 100644 --- a/packages/server/marketplaces/chatflows/Multi Retrieval QA Chain.json +++ b/packages/server/marketplaces/chatflows/Multi Retrieval QA Chain.json @@ -3,7 +3,7 @@ "nodes": [ { "width": 300, - "height": 504, + "height": 505, "id": "vectorStoreRetriever_0", "position": { "x": 712.9322670298264, @@ -14,6 +14,7 @@ "id": "vectorStoreRetriever_0", "label": "Vector Store Retriever", "name": "vectorStoreRetriever", + "version": 1, "type": "VectorStoreRetriever", "baseClasses": ["VectorStoreRetriever"], "category": "Retrievers", @@ -69,7 +70,7 @@ }, { "width": 300, - "height": 279, + "height": 377, "id": "multiRetrievalQAChain_0", "position": { "x": 1563.0150452201099, @@ -80,6 +81,7 @@ "id": "multiRetrievalQAChain_0", "label": "Multi Retrieval QA Chain", "name": "multiRetrievalQAChain", + "version": 1, "type": "MultiRetrievalQAChain", "baseClasses": ["MultiRetrievalQAChain", "MultiRouteChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -135,7 +137,7 @@ }, { "width": 300, - "height": 504, + "height": 505, "id": "vectorStoreRetriever_1", "position": { "x": 711.4902931206071, @@ -146,6 +148,7 @@ "id": "vectorStoreRetriever_1", "label": "Vector Store Retriever", "name": "vectorStoreRetriever", + "version": 1, "type": "VectorStoreRetriever", "baseClasses": ["VectorStoreRetriever"], "category": "Retrievers", @@ -201,7 +204,7 @@ }, { "width": 300, - "height": 504, + "height": 505, "id": "vectorStoreRetriever_2", "position": { "x": 706.0716220151372, @@ -212,6 +215,7 @@ "id": "vectorStoreRetriever_2", "label": "Vector Store Retriever", "name": "vectorStoreRetriever", + "version": 1, "type": "VectorStoreRetriever", "baseClasses": ["VectorStoreRetriever"], "category": "Retrievers", @@ -265,29 +269,428 @@ }, "dragging": false }, + { + "width": 300, + "height": 505, + "id": "pineconeExistingIndex_0", + "position": { + "x": 267.45589163840236, + "y": -300.13817634747346 + }, + "type": "customNode", + "data": { + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" + }, + { + "label": "Pinecone Metadata Filter", + "name": "pineconeMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "vectorStore" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 267.45589163840236, + "y": -300.13817634747346 + }, + "dragging": false + }, + { + "width": 300, + "height": 506, + "id": "chromaExistingIndex_0", + "position": { + "x": 264.5271545331116, + "y": 246.32716342844174 + }, + "type": "customNode", + "data": { + "id": "chromaExistingIndex_0", + "label": "Chroma Load Existing Index", + "name": "chromaExistingIndex", + "version": 1, + "type": "Chroma", + "baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Chroma (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Collection Name", + "name": "collectionName", + "type": "string", + "id": "chromaExistingIndex_0-input-collectionName-string" + }, + { + "label": "Chroma URL", + "name": "chromaURL", + "type": "string", + "optional": true, + "id": "chromaExistingIndex_0-input-chromaURL-string" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "chromaExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "chromaExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "collectionName": "", + "chromaURL": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "chromaExistingIndex_0-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Chroma Retriever", + "type": "Chroma | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "chromaExistingIndex_0-output-vectorStore-Chroma|VectorStore", + "name": "vectorStore", + "label": "Chroma Vector Store", + "type": "Chroma | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "vectorStore" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 264.5271545331116, + "y": 246.32716342844174 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_0", + "position": { + "x": -212.46977797044045, + "y": 252.45726960585722 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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, + "positionAbsolute": { + "x": -212.46977797044045, + "y": 252.45726960585722 + }, + "dragging": false + }, + { + "width": 300, + "height": 702, + "id": "supabaseExistingIndex_0", + "position": { + "x": 270.90499551102573, + "y": 783.5053782099461 + }, + "type": "customNode", + "data": { + "id": "supabaseExistingIndex_0", + "label": "Supabase Load Existing Index", + "name": "supabaseExistingIndex", + "version": 1, + "type": "Supabase", + "baseClasses": ["Supabase", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Supabase (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["supabaseApi"], + "id": "supabaseExistingIndex_0-input-credential-credential" + }, + { + "label": "Supabase Project URL", + "name": "supabaseProjUrl", + "type": "string", + "id": "supabaseExistingIndex_0-input-supabaseProjUrl-string" + }, + { + "label": "Table Name", + "name": "tableName", + "type": "string", + "id": "supabaseExistingIndex_0-input-tableName-string" + }, + { + "label": "Query Name", + "name": "queryName", + "type": "string", + "id": "supabaseExistingIndex_0-input-queryName-string" + }, + { + "label": "Supabase Metadata Filter", + "name": "supabaseMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "supabaseExistingIndex_0-input-supabaseMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "supabaseExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "supabaseExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "supabaseProjUrl": "", + "tableName": "", + "queryName": "", + "supabaseMetadataFilter": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "supabaseExistingIndex_0-output-retriever-Supabase|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Supabase Retriever", + "type": "Supabase | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "supabaseExistingIndex_0-output-vectorStore-Supabase|VectorStore", + "name": "vectorStore", + "label": "Supabase Vector Store", + "type": "Supabase | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "vectorStore" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 270.90499551102573, + "y": 783.5053782099461 + }, + "dragging": false + }, { "width": 300, "height": 523, "id": "chatOpenAI_0", "position": { - "x": 1206.027762600755, - "y": -212.35338654620222 + "x": 1154.0989175770958, + "y": -255.77769163789395 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -396,14 +799,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -411,401 +815,8 @@ }, "selected": false, "positionAbsolute": { - "x": 1206.027762600755, - "y": -212.35338654620222 - }, - "dragging": false - }, - { - "width": 300, - "height": 329, - "id": "openAIEmbeddings_0", - "position": { - "x": -254.88737984323413, - "y": 279.72801937636154 - }, - "type": "customNode", - "data": { - "id": "openAIEmbeddings_0", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_0-input-openAIApiKey-password" - }, - { - "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": "" - }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": -254.88737984323413, - "y": 279.72801937636154 - }, - "dragging": false - }, - { - "width": 300, - "height": 603, - "id": "pineconeExistingIndex_0", - "position": { - "x": 271.2513182410521, - "y": -410.32709109501735 - }, - "type": "customNode", - "data": { - "id": "pineconeExistingIndex_0", - "label": "Pinecone Load Existing Index", - "name": "pineconeExistingIndex", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Pinecone (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeExistingIndex_0-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeExistingIndex_0-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeExistingIndex_0-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" - }, - { - "label": "Pinecone Metadata Filter", - "name": "pineconeMetadataFilter", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeExistingIndex_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_0.data.instance}}", - "pineconeEnv": "", - "pineconeIndex": "", - "pineconeNamespace": "", - "pineconeMetadataFilter": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "vectorStore" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 271.2513182410521, - "y": -410.32709109501735 - }, - "dragging": false - }, - { - "width": 300, - "height": 505, - "id": "chromaExistingIndex_0", - "position": { - "x": 269.2940530300552, - "y": 262.41814510537796 - }, - "type": "customNode", - "data": { - "id": "chromaExistingIndex_0", - "label": "Chroma Load Existing Index", - "name": "chromaExistingIndex", - "type": "Chroma", - "baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Chroma (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Collection Name", - "name": "collectionName", - "type": "string", - "id": "chromaExistingIndex_0-input-collectionName-string" - }, - { - "label": "Chroma URL", - "name": "chromaURL", - "type": "string", - "optional": true, - "id": "chromaExistingIndex_0-input-chromaURL-string" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "chromaExistingIndex_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "chromaExistingIndex_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_0.data.instance}}", - "collectionName": "", - "chromaURL": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "chromaExistingIndex_0-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Chroma Retriever", - "type": "Chroma | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "chromaExistingIndex_0-output-vectorStore-Chroma|VectorStore", - "name": "vectorStore", - "label": "Chroma Vector Store", - "type": "Chroma | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "vectorStore" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 269.2940530300552, - "y": 262.41814510537796 - }, - "dragging": false - }, - { - "width": 300, - "height": 702, - "id": "supabaseExistingIndex_0", - "position": { - "x": 273.7097153973373, - "y": 821.872758974335 - }, - "type": "customNode", - "data": { - "id": "supabaseExistingIndex_0", - "label": "Supabase Load Existing Index", - "name": "supabaseExistingIndex", - "type": "Supabase", - "baseClasses": ["Supabase", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Supabase (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Supabase API Key", - "name": "supabaseApiKey", - "type": "password", - "id": "supabaseExistingIndex_0-input-supabaseApiKey-password" - }, - { - "label": "Supabase Project URL", - "name": "supabaseProjUrl", - "type": "string", - "id": "supabaseExistingIndex_0-input-supabaseProjUrl-string" - }, - { - "label": "Table Name", - "name": "tableName", - "type": "string", - "id": "supabaseExistingIndex_0-input-tableName-string" - }, - { - "label": "Query Name", - "name": "queryName", - "type": "string", - "id": "supabaseExistingIndex_0-input-queryName-string" - }, - { - "label": "Supabase Metadata Filter", - "name": "supabaseMetadataFilter", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "supabaseExistingIndex_0-input-supabaseMetadataFilter-json" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "supabaseExistingIndex_0-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "supabaseExistingIndex_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_0.data.instance}}", - "supabaseProjUrl": "", - "tableName": "", - "queryName": "", - "supabaseMetadataFilter": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "supabaseExistingIndex_0-output-retriever-Supabase|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Supabase Retriever", - "type": "Supabase | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "supabaseExistingIndex_0-output-vectorStore-Supabase|VectorStore", - "name": "vectorStore", - "label": "Supabase Vector Store", - "type": "Supabase | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "vectorStore" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 273.7097153973373, - "y": 821.872758974335 + "x": 1154.0989175770958, + "y": -255.77769163789395 }, "dragging": false } @@ -844,17 +855,6 @@ "label": "" } }, - { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "multiRetrievalQAChain_0", - "targetHandle": "multiRetrievalQAChain_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-multiRetrievalQAChain_0-multiRetrievalQAChain_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "pineconeExistingIndex_0", "sourceHandle": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", @@ -866,17 +866,6 @@ "label": "" } }, - { - "source": "openAIEmbeddings_0", - "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeExistingIndex_0", - "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", - "type": "buttonedge", - "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, { "source": "chromaExistingIndex_0", "sourceHandle": "chromaExistingIndex_0-output-vectorStore-Chroma|VectorStore", @@ -888,6 +877,17 @@ "label": "" } }, + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, { "source": "openAIEmbeddings_0", "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", @@ -920,6 +920,17 @@ "data": { "label": "" } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "multiRetrievalQAChain_0", + "targetHandle": "multiRetrievalQAChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-multiRetrievalQAChain_0-multiRetrievalQAChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Multiple VectorDB.json b/packages/server/marketplaces/chatflows/Multiple VectorDB.json index 05f7ca5e..101a683b 100644 --- a/packages/server/marketplaces/chatflows/Multiple VectorDB.json +++ b/packages/server/marketplaces/chatflows/Multiple VectorDB.json @@ -3,27 +3,674 @@ "nodes": [ { "width": 300, - "height": 329, - "id": "openAIEmbeddings_2", + "height": 602, + "id": "chainTool_2", "position": { - "x": 155.07832615625986, - "y": -778.383353751991 + "x": 1251.240972921597, + "y": -922.9180420195128 }, "type": "customNode", "data": { - "id": "openAIEmbeddings_2", + "id": "chainTool_2", + "label": "Chain Tool", + "name": "chainTool", + "version": 1, + "type": "ChainTool", + "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Use a chain as allowed tool for agent", + "inputParams": [ + { + "label": "Chain Name", + "name": "name", + "type": "string", + "placeholder": "state-of-union-qa", + "id": "chainTool_2-input-name-string" + }, + { + "label": "Chain Description", + "name": "description", + "type": "string", + "rows": 3, + "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", + "id": "chainTool_2-input-description-string" + }, + { + "label": "Return Direct", + "name": "returnDirect", + "type": "boolean", + "optional": true, + "id": "chainTool_2-input-returnDirect-boolean" + } + ], + "inputAnchors": [ + { + "label": "Base Chain", + "name": "baseChain", + "type": "BaseChain", + "id": "chainTool_2-input-baseChain-BaseChain" + } + ], + "inputs": { + "name": "ai-paper-qa", + "description": "AI Paper QA - useful for when you need to ask questions about the AI-Generated Content paper.", + "returnDirect": "", + "baseChain": "{{retrievalQAChain_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "chainTool_2-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", + "name": "chainTool", + "label": "ChainTool", + "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1251.240972921597, + "y": -922.9180420195128 + }, + "dragging": false + }, + { + "width": 300, + "height": 602, + "id": "chainTool_3", + "position": { + "x": 1267.7142132085273, + "y": -85.7749282485849 + }, + "type": "customNode", + "data": { + "id": "chainTool_3", + "label": "Chain Tool", + "name": "chainTool", + "version": 1, + "type": "ChainTool", + "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Use a chain as allowed tool for agent", + "inputParams": [ + { + "label": "Chain Name", + "name": "name", + "type": "string", + "placeholder": "state-of-union-qa", + "id": "chainTool_3-input-name-string" + }, + { + "label": "Chain Description", + "name": "description", + "type": "string", + "rows": 3, + "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", + "id": "chainTool_3-input-description-string" + }, + { + "label": "Return Direct", + "name": "returnDirect", + "type": "boolean", + "optional": true, + "id": "chainTool_3-input-returnDirect-boolean" + } + ], + "inputAnchors": [ + { + "label": "Base Chain", + "name": "baseChain", + "type": "BaseChain", + "id": "chainTool_3-input-baseChain-BaseChain" + } + ], + "inputs": { + "name": "state-of-union-qa", + "description": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", + "returnDirect": "", + "baseChain": "{{retrievalQAChain_1.data.instance}}" + }, + "outputAnchors": [ + { + "id": "chainTool_3-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", + "name": "chainTool", + "label": "ChainTool", + "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "dragging": false, + "positionAbsolute": { + "x": 1267.7142132085273, + "y": -85.7749282485849 + } + }, + { + "width": 300, + "height": 280, + "id": "mrklAgentLLM_0", + "position": { + "x": 2061.891333395338, + "y": -140.0694021759809 + }, + "type": "customNode", + "data": { + "id": "mrklAgentLLM_0", + "label": "MRKL Agent for LLMs", + "name": "mrklAgentLLM", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], + "category": "Agents", + "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with LLMs", + "inputParams": [], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "mrklAgentLLM_0-input-tools-Tool" + }, + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "mrklAgentLLM_0-input-model-BaseLanguageModel" + } + ], + "inputs": { + "tools": ["{{chainTool_2.data.instance}}", "{{chainTool_3.data.instance}}"], + "model": "{{openAI_4.data.instance}}" + }, + "outputAnchors": [ + { + "id": "mrklAgentLLM_0-output-mrklAgentLLM-AgentExecutor|BaseChain|BaseLangChain", + "name": "mrklAgentLLM", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 2061.891333395338, + "y": -140.0694021759809 + }, + "dragging": false + }, + { + "width": 300, + "height": 280, + "id": "retrievalQAChain_0", + "position": { + "x": 898.1253096948574, + "y": -859.1174013418433 + }, + "type": "customNode", + "data": { + "id": "retrievalQAChain_0", + "label": "Retrieval QA Chain", + "name": "retrievalQAChain", + "version": 1, + "type": "RetrievalQAChain", + "baseClasses": ["RetrievalQAChain", "BaseChain", "BaseLangChain"], + "category": "Chains", + "description": "QA chain to answer a question based on the retrieved documents", + "inputParams": [], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "retrievalQAChain_0-input-model-BaseLanguageModel" + }, + { + "label": "Vector Store Retriever", + "name": "vectorStoreRetriever", + "type": "BaseRetriever", + "id": "retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever" + } + ], + "inputs": { + "model": "{{openAI_2.data.instance}}", + "vectorStoreRetriever": "{{chromaExistingIndex_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "retrievalQAChain_0-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", + "name": "retrievalQAChain", + "label": "RetrievalQAChain", + "type": "RetrievalQAChain | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 898.1253096948574, + "y": -859.1174013418433 + }, + "dragging": false + }, + { + "width": 300, + "height": 280, + "id": "retrievalQAChain_1", + "position": { + "x": 895.4349543765911, + "y": 166.60331503487222 + }, + "type": "customNode", + "data": { + "id": "retrievalQAChain_1", + "label": "Retrieval QA Chain", + "name": "retrievalQAChain", + "version": 1, + "type": "RetrievalQAChain", + "baseClasses": ["RetrievalQAChain", "BaseChain", "BaseLangChain"], + "category": "Chains", + "description": "QA chain to answer a question based on the retrieved documents", + "inputParams": [], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "retrievalQAChain_1-input-model-BaseLanguageModel" + }, + { + "label": "Vector Store Retriever", + "name": "vectorStoreRetriever", + "type": "BaseRetriever", + "id": "retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever" + } + ], + "inputs": { + "model": "{{openAI_3.data.instance}}", + "vectorStoreRetriever": "{{pineconeExistingIndex_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "retrievalQAChain_1-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", + "name": "retrievalQAChain", + "label": "RetrievalQAChain", + "type": "RetrievalQAChain | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 895.4349543765911, + "y": 166.60331503487222 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "openAI_2", + "position": { + "x": 520.8471510168988, + "y": -1282.1183473852964 + }, + "type": "customNode", + "data": { + "id": "openAI_2", + "label": "OpenAI", + "name": "openAI", + "version": 1, + "type": "OpenAI", + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around OpenAI large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_2-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "text-davinci-003", + "name": "text-davinci-003" + }, + { + "label": "text-davinci-002", + "name": "text-davinci-002" + }, + { + "label": "text-curie-001", + "name": "text-curie-001" + }, + { + "label": "text-babbage-001", + "name": "text-babbage-001" + } + ], + "default": "text-davinci-003", + "optional": true, + "id": "openAI_2-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.7, + "optional": true, + "id": "openAI_2-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-topP-number" + }, + { + "label": "Best Of", + "name": "bestOf", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-bestOf-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-presencePenalty-number" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAI_2-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "text-davinci-003", + "temperature": 0.7, + "maxTokens": "", + "topP": "", + "bestOf": "", + "frequencyPenalty": "", + "presencePenalty": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "name": "openAI", + "label": "OpenAI", + "type": "OpenAI | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 520.8471510168988, + "y": -1282.1183473852964 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_1", + "position": { + "x": 148.65789308409916, + "y": -915.1982675859331 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_1", "label": "OpenAI Embeddings", "name": "openAIEmbeddings", + "version": 1, "type": "OpenAIEmbeddings", "baseClasses": ["OpenAIEmbeddings", "Embeddings"], "category": "Embeddings", "description": "OpenAI API to generate embeddings for a given text", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_2-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAIEmbeddings_1-input-credential-credential" + }, + { + "label": "Strip New Lines", + "name": "stripNewLines", + "type": "boolean", + "optional": true, + "additionalParams": true, + "id": "openAIEmbeddings_1-input-stripNewLines-boolean" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAIEmbeddings_1-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAIEmbeddings_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAIEmbeddings_1-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "stripNewLines": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "name": "openAIEmbeddings", + "label": "OpenAIEmbeddings", + "type": "OpenAIEmbeddings | Embeddings" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 148.65789308409916, + "y": -915.1982675859331 + }, + "dragging": false + }, + { + "width": 300, + "height": 506, + "id": "chromaExistingIndex_0", + "position": { + "x": 509.55198017578016, + "y": -732.42003311752 + }, + "type": "customNode", + "data": { + "id": "chromaExistingIndex_0", + "label": "Chroma Load Existing Index", + "name": "chromaExistingIndex", + "version": 1, + "type": "Chroma", + "baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Chroma (i.e: Document has been upserted)", + "inputParams": [ + { + "label": "Collection Name", + "name": "collectionName", + "type": "string", + "id": "chromaExistingIndex_0-input-collectionName-string" + }, + { + "label": "Chroma URL", + "name": "chromaURL", + "type": "string", + "optional": true, + "id": "chromaExistingIndex_0-input-chromaURL-string" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "chromaExistingIndex_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "chromaExistingIndex_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "embeddings": "{{openAIEmbeddings_1.data.instance}}", + "collectionName": "", + "chromaURL": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "chromaExistingIndex_0-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Chroma Retriever", + "type": "Chroma | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "chromaExistingIndex_0-output-vectorStore-Chroma|VectorStore", + "name": "vectorStore", + "label": "Chroma Vector Store", + "type": "Chroma | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 509.55198017578016, + "y": -732.42003311752 + }, + "dragging": false + }, + { + "width": 300, + "height": 329, + "id": "openAIEmbeddings_2", + "position": { + "x": 128.85404348918783, + "y": 155.96043384682295 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_2", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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_2-input-credential-credential" }, { "label": "Strip New Lines", @@ -62,7 +709,8 @@ "inputs": { "stripNewLines": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { @@ -77,122 +725,36 @@ }, "selected": false, "positionAbsolute": { - "x": 155.07832615625986, - "y": -778.383353751991 + "x": 128.85404348918783, + "y": 155.96043384682295 }, "dragging": false }, - { - "width": 300, - "height": 505, - "id": "chromaExistingIndex_1", - "position": { - "x": 522.8177328694987, - "y": -723.8834555183237 - }, - "type": "customNode", - "data": { - "id": "chromaExistingIndex_1", - "label": "Chroma Load Existing Index", - "name": "chromaExistingIndex", - "type": "Chroma", - "baseClasses": ["Chroma", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Chroma (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Collection Name", - "name": "collectionName", - "type": "string", - "id": "chromaExistingIndex_1-input-collectionName-string" - }, - { - "label": "Chroma URL", - "name": "chromaURL", - "type": "string", - "optional": true, - "id": "chromaExistingIndex_1-input-chromaURL-string" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "chromaExistingIndex_1-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "chromaExistingIndex_1-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_2.data.instance}}", - "collectionName": "ai-paper" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "chromaExistingIndex_1-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Chroma Retriever", - "type": "Chroma | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "chromaExistingIndex_1-output-vectorStore-Chroma|VectorStore", - "name": "vectorStore", - "label": "Chroma Vector Store", - "type": "Chroma | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "retriever" - }, - "selected": false - }, - "positionAbsolute": { - "x": 522.8177328694987, - "y": -723.8834555183237 - }, - "selected": false, - "dragging": false - }, { "width": 300, "height": 523, "id": "openAI_3", "position": { - "x": 527.7101375911075, - "y": -1290.6752949922043 + "x": 504.808358369027, + "y": -197.78194663790197 }, "type": "customNode", "data": { "id": "openAI_3", "label": "OpenAI", "name": "openAI", + "version": 1, "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], "category": "LLMs", "description": "Wrapper around OpenAI large language models", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_3-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_3-input-credential-credential" }, { "label": "Model Name", @@ -303,260 +865,133 @@ "frequencyPenalty": "", "presencePenalty": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "id": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", "name": "openAI", "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" + "type": "OpenAI | BaseLLM | BaseLanguageModel" } ], "outputs": {}, "selected": false }, - "positionAbsolute": { - "x": 527.7101375911075, - "y": -1290.6752949922043 - }, "selected": false, + "positionAbsolute": { + "x": 504.808358369027, + "y": -197.78194663790197 + }, "dragging": false }, { "width": 300, - "height": 601, - "id": "chainTool_2", + "height": 505, + "id": "pineconeExistingIndex_0", "position": { - "x": 1251.240972921597, - "y": -922.9180420195128 + "x": 507.5206146177215, + "y": 343.07818128024616 }, "type": "customNode", "data": { - "id": "chainTool_2", - "label": "Chain Tool", - "name": "chainTool", - "type": "ChainTool", - "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Use a chain as allowed tool for agent", + "id": "pineconeExistingIndex_0", + "label": "Pinecone Load Existing Index", + "name": "pineconeExistingIndex", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Load existing index from Pinecone (i.e: Document has been upserted)", "inputParams": [ { - "label": "Chain Name", - "name": "name", - "type": "string", - "placeholder": "state-of-union-qa", - "id": "chainTool_2-input-name-string" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeExistingIndex_0-input-credential-credential" }, { - "label": "Chain Description", - "name": "description", + "label": "Pinecone Index", + "name": "pineconeIndex", "type": "string", - "rows": 3, - "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", - "id": "chainTool_2-input-description-string" + "id": "pineconeExistingIndex_0-input-pineconeIndex-string" }, { - "label": "Return Direct", - "name": "returnDirect", - "type": "boolean", + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, "optional": true, - "id": "chainTool_2-input-returnDirect-boolean" + "id": "pineconeExistingIndex_0-input-pineconeNamespace-string" + }, + { + "label": "Pinecone Metadata Filter", + "name": "pineconeMetadataFilter", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "pineconeExistingIndex_0-input-pineconeMetadataFilter-json" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeExistingIndex_0-input-topK-number" } ], "inputAnchors": [ { - "label": "Base Chain", - "name": "baseChain", - "type": "BaseChain", - "id": "chainTool_2-input-baseChain-BaseChain" + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeExistingIndex_0-input-embeddings-Embeddings" } ], "inputs": { - "name": "ai-paper-qa", - "description": "AI Paper QA - useful for when you need to ask questions about the AI-Generated Content paper.", - "returnDirect": "", - "baseChain": "{{retrievalQAChain_0.data.instance}}" + "embeddings": "{{openAIEmbeddings_2.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "pineconeMetadataFilter": "", + "topK": "" }, "outputAnchors": [ { - "id": "chainTool_2-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", - "name": "chainTool", - "label": "ChainTool", - "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" } ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1251.240972921597, - "y": -922.9180420195128 - }, - "dragging": false - }, - { - "width": 300, - "height": 142, - "id": "calculator_1", - "position": { - "x": 1649.5389102641816, - "y": -835.8729983638877 - }, - "type": "customNode", - "data": { - "id": "calculator_1", - "label": "Calculator", - "name": "calculator", - "type": "Calculator", - "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Perform calculations on response", - "inputParams": [], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain", - "name": "calculator", - "label": "Calculator", - "type": "Calculator | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1649.5389102641816, - "y": -835.8729983638877 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 277, - "id": "serpAPI_0", - "position": { - "x": 1654.5273488033688, - "y": -622.1607096176143 - }, - "type": "customNode", - "data": { - "id": "serpAPI_0", - "label": "Serp API", - "name": "serpAPI", - "type": "SerpAPI", - "baseClasses": ["SerpAPI", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Wrapper around SerpAPI - a real-time API to access Google search results", - "inputParams": [ - { - "label": "Serp Api Key", - "name": "apiKey", - "type": "password", - "id": "serpAPI_0-input-apiKey-password" - } - ], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", - "name": "serpAPI", - "label": "SerpAPI", - "type": "SerpAPI | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1654.5273488033688, - "y": -622.1607096176143 - }, - "dragging": false - }, - { - "width": 300, - "height": 329, - "id": "openAIEmbeddings_3", - "position": { - "x": 163.902196956619, - "y": 318.66096921035574 - }, - "type": "customNode", - "data": { - "id": "openAIEmbeddings_3", - "label": "OpenAI Embeddings", - "name": "openAIEmbeddings", - "type": "OpenAIEmbeddings", - "baseClasses": ["OpenAIEmbeddings", "Embeddings"], - "category": "Embeddings", - "description": "OpenAI API to generate embeddings for a given text", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_3-input-openAIApiKey-password" - }, - { - "label": "Strip New Lines", - "name": "stripNewLines", - "type": "boolean", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_3-input-stripNewLines-boolean" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_3-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_3-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAIEmbeddings_3-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "stripNewLines": "", - "batchSize": "", - "timeout": "" + "outputs": { + "output": "retriever" }, - "outputAnchors": [ - { - "id": "openAIEmbeddings_3-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "name": "openAIEmbeddings", - "label": "OpenAIEmbeddings", - "type": "OpenAIEmbeddings | Embeddings" - } - ], - "outputs": {}, "selected": false }, "selected": false, "positionAbsolute": { - "x": 163.902196956619, - "y": 318.66096921035574 + "x": 507.5206146177215, + "y": 343.07818128024616 }, "dragging": false }, @@ -565,24 +1000,26 @@ "height": 523, "id": "openAI_4", "position": { - "x": 529.8870809493459, - "y": -137.8839994127831 + "x": 1619.5346765785587, + "y": 292.29615581180684 }, "type": "customNode", "data": { "id": "openAI_4", "label": "OpenAI", "name": "openAI", + "version": 1, "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], "category": "LLMs", "description": "Wrapper around OpenAI large language models", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_4-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_4-input-credential-credential" }, { "label": "Model Name", @@ -693,412 +1130,15 @@ "frequencyPenalty": "", "presencePenalty": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "id": "openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", "name": "openAI", "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 529.8870809493459, - "y": -137.8839994127831 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 603, - "id": "pineconeExistingIndex_1", - "position": { - "x": 525.6644489497978, - "y": 420.1233379157454 - }, - "type": "customNode", - "data": { - "id": "pineconeExistingIndex_1", - "label": "Pinecone Load Existing Index", - "name": "pineconeExistingIndex", - "type": "Pinecone", - "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], - "category": "Vector Stores", - "description": "Load existing index from Pinecone (i.e: Document has been upserted)", - "inputParams": [ - { - "label": "Pinecone Api Key", - "name": "pineconeApiKey", - "type": "password", - "id": "pineconeExistingIndex_1-input-pineconeApiKey-password" - }, - { - "label": "Pinecone Environment", - "name": "pineconeEnv", - "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeEnv-string" - }, - { - "label": "Pinecone Index", - "name": "pineconeIndex", - "type": "string", - "id": "pineconeExistingIndex_1-input-pineconeIndex-string" - }, - { - "label": "Pinecone Namespace", - "name": "pineconeNamespace", - "type": "string", - "placeholder": "my-first-namespace", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeNamespace-string" - }, - { - "label": "Pinecone Metadata Filter", - "name": "pineconeMetadataFilter", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "pineconeExistingIndex_1-input-pineconeMetadataFilter-json" - }, - { - "label": "Top K", - "name": "topK", - "description": "Number of top results to fetch. Default to 4", - "placeholder": "4", - "type": "number", - "additionalParams": true, - "optional": true, - "id": "pineconeExistingIndex_1-input-topK-number" - } - ], - "inputAnchors": [ - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "pineconeExistingIndex_1-input-embeddings-Embeddings" - } - ], - "inputs": { - "embeddings": "{{openAIEmbeddings_3.data.instance}}", - "pineconeEnv": "us-west4-gcp", - "pineconeIndex": "state-of-union", - "pineconeNamespace": "" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "name": "retriever", - "label": "Pinecone Retriever", - "type": "Pinecone | VectorStoreRetriever | BaseRetriever" - }, - { - "id": "pineconeExistingIndex_1-output-vectorStore-Pinecone|VectorStore", - "name": "vectorStore", - "label": "Pinecone Vector Store", - "type": "Pinecone | VectorStore" - } - ], - "default": "retriever" - } - ], - "outputs": { - "output": "retriever" - }, - "selected": false - }, - "selected": false, - "dragging": false, - "positionAbsolute": { - "x": 525.6644489497978, - "y": 420.1233379157454 - } - }, - { - "width": 300, - "height": 601, - "id": "chainTool_3", - "position": { - "x": 1267.7142132085273, - "y": -85.7749282485849 - }, - "type": "customNode", - "data": { - "id": "chainTool_3", - "label": "Chain Tool", - "name": "chainTool", - "type": "ChainTool", - "baseClasses": ["ChainTool", "DynamicTool", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Use a chain as allowed tool for agent", - "inputParams": [ - { - "label": "Chain Name", - "name": "name", - "type": "string", - "placeholder": "state-of-union-qa", - "id": "chainTool_3-input-name-string" - }, - { - "label": "Chain Description", - "name": "description", - "type": "string", - "rows": 3, - "placeholder": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", - "id": "chainTool_3-input-description-string" - }, - { - "label": "Return Direct", - "name": "returnDirect", - "type": "boolean", - "optional": true, - "id": "chainTool_3-input-returnDirect-boolean" - } - ], - "inputAnchors": [ - { - "label": "Base Chain", - "name": "baseChain", - "type": "BaseChain", - "id": "chainTool_3-input-baseChain-BaseChain" - } - ], - "inputs": { - "name": "state-of-union-qa", - "description": "State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.", - "returnDirect": "", - "baseChain": "{{retrievalQAChain_1.data.instance}}" - }, - "outputAnchors": [ - { - "id": "chainTool_3-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", - "name": "chainTool", - "label": "ChainTool", - "type": "ChainTool | DynamicTool | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "dragging": false, - "positionAbsolute": { - "x": 1267.7142132085273, - "y": -85.7749282485849 - } - }, - { - "width": 300, - "height": 523, - "id": "openAI_5", - "position": { - "x": 1683.95439713088, - "y": 329.0556949149878 - }, - "type": "customNode", - "data": { - "id": "openAI_5", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_5-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_5-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_5-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_5-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": "0", - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_5-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1683.95439713088, - "y": 329.0556949149878 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 279, - "id": "mrklAgentLLM_0", - "position": { - "x": 2061.891333395338, - "y": -140.0694021759809 - }, - "type": "customNode", - "data": { - "id": "mrklAgentLLM_0", - "label": "MRKL Agent for LLMs", - "name": "mrklAgentLLM", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], - "category": "Agents", - "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with LLMs", - "inputParams": [], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "mrklAgentLLM_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "mrklAgentLLM_0-input-model-BaseLanguageModel" - } - ], - "inputs": { - "tools": [ - "{{serpAPI_0.data.instance}}", - "{{calculator_1.data.instance}}", - "{{chainTool_2.data.instance}}", - "{{chainTool_3.data.instance}}" - ], - "model": "{{openAI_5.data.instance}}" - }, - "outputAnchors": [ - { - "id": "mrklAgentLLM_0-output-mrklAgentLLM-AgentExecutor|BaseChain|BaseLangChain", - "name": "mrklAgentLLM", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" + "type": "OpenAI | BaseLLM | BaseLanguageModel" } ], "outputs": {}, @@ -1106,165 +1146,13 @@ }, "selected": false, "positionAbsolute": { - "x": 2061.891333395338, - "y": -140.0694021759809 - }, - "dragging": false - }, - { - "width": 300, - "height": 279, - "id": "retrievalQAChain_0", - "position": { - "x": 898.1253096948574, - "y": -859.1174013418433 - }, - "type": "customNode", - "data": { - "id": "retrievalQAChain_0", - "label": "Retrieval QA Chain", - "name": "retrievalQAChain", - "type": "RetrievalQAChain", - "baseClasses": ["RetrievalQAChain", "BaseChain", "BaseLangChain"], - "category": "Chains", - "description": "QA chain to answer a question based on the retrieved documents", - "inputParams": [], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "retrievalQAChain_0-input-model-BaseLanguageModel" - }, - { - "label": "Vector Store Retriever", - "name": "vectorStoreRetriever", - "type": "BaseRetriever", - "id": "retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever" - } - ], - "inputs": { - "model": "{{openAI_3.data.instance}}", - "vectorStoreRetriever": "{{chromaExistingIndex_1.data.instance}}" - }, - "outputAnchors": [ - { - "id": "retrievalQAChain_0-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", - "name": "retrievalQAChain", - "label": "RetrievalQAChain", - "type": "RetrievalQAChain | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 898.1253096948574, - "y": -859.1174013418433 - }, - "dragging": false - }, - { - "width": 300, - "height": 279, - "id": "retrievalQAChain_1", - "position": { - "x": 895.4349543765911, - "y": 166.60331503487222 - }, - "type": "customNode", - "data": { - "id": "retrievalQAChain_1", - "label": "Retrieval QA Chain", - "name": "retrievalQAChain", - "type": "RetrievalQAChain", - "baseClasses": ["RetrievalQAChain", "BaseChain", "BaseLangChain"], - "category": "Chains", - "description": "QA chain to answer a question based on the retrieved documents", - "inputParams": [], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "retrievalQAChain_1-input-model-BaseLanguageModel" - }, - { - "label": "Vector Store Retriever", - "name": "vectorStoreRetriever", - "type": "BaseRetriever", - "id": "retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever" - } - ], - "inputs": { - "model": "{{openAI_4.data.instance}}", - "vectorStoreRetriever": "{{pineconeExistingIndex_1.data.instance}}" - }, - "outputAnchors": [ - { - "id": "retrievalQAChain_1-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", - "name": "retrievalQAChain", - "label": "RetrievalQAChain", - "type": "RetrievalQAChain | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 895.4349543765911, - "y": 166.60331503487222 + "x": 1619.5346765785587, + "y": 292.29615581180684 }, "dragging": false } ], "edges": [ - { - "source": "openAIEmbeddings_2", - "sourceHandle": "openAIEmbeddings_2-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "chromaExistingIndex_1", - "targetHandle": "chromaExistingIndex_1-input-embeddings-Embeddings", - "type": "buttonedge", - "id": "openAIEmbeddings_2-openAIEmbeddings_2-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-chromaExistingIndex_1-chromaExistingIndex_1-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, - { - "source": "openAIEmbeddings_3", - "sourceHandle": "openAIEmbeddings_3-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", - "target": "pineconeExistingIndex_1", - "targetHandle": "pineconeExistingIndex_1-input-embeddings-Embeddings", - "type": "buttonedge", - "id": "openAIEmbeddings_3-openAIEmbeddings_3-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_1-pineconeExistingIndex_1-input-embeddings-Embeddings", - "data": { - "label": "" - } - }, - { - "source": "serpAPI_0", - "sourceHandle": "serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentLLM_0", - "targetHandle": "mrklAgentLLM_0-input-tools-Tool", - "type": "buttonedge", - "id": "serpAPI_0-serpAPI_0-output-serpAPI-SerpAPI|Tool|StructuredTool|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-tools-Tool", - "data": { - "label": "" - } - }, - { - "source": "calculator_1", - "sourceHandle": "calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentLLM_0", - "targetHandle": "mrklAgentLLM_0-input-tools-Tool", - "type": "buttonedge", - "id": "calculator_1-calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-tools-Tool", - "data": { - "label": "" - } - }, { "source": "chainTool_2", "sourceHandle": "chainTool_2-output-chainTool-ChainTool|DynamicTool|Tool|StructuredTool|BaseLangChain", @@ -1287,39 +1175,6 @@ "label": "" } }, - { - "source": "openAI_5", - "sourceHandle": "openAI_5-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "mrklAgentLLM_0", - "targetHandle": "mrklAgentLLM_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_5-openAI_5-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "openAI_3", - "sourceHandle": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "retrievalQAChain_0", - "targetHandle": "retrievalQAChain_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_3-openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-retrievalQAChain_0-retrievalQAChain_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "chromaExistingIndex_1", - "sourceHandle": "chromaExistingIndex_1-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", - "target": "retrievalQAChain_0", - "targetHandle": "retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", - "type": "buttonedge", - "id": "chromaExistingIndex_1-chromaExistingIndex_1-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever-retrievalQAChain_0-retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", - "data": { - "label": "" - } - }, { "source": "retrievalQAChain_0", "sourceHandle": "retrievalQAChain_0-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", @@ -1331,28 +1186,6 @@ "label": "" } }, - { - "source": "openAI_4", - "sourceHandle": "openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "retrievalQAChain_1", - "targetHandle": "retrievalQAChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_4-openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-retrievalQAChain_1-retrievalQAChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, - { - "source": "pineconeExistingIndex_1", - "sourceHandle": "pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", - "target": "retrievalQAChain_1", - "targetHandle": "retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever", - "type": "buttonedge", - "id": "pineconeExistingIndex_1-pineconeExistingIndex_1-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-retrievalQAChain_1-retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever", - "data": { - "label": "" - } - }, { "source": "retrievalQAChain_1", "sourceHandle": "retrievalQAChain_1-output-retrievalQAChain-RetrievalQAChain|BaseChain|BaseLangChain", @@ -1363,6 +1196,83 @@ "data": { "label": "" } + }, + { + "source": "openAI_2", + "sourceHandle": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "retrievalQAChain_0", + "targetHandle": "retrievalQAChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_2-openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-retrievalQAChain_0-retrievalQAChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "openAIEmbeddings_1", + "sourceHandle": "openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "chromaExistingIndex_0", + "targetHandle": "chromaExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_1-openAIEmbeddings_1-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-chromaExistingIndex_0-chromaExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "chromaExistingIndex_0", + "sourceHandle": "chromaExistingIndex_0-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever", + "target": "retrievalQAChain_0", + "targetHandle": "retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "chromaExistingIndex_0-chromaExistingIndex_0-output-retriever-Chroma|VectorStoreRetriever|BaseRetriever-retrievalQAChain_0-retrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + }, + { + "source": "openAIEmbeddings_2", + "sourceHandle": "openAIEmbeddings_2-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeExistingIndex_0", + "targetHandle": "pineconeExistingIndex_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_2-openAIEmbeddings_2-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeExistingIndex_0-pineconeExistingIndex_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "openAI_3", + "sourceHandle": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "retrievalQAChain_1", + "targetHandle": "retrievalQAChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_3-openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-retrievalQAChain_1-retrievalQAChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "pineconeExistingIndex_0", + "sourceHandle": "pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "target": "retrievalQAChain_1", + "targetHandle": "retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-retrievalQAChain_1-retrievalQAChain_1-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + }, + { + "source": "openAI_4", + "sourceHandle": "openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "mrklAgentLLM_0", + "targetHandle": "mrklAgentLLM_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_4-openAI_4-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/OpenAI Agent.json b/packages/server/marketplaces/chatflows/OpenAI Agent.json index 75dc1527..91d5d38c 100644 --- a/packages/server/marketplaces/chatflows/OpenAI Agent.json +++ b/packages/server/marketplaces/chatflows/OpenAI Agent.json @@ -3,27 +3,296 @@ "nodes": [ { "width": 300, - "height": 524, + "height": 143, + "id": "calculator_0", + "position": { + "x": 288.06681362611545, + "y": 289.1385194199715 + }, + "type": "customNode", + "data": { + "id": "calculator_0", + "label": "Calculator", + "name": "calculator", + "version": 1, + "type": "Calculator", + "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain", "Serializable"], + "category": "Tools", + "description": "Perform calculations on response", + "inputParams": [], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "calculator_0-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain|Serializable", + "name": "calculator", + "label": "Calculator", + "type": "Calculator | Tool | StructuredTool | BaseLangChain | Serializable" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 288.06681362611545, + "y": 289.1385194199715 + }, + "dragging": false + }, + { + "width": 300, + "height": 376, + "id": "bufferMemory_0", + "position": { + "x": 285.7750469157585, + "y": 465.1140427303788 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_0", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_0-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 285.7750469157585, + "y": 465.1140427303788 + }, + "dragging": false + }, + { + "width": 300, + "height": 277, + "id": "customTool_0", + "position": { + "x": 883.9529939431576, + "y": -32.32503903826486 + }, + "type": "customNode", + "data": { + "id": "customTool_0", + "label": "Custom Tool", + "name": "customTool", + "version": 1, + "type": "CustomTool", + "baseClasses": ["CustomTool", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Use custom tool you've created in Flowise within chatflow", + "inputParams": [ + { + "label": "Select Tool", + "name": "selectedTool", + "type": "asyncOptions", + "loadMethod": "listTools", + "id": "customTool_0-input-selectedTool-asyncOptions" + } + ], + "inputAnchors": [], + "inputs": { + "selectedTool": "" + }, + "outputAnchors": [ + { + "id": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool", + "name": "customTool", + "label": "CustomTool", + "type": "CustomTool | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 883.9529939431576, + "y": -32.32503903826486 + }, + "dragging": false + }, + { + "width": 300, + "height": 277, + "id": "serper_0", + "position": { + "x": 504.3508341937219, + "y": -10.324432507151982 + }, + "type": "customNode", + "data": { + "id": "serper_0", + "label": "Serper", + "name": "serper", + "version": 1, + "type": "Serper", + "baseClasses": ["Serper", "Tool", "StructuredTool"], + "category": "Tools", + "description": "Wrapper around Serper.dev - Google Search API", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["serperApi"], + "id": "serper_0-input-credential-credential" + } + ], + "inputAnchors": [], + "inputs": {}, + "outputAnchors": [ + { + "id": "serper_0-output-serper-Serper|Tool|StructuredTool", + "name": "serper", + "label": "Serper", + "type": "Serper | Tool | StructuredTool" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 504.3508341937219, + "y": -10.324432507151982 + }, + "dragging": false + }, + { + "width": 300, + "height": 383, + "id": "openAIFunctionAgent_0", + "position": { + "x": 1241.9739093293213, + "y": 359.3158950327101 + }, + "type": "customNode", + "data": { + "id": "openAIFunctionAgent_0", + "label": "OpenAI Function Agent", + "name": "openAIFunctionAgent", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call", + "inputParams": [ + { + "label": "System Message", + "name": "systemMessage", + "type": "string", + "rows": 4, + "optional": true, + "additionalParams": true, + "id": "openAIFunctionAgent_0-input-systemMessage-string" + } + ], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "openAIFunctionAgent_0-input-tools-Tool" + }, + { + "label": "Memory", + "name": "memory", + "type": "BaseChatMemory", + "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory" + }, + { + "label": "OpenAI Chat Model", + "name": "model", + "description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info", + "type": "BaseChatModel", + "id": "openAIFunctionAgent_0-input-model-BaseChatModel" + } + ], + "inputs": { + "tools": ["{{calculator_0.data.instance}}", "{{serper_0.data.instance}}", "{{customTool_0.data.instance}}"], + "memory": "{{bufferMemory_0.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", + "systemMessage": "" + }, + "outputAnchors": [ + { + "id": "openAIFunctionAgent_0-output-openAIFunctionAgent-AgentExecutor|BaseChain", + "name": "openAIFunctionAgent", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1241.9739093293213, + "y": 359.3158950327101 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, "id": "chatOpenAI_0", "position": { - "x": 648.7470970481406, - "y": 462.3331811694268 + "x": 817.8210275868742, + "y": 627.7677030233751 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain", "Serializable"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -34,29 +303,33 @@ "label": "gpt-4", "name": "gpt-4" }, - { - "label": "gpt-4-0314", - "name": "gpt-4-0314" - }, - { - "label": "gpt-4-32k-0314", - "name": "gpt-4-32k-0314" - }, { "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-0301", - "name": "gpt-3.5-turbo-0301" - }, { "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", @@ -122,7 +395,7 @@ ], "inputAnchors": [], "inputs": { - "modelName": "gpt-3.5-turbo-0613", + "modelName": "gpt-3.5-turbo", "temperature": 0.9, "maxTokens": "", "topP": "", @@ -133,10 +406,10 @@ }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain | Serializable" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -144,285 +417,13 @@ }, "selected": false, "positionAbsolute": { - "x": 648.7470970481406, - "y": 462.3331811694268 - }, - "dragging": false - }, - { - "width": 300, - "height": 278, - "id": "serper_0", - "position": { - "x": 486.27248799490576, - "y": 4.465900738576664 - }, - "type": "customNode", - "data": { - "id": "serper_0", - "label": "Serper", - "name": "serper", - "type": "Serper", - "baseClasses": ["Serper", "Tool", "StructuredTool", "BaseLangChain", "Serializable"], - "category": "Tools", - "description": "Wrapper around Serper.dev - Google Search API", - "inputParams": [ - { - "label": "Serper Api Key", - "name": "apiKey", - "type": "password", - "id": "serper_0-input-apiKey-password" - } - ], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable", - "name": "serper", - "label": "Serper", - "type": "Serper | Tool | StructuredTool | BaseLangChain | Serializable" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 486.27248799490576, - "y": 4.465900738576664 - }, - "dragging": false - }, - { - "width": 300, - "height": 143, - "id": "calculator_0", - "position": { - "x": 286.4092336819905, - "y": 304.05673891709597 - }, - "type": "customNode", - "data": { - "id": "calculator_0", - "label": "Calculator", - "name": "calculator", - "type": "Calculator", - "baseClasses": ["Calculator", "Tool", "StructuredTool", "BaseLangChain", "Serializable"], - "category": "Tools", - "description": "Perform calculations on response", - "inputParams": [], - "inputAnchors": [], - "inputs": {}, - "outputAnchors": [ - { - "id": "calculator_0-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain|Serializable", - "name": "calculator", - "label": "Calculator", - "type": "Calculator | Tool | StructuredTool | BaseLangChain | Serializable" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 286.4092336819905, - "y": 304.05673891709597 - }, - "dragging": false - }, - { - "width": 300, - "height": 383, - "id": "openAIFunctionAgent_0", - "position": { - "x": 1341.2259105169032, - "y": 318.35651549722945 - }, - "type": "customNode", - "data": { - "id": "openAIFunctionAgent_0", - "label": "OpenAI Function Agent", - "name": "openAIFunctionAgent", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain"], - "category": "Agents", - "description": "An agent that uses OpenAI's Function Calling functionality to pick the tool and args to call", - "inputParams": [ - { - "label": "System Message", - "name": "systemMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "openAIFunctionAgent_0-input-systemMessage-string" - } - ], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "openAIFunctionAgent_0-input-tools-Tool" - }, - { - "label": "Memory", - "name": "memory", - "type": "BaseChatMemory", - "id": "openAIFunctionAgent_0-input-memory-BaseChatMemory" - }, - { - "label": "OpenAI Chat Model", - "name": "model", - "description": "Only works with gpt-3.5-turbo-0613 and gpt-4-0613. Refer docs for more info", - "type": "BaseChatModel", - "id": "openAIFunctionAgent_0-input-model-BaseChatModel" - } - ], - "inputs": { - "tools": ["{{serper_0.data.instance}}", "{{calculator_0.data.instance}}", "{{customTool_0.data.instance}}"], - "memory": "{{bufferMemory_0.data.instance}}", - "model": "{{chatOpenAI_0.data.instance}}", - "systemMessage": "" - }, - "outputAnchors": [ - { - "id": "openAIFunctionAgent_0-output-openAIFunctionAgent-AgentExecutor|BaseChain", - "name": "openAIFunctionAgent", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1341.2259105169032, - "y": 318.35651549722945 - }, - "dragging": false - }, - { - "width": 300, - "height": 376, - "id": "bufferMemory_0", - "position": { - "x": 285.7750469157585, - "y": 465.1140427303788 - }, - "type": "customNode", - "data": { - "id": "bufferMemory_0", - "label": "Buffer Memory", - "name": "bufferMemory", - "type": "BufferMemory", - "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], - "category": "Memory", - "description": "Remembers previous conversational back and forths directly", - "inputParams": [ - { - "label": "Memory Key", - "name": "memoryKey", - "type": "string", - "default": "chat_history", - "id": "bufferMemory_0-input-memoryKey-string" - }, - { - "label": "Input Key", - "name": "inputKey", - "type": "string", - "default": "input", - "id": "bufferMemory_0-input-inputKey-string" - } - ], - "inputAnchors": [], - "inputs": { - "memoryKey": "chat_history", - "inputKey": "input" - }, - "outputAnchors": [ - { - "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "name": "bufferMemory", - "label": "BufferMemory", - "type": "BufferMemory | BaseChatMemory | BaseMemory" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 285.7750469157585, - "y": 465.1140427303788 - }, - "dragging": false - }, - { - "width": 300, - "height": 277, - "id": "customTool_0", - "position": { - "x": 883.9529939431576, - "y": -32.32503903826486 - }, - "type": "customNode", - "data": { - "id": "customTool_0", - "label": "Custom Tool", - "name": "customTool", - "type": "CustomTool", - "baseClasses": ["CustomTool", "Tool", "StructuredTool"], - "category": "Tools", - "description": "Use custom tool you've created in Flowise within chatflow", - "inputParams": [ - { - "label": "Select Tool", - "name": "selectedTool", - "type": "asyncOptions", - "loadMethod": "listTools", - "id": "customTool_0-input-selectedTool-asyncOptions" - } - ], - "inputAnchors": [], - "inputs": { - "selectedTool": "" - }, - "outputAnchors": [ - { - "id": "customTool_0-output-customTool-CustomTool|Tool|StructuredTool", - "name": "customTool", - "label": "CustomTool", - "type": "CustomTool | Tool | StructuredTool" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 883.9529939431576, - "y": -32.32503903826486 + "x": 817.8210275868742, + "y": 627.7677030233751 }, "dragging": false } ], "edges": [ - { - "source": "serper_0", - "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable", - "target": "openAIFunctionAgent_0", - "targetHandle": "openAIFunctionAgent_0-input-tools-Tool", - "type": "buttonedge", - "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool", - "data": { - "label": "" - } - }, { "source": "calculator_0", "sourceHandle": "calculator_0-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain|Serializable", @@ -435,23 +436,12 @@ } }, { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable", + "source": "serper_0", + "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool", "target": "openAIFunctionAgent_0", - "targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel", + "targetHandle": "openAIFunctionAgent_0-input-tools-Tool", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain|Serializable-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel", - "data": { - "label": "" - } - }, - { - "source": "bufferMemory_0", - "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "target": "openAIFunctionAgent_0", - "targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory", - "type": "buttonedge", - "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory", + "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool-openAIFunctionAgent_0-openAIFunctionAgent_0-input-tools-Tool", "data": { "label": "" } @@ -466,6 +456,28 @@ "data": { "label": "" } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "openAIFunctionAgent_0", + "targetHandle": "openAIFunctionAgent_0-input-model-BaseChatModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-openAIFunctionAgent_0-openAIFunctionAgent_0-input-model-BaseChatModel", + "data": { + "label": "" + } + }, + { + "source": "bufferMemory_0", + "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "target": "openAIFunctionAgent_0", + "targetHandle": "openAIFunctionAgent_0-input-memory-BaseChatMemory", + "type": "buttonedge", + "id": "bufferMemory_0-bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory-openAIFunctionAgent_0-openAIFunctionAgent_0-input-memory-BaseChatMemory", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Prompt Chaining.json b/packages/server/marketplaces/chatflows/Prompt Chaining.json index 96987660..e0491cc1 100644 --- a/packages/server/marketplaces/chatflows/Prompt Chaining.json +++ b/packages/server/marketplaces/chatflows/Prompt Chaining.json @@ -3,27 +3,467 @@ "nodes": [ { "width": 300, - "height": 524, + "height": 475, + "id": "promptTemplate_0", + "position": { + "x": 792.9464838535649, + "y": 527.1718536712464 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_0", + "label": "Prompt Template", + "name": "promptTemplate", + "version": 1, + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_0-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_0-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "You are an AI who performs one task based on the following objective: {objective}.\nRespond with how you would complete this task:", + "promptValues": "{\"objective\":\"{{question}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 792.9464838535649, + "y": 527.1718536712464 + }, + "dragging": false + }, + { + "width": 300, + "height": 475, + "id": "promptTemplate_1", + "position": { + "x": 1571.0896874449775, + "y": 522.8455116403258 + }, + "type": "customNode", + "data": { + "id": "promptTemplate_1", + "label": "Prompt Template", + "name": "promptTemplate", + "version": 1, + "type": "PromptTemplate", + "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], + "category": "Prompts", + "description": "Schema to represent a basic prompt for an LLM", + "inputParams": [ + { + "label": "Template", + "name": "template", + "type": "string", + "rows": 4, + "placeholder": "What is a good name for a company that makes {product}?", + "id": "promptTemplate_1-input-template-string" + }, + { + "label": "Format Prompt Values", + "name": "promptValues", + "type": "json", + "optional": true, + "acceptVariable": true, + "list": true, + "id": "promptTemplate_1-input-promptValues-json" + } + ], + "inputAnchors": [], + "inputs": { + "template": "You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: {objective}.\nThe last completed task has the result: {result}.\nBased on the result, create new tasks to be completed by the AI system that do not overlap with result.\nReturn the tasks as an array.", + "promptValues": "{\"objective\":\"{{question}}\",\"result\":\"{{llmChain_0.data.instance}}\"}" + }, + "outputAnchors": [ + { + "id": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", + "name": "promptTemplate", + "label": "PromptTemplate", + "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1571.0896874449775, + "y": 522.8455116403258 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 405, + "id": "llmChain_0", + "position": { + "x": 1192.835706086358, + "y": 367.49653955405995 + }, + "type": "customNode", + "data": { + "id": "llmChain_0", + "label": "LLM Chain", + "name": "llmChain", + "version": 1, + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_0-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_0-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_0-input-prompt-BasePromptTemplate" + } + ], + "inputs": { + "model": "{{openAI_1.data.instance}}", + "prompt": "{{promptTemplate_0.data.instance}}", + "chainName": "FirstChain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_0-output-llmChain-LLMChain|BaseChain", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain" + }, + { + "id": "llmChain_0-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "outputPrediction" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1192.835706086358, + "y": 367.49653955405995 + }, + "dragging": false + }, + { + "width": 300, + "height": 405, + "id": "llmChain_1", + "position": { + "x": 1956.8236771865425, + "y": 359.10696865911547 + }, + "type": "customNode", + "data": { + "id": "llmChain_1", + "label": "LLM Chain", + "name": "llmChain", + "version": 1, + "type": "LLMChain", + "baseClasses": ["LLMChain", "BaseChain"], + "category": "Chains", + "description": "Chain to run queries against LLMs", + "inputParams": [ + { + "label": "Chain Name", + "name": "chainName", + "type": "string", + "placeholder": "Name Your Chain", + "optional": true, + "id": "llmChain_1-input-chainName-string" + } + ], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "llmChain_1-input-model-BaseLanguageModel" + }, + { + "label": "Prompt", + "name": "prompt", + "type": "BasePromptTemplate", + "id": "llmChain_1-input-prompt-BasePromptTemplate" + } + ], + "inputs": { + "model": "{{openAI_2.data.instance}}", + "prompt": "{{promptTemplate_1.data.instance}}", + "chainName": "LastChain" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "llmChain_1-output-llmChain-LLMChain|BaseChain", + "name": "llmChain", + "label": "LLM Chain", + "type": "LLMChain | BaseChain" + }, + { + "id": "llmChain_1-output-outputPrediction-string|json", + "name": "outputPrediction", + "label": "Output Prediction", + "type": "string | json" + } + ], + "default": "llmChain" + } + ], + "outputs": { + "output": "llmChain" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1956.8236771865425, + "y": 359.10696865911547 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "openAI_1", + "position": { + "x": 791.6102007244282, + "y": -13.71386876566092 + }, + "type": "customNode", + "data": { + "id": "openAI_1", + "label": "OpenAI", + "name": "openAI", + "version": 1, + "type": "OpenAI", + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around OpenAI large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_1-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "text-davinci-003", + "name": "text-davinci-003" + }, + { + "label": "text-davinci-002", + "name": "text-davinci-002" + }, + { + "label": "text-curie-001", + "name": "text-curie-001" + }, + { + "label": "text-babbage-001", + "name": "text-babbage-001" + } + ], + "default": "text-davinci-003", + "optional": true, + "id": "openAI_1-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.7, + "optional": true, + "id": "openAI_1-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-topP-number" + }, + { + "label": "Best Of", + "name": "bestOf", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-bestOf-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-presencePenalty-number" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAI_1-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "text-davinci-003", + "temperature": 0.7, + "maxTokens": "", + "topP": "", + "bestOf": "", + "frequencyPenalty": "", + "presencePenalty": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "name": "openAI", + "label": "OpenAI", + "type": "OpenAI | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 791.6102007244282, + "y": -13.71386876566092 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, "id": "openAI_2", "position": { - "x": 793.6674026500068, - "y": -20.826430802683774 + "x": 1571.148617508543, + "y": -20.372437481171687 }, "type": "customNode", "data": { "id": "openAI_2", "label": "OpenAI", "name": "openAI", + "version": 1, "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], "category": "LLMs", "description": "Wrapper around OpenAI large language models", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_2-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_2-input-credential-credential" }, { "label": "Model Name", @@ -134,226 +574,15 @@ "frequencyPenalty": "", "presencePenalty": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "id": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", "name": "openAI", "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 793.6674026500068, - "y": -20.826430802683774 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 524, - "id": "openAI_3", - "position": { - "x": 1216.061423775753, - "y": -20.35195330852082 - }, - "type": "customNode", - "data": { - "id": "openAI_3", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_3-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_3-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_3-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_3-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": 0.7, - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1216.061423775753, - "y": -20.35195330852082 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 475, - "id": "promptTemplate_0", - "position": { - "x": 792.9464838535649, - "y": 527.1718536712464 - }, - "type": "customNode", - "data": { - "id": "promptTemplate_0", - "label": "Prompt Template", - "name": "promptTemplate", - "type": "PromptTemplate", - "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], - "category": "Prompts", - "description": "Schema to represent a basic prompt for an LLM", - "inputParams": [ - { - "label": "Template", - "name": "template", - "type": "string", - "rows": 4, - "placeholder": "What is a good name for a company that makes {product}?", - "id": "promptTemplate_0-input-template-string" - }, - { - "label": "Format Prompt Values", - "name": "promptValues", - "type": "json", - "optional": true, - "acceptVariable": true, - "list": true, - "id": "promptTemplate_0-input-promptValues-json" - } - ], - "inputAnchors": [], - "inputs": { - "template": "You are an AI who performs one task based on the following objective: {objective}.\nRespond with how you would complete this task:", - "promptValues": "{\"objective\":\"{{question}}\"}" - }, - "outputAnchors": [ - { - "id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", - "name": "promptTemplate", - "label": "PromptTemplate", - "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" + "type": "OpenAI | BaseLLM | BaseLanguageModel" } ], "outputs": {}, @@ -361,243 +590,13 @@ }, "selected": false, "positionAbsolute": { - "x": 792.9464838535649, - "y": 527.1718536712464 - }, - "dragging": false - }, - { - "width": 300, - "height": 475, - "id": "promptTemplate_1", - "position": { - "x": 1577.7482561604884, - "y": 516.186942924815 - }, - "type": "customNode", - "data": { - "id": "promptTemplate_1", - "label": "Prompt Template", - "name": "promptTemplate", - "type": "PromptTemplate", - "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], - "category": "Prompts", - "description": "Schema to represent a basic prompt for an LLM", - "inputParams": [ - { - "label": "Template", - "name": "template", - "type": "string", - "rows": 4, - "placeholder": "What is a good name for a company that makes {product}?", - "id": "promptTemplate_1-input-template-string" - }, - { - "label": "Format Prompt Values", - "name": "promptValues", - "type": "json", - "optional": true, - "acceptVariable": true, - "list": true, - "id": "promptTemplate_1-input-promptValues-json" - } - ], - "inputAnchors": [], - "inputs": { - "template": "You are a task creation AI that uses the result of an execution agent to create new tasks with the following objective: {objective}.\nThe last completed task has the result: {result}.\nBased on the result, create new tasks to be completed by the AI system that do not overlap with result.\nReturn the tasks as an array.", - "promptValues": "{\"objective\":\"{{question}}\",\"result\":\"{{llmChain_0.data.instance}}\"}" - }, - "outputAnchors": [ - { - "id": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", - "name": "promptTemplate", - "label": "PromptTemplate", - "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1577.7482561604884, - "y": 516.186942924815 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 405, - "id": "llmChain_0", - "position": { - "x": 1221.1346231272787, - "y": 538.9546839784628 - }, - "type": "customNode", - "data": { - "id": "llmChain_0", - "label": "LLM Chain", - "name": "llmChain", - "type": "LLMChain", - "baseClasses": ["LLMChain", "BaseChain"], - "category": "Chains", - "description": "Chain to run queries against LLMs", - "inputParams": [ - { - "label": "Chain Name", - "name": "chainName", - "type": "string", - "placeholder": "Name Your Chain", - "optional": true, - "id": "llmChain_0-input-chainName-string" - } - ], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "llmChain_0-input-model-BaseLanguageModel" - }, - { - "label": "Prompt", - "name": "prompt", - "type": "BasePromptTemplate", - "id": "llmChain_0-input-prompt-BasePromptTemplate" - } - ], - "inputs": { - "model": "{{openAI_2.data.instance}}", - "prompt": "{{promptTemplate_0.data.instance}}", - "chainName": "FirstChain" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "llmChain_0-output-llmChain-LLMChain|BaseChain", - "name": "llmChain", - "label": "LLM Chain", - "type": "LLMChain | BaseChain" - }, - { - "id": "llmChain_0-output-outputPrediction-string|json", - "name": "outputPrediction", - "label": "Output Prediction", - "type": "string | json" - } - ], - "default": "llmChain" - } - ], - "outputs": { - "output": "outputPrediction" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1221.1346231272787, - "y": 538.9546839784628 - }, - "dragging": false - }, - { - "width": 300, - "height": 405, - "id": "llmChain_1", - "position": { - "x": 1971.8054567964418, - "y": 207.624530381245 - }, - "type": "customNode", - "data": { - "id": "llmChain_1", - "label": "LLM Chain", - "name": "llmChain", - "type": "LLMChain", - "baseClasses": ["LLMChain", "BaseChain"], - "category": "Chains", - "description": "Chain to run queries against LLMs", - "inputParams": [ - { - "label": "Chain Name", - "name": "chainName", - "type": "string", - "placeholder": "Name Your Chain", - "optional": true, - "id": "llmChain_1-input-chainName-string" - } - ], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "llmChain_1-input-model-BaseLanguageModel" - }, - { - "label": "Prompt", - "name": "prompt", - "type": "BasePromptTemplate", - "id": "llmChain_1-input-prompt-BasePromptTemplate" - } - ], - "inputs": { - "model": "{{openAI_3.data.instance}}", - "prompt": "{{promptTemplate_1.data.instance}}", - "chainName": "LastChain" - }, - "outputAnchors": [ - { - "name": "output", - "label": "Output", - "type": "options", - "options": [ - { - "id": "llmChain_1-output-llmChain-LLMChain|BaseChain", - "name": "llmChain", - "label": "LLM Chain", - "type": "LLMChain | BaseChain" - }, - { - "id": "llmChain_1-output-outputPrediction-string|json", - "name": "outputPrediction", - "label": "Output Prediction", - "type": "string | json" - } - ], - "default": "llmChain" - } - ], - "outputs": { - "output": "llmChain" - }, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1971.8054567964418, - "y": 207.624530381245 + "x": 1571.148617508543, + "y": -20.372437481171687 }, "dragging": false } ], "edges": [ - { - "source": "openAI_2", - "sourceHandle": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "llmChain_0", - "targetHandle": "llmChain_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_2-openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-llmChain_0-llmChain_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "promptTemplate_0", "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", @@ -620,17 +619,6 @@ "label": "" } }, - { - "source": "openAI_3", - "sourceHandle": "openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_3-openAI_3-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-llmChain_1-llmChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "promptTemplate_1", "sourceHandle": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", @@ -641,6 +629,28 @@ "data": { "label": "" } + }, + { + "source": "openAI_1", + "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "llmChain_0", + "targetHandle": "llmChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_0-llmChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "openAI_2", + "sourceHandle": "openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_2-openAI_2-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Replicate LLM.json b/packages/server/marketplaces/chatflows/Replicate LLM.json index 66377663..5a57b2e7 100644 --- a/packages/server/marketplaces/chatflows/Replicate LLM.json +++ b/packages/server/marketplaces/chatflows/Replicate LLM.json @@ -14,6 +14,7 @@ "id": "llmChain_1", "label": "LLM Chain", "name": "llmChain", + "version": 1, "type": "LLMChain", "baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -94,6 +95,7 @@ "id": "promptTemplate_0", "label": "Prompt Template", "name": "promptTemplate", + "version": 1, "type": "PromptTemplate", "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -153,6 +155,7 @@ "id": "replicate_0", "label": "Replicate", "name": "replicate", + "version": 1, "type": "Replicate", "baseClasses": ["Replicate", "LLM", "BaseLLM", "BaseLanguageModel"], "category": "LLMs", diff --git a/packages/server/marketplaces/chatflows/SQL DB Chain.json b/packages/server/marketplaces/chatflows/SQL DB Chain.json index e7826aa2..b37dc7ce 100644 --- a/packages/server/marketplaces/chatflows/SQL DB Chain.json +++ b/packages/server/marketplaces/chatflows/SQL DB Chain.json @@ -1,159 +1,6 @@ { "description": "Answer questions over a SQL database", "nodes": [ - { - "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 835.4668837832456, - "y": 182.4724119898708 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": 0.7, - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 835.4668837832456, - "y": 182.4724119898708 - }, - "dragging": false - }, { "width": 300, "height": 424, @@ -167,6 +14,7 @@ "id": "sqlDatabaseChain_0", "label": "Sql Database Chain", "name": "sqlDatabaseChain", + "version": 1, "type": "SqlDatabaseChain", "baseClasses": ["SqlDatabaseChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -202,7 +50,7 @@ } ], "inputs": { - "model": "{{openAI_1.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", "database": "sqlite", "dbFilePath": "" }, @@ -223,16 +71,170 @@ "y": 217.507437391498 }, "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 855.0396169649254, + "y": 179.29430548099504 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 855.0396169649254, + "y": 179.29430548099504 + }, + "dragging": false } ], "edges": [ { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "sqlDatabaseChain_0", "targetHandle": "sqlDatabaseChain_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-sqlDatabaseChain_0-sqlDatabaseChain_0-input-model-BaseLanguageModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-sqlDatabaseChain_0-sqlDatabaseChain_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Simple Conversation Chain.json b/packages/server/marketplaces/chatflows/Simple Conversation Chain.json index 04009123..2c41a54f 100644 --- a/packages/server/marketplaces/chatflows/Simple Conversation Chain.json +++ b/packages/server/marketplaces/chatflows/Simple Conversation Chain.json @@ -3,27 +3,86 @@ "nodes": [ { "width": 300, - "height": 524, + "height": 376, + "id": "bufferMemory_0", + "position": { + "x": 753.4300788823234, + "y": 479.5336426526603 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_0", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_0-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 753.4300788823234, + "y": 479.5336426526603 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, "id": "chatOpenAI_0", "position": { - "x": 750.6529856117049, - "y": -75.72544375812092 + "x": 754.8942497823595, + "y": -70.76607584232393 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -132,70 +191,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 750.6529856117049, - "y": -75.72544375812092 - }, - "selected": false, - "dragging": false - }, - { - "width": 300, - "height": 376, - "id": "bufferMemory_0", - "position": { - "x": 753.4300788823234, - "y": 479.5336426526603 - }, - "type": "customNode", - "data": { - "id": "bufferMemory_0", - "label": "Buffer Memory", - "name": "bufferMemory", - "type": "BufferMemory", - "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], - "category": "Memory", - "description": "Remembers previous conversational back and forths directly", - "inputParams": [ - { - "label": "Memory Key", - "name": "memoryKey", - "type": "string", - "default": "chat_history", - "id": "bufferMemory_0-input-memoryKey-string" - }, - { - "label": "Input Key", - "name": "inputKey", - "type": "string", - "default": "input", - "id": "bufferMemory_0-input-inputKey-string" - } - ], - "inputAnchors": [], - "inputs": { - "memoryKey": "chat_history", - "inputKey": "input" - }, - "outputAnchors": [ - { - "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "name": "bufferMemory", - "label": "BufferMemory", - "type": "BufferMemory | BaseChatMemory | BaseMemory" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -203,26 +207,27 @@ }, "selected": false, "positionAbsolute": { - "x": 753.4300788823234, - "y": 479.5336426526603 + "x": 754.8942497823595, + "y": -70.76607584232393 }, "dragging": false }, { "width": 300, - "height": 332, + "height": 383, "id": "conversationChain_0", "position": { - "x": 1201.6630991237407, - "y": 291.86981791303066 + "x": 1174.6496397666272, + "y": 311.1052536740497 }, "type": "customNode", "data": { "id": "conversationChain_0", "label": "Conversation Chain", "name": "conversationChain", + "version": 1, "type": "ConversationChain", - "baseClasses": ["ConversationChain", "LLMChain", "BaseChain", "BaseLangChain"], + "baseClasses": ["ConversationChain", "LLMChain", "BaseChain"], "category": "Chains", "description": "Chat models specific conversational chain with memory", "inputParams": [ @@ -263,14 +268,15 @@ "inputs": { "model": "{{chatOpenAI_0.data.instance}}", "memory": "{{bufferMemory_0.data.instance}}", + "document": "", "systemMessagePrompt": "" }, "outputAnchors": [ { - "id": "conversationChain_0-output-conversationChain-ConversationChain|LLMChain|BaseChain|BaseLangChain", + "id": "conversationChain_0-output-conversationChain-ConversationChain|LLMChain|BaseChain", "name": "conversationChain", "label": "ConversationChain", - "type": "ConversationChain | LLMChain | BaseChain | BaseLangChain" + "type": "ConversationChain | LLMChain | BaseChain" } ], "outputs": {}, @@ -278,8 +284,8 @@ }, "selected": false, "positionAbsolute": { - "x": 1201.6630991237407, - "y": 291.86981791303066 + "x": 1174.6496397666272, + "y": 311.1052536740497 }, "dragging": false } @@ -287,11 +293,11 @@ "edges": [ { "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "target": "conversationChain_0", "targetHandle": "conversationChain_0-input-model-BaseChatModel", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationChain_0-conversationChain_0-input-model-BaseChatModel", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationChain_0-conversationChain_0-input-model-BaseChatModel", "data": { "label": "" } diff --git a/packages/server/marketplaces/chatflows/Simple LLM Chain.json b/packages/server/marketplaces/chatflows/Simple LLM Chain.json index cc193d5c..0fc648c6 100644 --- a/packages/server/marketplaces/chatflows/Simple LLM Chain.json +++ b/packages/server/marketplaces/chatflows/Simple LLM Chain.json @@ -1,159 +1,6 @@ { "description": "Basic example of stateless (no memory) LLM Chain with a Prompt Template and LLM Model", "nodes": [ - { - "width": 300, - "height": 524, - "id": "openAI_1", - "position": { - "x": 510.75932526856377, - "y": -44.80152395958956 - }, - "type": "customNode", - "data": { - "id": "openAI_1", - "label": "OpenAI", - "name": "openAI", - "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], - "category": "LLMs", - "description": "Wrapper around OpenAI large language models", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_1-input-openAIApiKey-password" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "options", - "options": [ - { - "label": "text-davinci-003", - "name": "text-davinci-003" - }, - { - "label": "text-davinci-002", - "name": "text-davinci-002" - }, - { - "label": "text-curie-001", - "name": "text-curie-001" - }, - { - "label": "text-babbage-001", - "name": "text-babbage-001" - } - ], - "default": "text-davinci-003", - "optional": true, - "id": "openAI_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.7, - "optional": true, - "id": "openAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-topP-number" - }, - { - "label": "Best Of", - "name": "bestOf", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-bestOf-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-presencePenalty-number" - }, - { - "label": "Batch Size", - "name": "batchSize", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-batchSize-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "openAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "text-davinci-003", - "temperature": 0.7, - "maxTokens": "", - "topP": "", - "bestOf": "", - "frequencyPenalty": "", - "presencePenalty": "", - "batchSize": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "name": "openAI", - "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 510.75932526856377, - "y": -44.80152395958956 - }, - "dragging": false - }, { "width": 300, "height": 405, @@ -167,6 +14,7 @@ "id": "llmChain_1", "label": "LLM Chain", "name": "llmChain", + "version": 1, "type": "LLMChain", "baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -196,7 +44,7 @@ } ], "inputs": { - "model": "{{openAI_1.data.instance}}", + "model": "{{openAI_0.data.instance}}", "prompt": "{{promptTemplate_0.data.instance}}", "chainName": "" }, @@ -247,6 +95,7 @@ "id": "promptTemplate_0", "label": "Prompt Template", "name": "promptTemplate", + "version": 1, "type": "PromptTemplate", "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -292,20 +141,165 @@ "y": 506.7411400888471 }, "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "openAI_0", + "position": { + "x": 513.3297923232442, + "y": -42.67554802812833 + }, + "type": "customNode", + "data": { + "id": "openAI_0", + "label": "OpenAI", + "name": "openAI", + "version": 1, + "type": "OpenAI", + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], + "category": "LLMs", + "description": "Wrapper around OpenAI large language models", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_0-input-credential-credential" + }, + { + "label": "Model Name", + "name": "modelName", + "type": "options", + "options": [ + { + "label": "text-davinci-003", + "name": "text-davinci-003" + }, + { + "label": "text-davinci-002", + "name": "text-davinci-002" + }, + { + "label": "text-curie-001", + "name": "text-curie-001" + }, + { + "label": "text-babbage-001", + "name": "text-babbage-001" + } + ], + "default": "text-davinci-003", + "optional": true, + "id": "openAI_0-input-modelName-options" + }, + { + "label": "Temperature", + "name": "temperature", + "type": "number", + "default": 0.7, + "optional": true, + "id": "openAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-topP-number" + }, + { + "label": "Best Of", + "name": "bestOf", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-bestOf-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-presencePenalty-number" + }, + { + "label": "Batch Size", + "name": "batchSize", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-batchSize-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-timeout-number" + }, + { + "label": "BasePath", + "name": "basepath", + "type": "string", + "optional": true, + "additionalParams": true, + "id": "openAI_0-input-basepath-string" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "text-davinci-003", + "temperature": 0.7, + "maxTokens": "", + "topP": "", + "bestOf": "", + "frequencyPenalty": "", + "presencePenalty": "", + "batchSize": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "name": "openAI", + "label": "OpenAI", + "type": "OpenAI | BaseLLM | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 513.3297923232442, + "y": -42.67554802812833 + }, + "dragging": false } ], "edges": [ - { - "source": "openAI_1", - "sourceHandle": "openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "openAI_1-openAI_1-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-llmChain_1-llmChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "promptTemplate_0", "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate", @@ -316,6 +310,17 @@ "data": { "label": "" } + }, + { + "source": "openAI_0", + "sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/Translator.json b/packages/server/marketplaces/chatflows/Translator.json index 942bbecd..dc2ee6ba 100644 --- a/packages/server/marketplaces/chatflows/Translator.json +++ b/packages/server/marketplaces/chatflows/Translator.json @@ -1,157 +1,6 @@ { "description": "Language translation using LLM Chain with a Chat Prompt Template and Chat Model", "nodes": [ - { - "width": 300, - "height": 524, - "id": "chatOpenAI_1", - "position": { - "x": 439.5219561593599, - "y": 93.61600226758335 - }, - "type": "customNode", - "data": { - "id": "chatOpenAI_1", - "label": "ChatOpenAI", - "name": "chatOpenAI", - "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], - "category": "Chat Models", - "description": "Wrapper around OpenAI large language models that use the Chat endpoint", - "inputParams": [ - { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" - }, - { - "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_1-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.9, - "optional": true, - "id": "chatOpenAI_1-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-topP-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-presencePenalty-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_1-input-basepath-string" - } - ], - "inputAnchors": [], - "inputs": { - "modelName": "gpt-3.5-turbo", - "temperature": 0.9, - "maxTokens": "", - "topP": "", - "frequencyPenalty": "", - "presencePenalty": "", - "timeout": "" - }, - "outputAnchors": [ - { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "name": "chatOpenAI", - "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 439.5219561593599, - "y": 93.61600226758335 - }, - "dragging": false - }, { "width": 300, "height": 405, @@ -165,6 +14,7 @@ "id": "llmChain_1", "label": "LLM Chain", "name": "llmChain", + "version": 1, "type": "LLMChain", "baseClasses": ["LLMChain", "BaseChain", "BaseLangChain"], "category": "Chains", @@ -194,7 +44,7 @@ } ], "inputs": { - "model": "{{chatOpenAI_1.data.instance}}", + "model": "{{chatOpenAI_0.data.instance}}", "prompt": "{{chatPromptTemplate_0.data.instance}}", "chainName": "Language Translation" }, @@ -245,6 +95,7 @@ "id": "chatPromptTemplate_0", "label": "Chat Prompt Template", "name": "chatPromptTemplate", + "version": 1, "type": "ChatPromptTemplate", "baseClasses": ["ChatPromptTemplate", "BaseChatPromptTemplate", "BasePromptTemplate"], "category": "Prompts", @@ -299,20 +150,163 @@ "y": 649.7619214034173 }, "dragging": false + }, + { + "width": 300, + "height": 523, + "id": "chatOpenAI_0", + "position": { + "x": 436.97058562345904, + "y": 99.96180150605153 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 436.97058562345904, + "y": 99.96180150605153 + }, + "dragging": false } ], "edges": [ - { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "llmChain_1", - "targetHandle": "llmChain_1-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-llmChain_1-llmChain_1-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "chatPromptTemplate_0", "sourceHandle": "chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate", @@ -323,6 +317,17 @@ "data": { "label": "" } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "llmChain_1", + "targetHandle": "llmChain_1-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-llmChain_1-llmChain_1-input-model-BaseLanguageModel", + "data": { + "label": "" + } } ] } diff --git a/packages/server/marketplaces/chatflows/WebBrowser.json b/packages/server/marketplaces/chatflows/WebBrowser.json index f87fe07e..95743f9f 100644 --- a/packages/server/marketplaces/chatflows/WebBrowser.json +++ b/packages/server/marketplaces/chatflows/WebBrowser.json @@ -3,27 +3,216 @@ "nodes": [ { "width": 300, - "height": 524, + "height": 376, + "id": "bufferMemory_0", + "position": { + "x": 457.04304716743604, + "y": 362.4048129799687 + }, + "type": "customNode", + "data": { + "id": "bufferMemory_0", + "label": "Buffer Memory", + "name": "bufferMemory", + "version": 1, + "type": "BufferMemory", + "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Remembers previous conversational back and forths directly", + "inputParams": [ + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "id": "bufferMemory_0-input-memoryKey-string" + }, + { + "label": "Input Key", + "name": "inputKey", + "type": "string", + "default": "input", + "id": "bufferMemory_0-input-inputKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "memoryKey": "chat_history", + "inputKey": "input" + }, + "outputAnchors": [ + { + "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", + "name": "bufferMemory", + "label": "BufferMemory", + "type": "BufferMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 457.04304716743604, + "y": 362.4048129799687 + }, + "dragging": false + }, + { + "width": 300, + "height": 280, + "id": "webBrowser_0", + "position": { + "x": 1091.0866823400172, + "y": -16.43806989958216 + }, + "type": "customNode", + "data": { + "id": "webBrowser_0", + "label": "Web Browser", + "name": "webBrowser", + "version": 1, + "type": "WebBrowser", + "baseClasses": ["WebBrowser", "Tool", "StructuredTool", "BaseLangChain"], + "category": "Tools", + "description": "Gives agent the ability to visit a website and extract information", + "inputParams": [], + "inputAnchors": [ + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "webBrowser_0-input-model-BaseLanguageModel" + }, + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "webBrowser_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "model": "{{chatOpenAI_0.data.instance}}", + "embeddings": "{{openAIEmbeddings_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain", + "name": "webBrowser", + "label": "WebBrowser", + "type": "WebBrowser | Tool | StructuredTool | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1091.0866823400172, + "y": -16.43806989958216 + }, + "dragging": false + }, + { + "width": 300, + "height": 383, + "id": "conversationalAgent_0", + "position": { + "x": 1464.513303631911, + "y": 155.73036805253955 + }, + "type": "customNode", + "data": { + "id": "conversationalAgent_0", + "label": "Conversational Agent", + "name": "conversationalAgent", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain"], + "category": "Agents", + "description": "Conversational agent for a chat model. It will utilize chat specific prompts", + "inputParams": [ + { + "label": "System Message", + "name": "systemMessage", + "type": "string", + "rows": 4, + "default": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.", + "optional": true, + "additionalParams": true, + "id": "conversationalAgent_0-input-systemMessage-string" + } + ], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "conversationalAgent_0-input-tools-Tool" + }, + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "conversationalAgent_0-input-model-BaseLanguageModel" + }, + { + "label": "Memory", + "name": "memory", + "type": "BaseChatMemory", + "id": "conversationalAgent_0-input-memory-BaseChatMemory" + } + ], + "inputs": { + "tools": ["{{webBrowser_0.data.instance}}"], + "model": "{{chatOpenAI_1.data.instance}}", + "memory": "{{bufferMemory_0.data.instance}}", + "systemMessage": "Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist." + }, + "outputAnchors": [ + { + "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain", + "name": "conversationalAgent", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1464.513303631911, + "y": 155.73036805253955 + }, + "dragging": false + }, + { + "width": 300, + "height": 523, "id": "chatOpenAI_0", "position": { - "x": 348.0817836845733, - "y": -86.56099395751443 + "x": 734.7477982032904, + "y": -400.9979556765114 }, "type": "customNode", "data": { "id": "chatOpenAI_0", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_0-input-credential-credential" }, { "label": "Model Name", @@ -132,14 +321,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -147,90 +337,36 @@ }, "selected": false, "positionAbsolute": { - "x": 348.0817836845733, - "y": -86.56099395751443 + "x": 734.7477982032904, + "y": -400.9979556765114 }, "dragging": false }, { "width": 300, - "height": 376, - "id": "bufferMemory_0", - "position": { - "x": 15.045898260926037, - "y": 114.13407401971622 - }, - "type": "customNode", - "data": { - "id": "bufferMemory_0", - "label": "Buffer Memory", - "name": "bufferMemory", - "type": "BufferMemory", - "baseClasses": ["BufferMemory", "BaseChatMemory", "BaseMemory"], - "category": "Memory", - "description": "Remembers previous conversational back and forths directly", - "inputParams": [ - { - "label": "Memory Key", - "name": "memoryKey", - "type": "string", - "default": "chat_history", - "id": "bufferMemory_0-input-memoryKey-string" - }, - { - "label": "Input Key", - "name": "inputKey", - "type": "string", - "default": "input", - "id": "bufferMemory_0-input-inputKey-string" - } - ], - "inputAnchors": [], - "inputs": { - "memoryKey": "chat_history", - "inputKey": "input" - }, - "outputAnchors": [ - { - "id": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", - "name": "bufferMemory", - "label": "BufferMemory", - "type": "BufferMemory | BaseChatMemory | BaseMemory" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 15.045898260926037, - "y": 114.13407401971622 - }, - "dragging": false - }, - { - "width": 300, - "height": 330, + "height": 329, "id": "openAIEmbeddings_0", "position": { - "x": 693.9266260641734, - "y": 37.098856540087496 + "x": 403.72014625628697, + "y": -103.82540449681527 }, "type": "customNode", "data": { "id": "openAIEmbeddings_0", "label": "OpenAI Embeddings", "name": "openAIEmbeddings", + "version": 1, "type": "OpenAIEmbeddings", "baseClasses": ["OpenAIEmbeddings", "Embeddings"], "category": "Embeddings", "description": "OpenAI API to generate embeddings for a given text", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAIEmbeddings_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAIEmbeddings_0-input-credential-credential" }, { "label": "Strip New Lines", @@ -269,7 +405,8 @@ "inputs": { "stripNewLines": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { @@ -284,34 +421,36 @@ }, "selected": false, "positionAbsolute": { - "x": 693.9266260641734, - "y": 37.098856540087496 + "x": 403.72014625628697, + "y": -103.82540449681527 }, "dragging": false }, { "width": 300, - "height": 524, + "height": 523, "id": "chatOpenAI_1", "position": { - "x": 691.5132411896494, - "y": -533.1696369549378 + "x": 68.312124033115, + "y": -169.65476709991256 }, "type": "customNode", "data": { "id": "chatOpenAI_1", "label": "ChatOpenAI", "name": "chatOpenAI", + "version": 1, "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], "category": "Chat Models", "description": "Wrapper around OpenAI large language models that use the Chat endpoint", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "chatOpenAI_1-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "chatOpenAI_1-input-credential-credential" }, { "label": "Model Name", @@ -420,14 +559,15 @@ "topP": "", "frequencyPenalty": "", "presencePenalty": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", + "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", "name": "chatOpenAI", "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | BaseLangChain" + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" } ], "outputs": {}, @@ -435,161 +575,13 @@ }, "selected": false, "positionAbsolute": { - "x": 691.5132411896494, - "y": -533.1696369549378 - }, - "dragging": false - }, - { - "width": 300, - "height": 280, - "id": "webBrowser_0", - "position": { - "x": 1091.0866823400172, - "y": -16.43806989958216 - }, - "type": "customNode", - "data": { - "id": "webBrowser_0", - "label": "Web Browser", - "name": "webBrowser", - "type": "WebBrowser", - "baseClasses": ["WebBrowser", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Gives agent the ability to visit a website and extract information", - "inputParams": [], - "inputAnchors": [ - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "webBrowser_0-input-model-BaseLanguageModel" - }, - { - "label": "Embeddings", - "name": "embeddings", - "type": "Embeddings", - "id": "webBrowser_0-input-embeddings-Embeddings" - } - ], - "inputs": { - "model": "{{chatOpenAI_1.data.instance}}", - "embeddings": "{{openAIEmbeddings_0.data.instance}}" - }, - "outputAnchors": [ - { - "id": "webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain", - "name": "webBrowser", - "label": "WebBrowser", - "type": "WebBrowser | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1091.0866823400172, - "y": -16.43806989958216 - }, - "dragging": false - }, - { - "width": 300, - "height": 383, - "id": "conversationalAgent_0", - "position": { - "x": 1451.6222493253506, - "y": 239.69137914100338 - }, - "type": "customNode", - "data": { - "id": "conversationalAgent_0", - "label": "Conversational Agent", - "name": "conversationalAgent", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], - "category": "Agents", - "description": "Conversational agent for a chat model. It will utilize chat specific prompts", - "inputParams": [ - { - "label": "System Message", - "name": "systemMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "conversationalAgent_0-input-systemMessage-string" - }, - { - "label": "Human Message", - "name": "humanMessage", - "type": "string", - "rows": 4, - "optional": true, - "additionalParams": true, - "id": "conversationalAgent_0-input-humanMessage-string" - } - ], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "conversationalAgent_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "conversationalAgent_0-input-model-BaseLanguageModel" - }, - { - "label": "Memory", - "name": "memory", - "type": "BaseChatMemory", - "id": "conversationalAgent_0-input-memory-BaseChatMemory" - } - ], - "inputs": { - "tools": ["{{webBrowser_0.data.instance}}"], - "model": "{{chatOpenAI_0.data.instance}}", - "memory": "{{bufferMemory_0.data.instance}}", - "systemMessage": "", - "humanMessage": "" - }, - "outputAnchors": [ - { - "id": "conversationalAgent_0-output-conversationalAgent-AgentExecutor|BaseChain|BaseLangChain", - "name": "conversationalAgent", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1451.6222493253506, - "y": 239.69137914100338 + "x": 68.312124033115, + "y": -169.65476709991256 }, "dragging": false } ], "edges": [ - { - "source": "chatOpenAI_1", - "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "webBrowser_0", - "targetHandle": "webBrowser_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-webBrowser_0-webBrowser_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "openAIEmbeddings_0", "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", @@ -601,6 +593,28 @@ "label": "" } }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "webBrowser_0", + "targetHandle": "webBrowser_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-webBrowser_0-webBrowser_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_1", + "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "conversationalAgent_0", + "targetHandle": "conversationalAgent_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, { "source": "webBrowser_0", "sourceHandle": "webBrowser_0-output-webBrowser-WebBrowser|Tool|StructuredTool|BaseLangChain", @@ -612,17 +626,6 @@ "label": "" } }, - { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain", - "target": "conversationalAgent_0", - "targetHandle": "conversationalAgent_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|BaseLangChain-conversationalAgent_0-conversationalAgent_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - }, { "source": "bufferMemory_0", "sourceHandle": "bufferMemory_0-output-bufferMemory-BufferMemory|BaseChatMemory|BaseMemory", diff --git a/packages/server/marketplaces/chatflows/WebPage QnA.json b/packages/server/marketplaces/chatflows/WebPage QnA.json new file mode 100644 index 00000000..b04ad5e2 --- /dev/null +++ b/packages/server/marketplaces/chatflows/WebPage QnA.json @@ -0,0 +1,771 @@ +{ + "description": "Scrape web pages for QnA with long term memory Motorhead and return source documents", + "nodes": [ + { + "width": 300, + "height": 522, + "id": "chatOpenAI_0", + "position": { + "x": 1509.7110310286191, + "y": -171.0099374102956 + }, + "type": "customNode", + "data": { + "id": "chatOpenAI_0", + "label": "ChatOpenAI", + "name": "chatOpenAI", + "version": 1, + "type": "ChatOpenAI", + "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], + "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", + "default": 0.9, + "optional": true, + "id": "chatOpenAI_0-input-temperature-number" + }, + { + "label": "Max Tokens", + "name": "maxTokens", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-maxTokens-number" + }, + { + "label": "Top Probability", + "name": "topP", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-topP-number" + }, + { + "label": "Frequency Penalty", + "name": "frequencyPenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-frequencyPenalty-number" + }, + { + "label": "Presence Penalty", + "name": "presencePenalty", + "type": "number", + "optional": true, + "additionalParams": true, + "id": "chatOpenAI_0-input-presencePenalty-number" + }, + { + "label": "Timeout", + "name": "timeout", + "type": "number", + "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" + } + ], + "inputAnchors": [], + "inputs": { + "modelName": "gpt-3.5-turbo", + "temperature": "0", + "maxTokens": "", + "topP": "", + "frequencyPenalty": "", + "presencePenalty": "", + "timeout": "", + "basepath": "" + }, + "outputAnchors": [ + { + "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "name": "chatOpenAI", + "label": "ChatOpenAI", + "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1509.7110310286191, + "y": -171.0099374102956 + }, + "selected": false, + "dragging": false + }, + { + "width": 300, + "height": 328, + "id": "openAIEmbeddings_0", + "position": { + "x": 827.6835380475393, + "y": 253.8955254525015 + }, + "type": "customNode", + "data": { + "id": "openAIEmbeddings_0", + "label": "OpenAI Embeddings", + "name": "openAIEmbeddings", + "version": 1, + "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, + "positionAbsolute": { + "x": 827.6835380475393, + "y": 253.8955254525015 + }, + "dragging": false + }, + { + "width": 300, + "height": 554, + "id": "pineconeUpsert_0", + "position": { + "x": 1178.0855412625938, + "y": -1.6626550640073674 + }, + "type": "customNode", + "data": { + "id": "pineconeUpsert_0", + "label": "Pinecone Upsert Document", + "name": "pineconeUpsert", + "version": 1, + "type": "Pinecone", + "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], + "category": "Vector Stores", + "description": "Upsert documents to Pinecone", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["pineconeApi"], + "id": "pineconeUpsert_0-input-credential-credential" + }, + { + "label": "Pinecone Index", + "name": "pineconeIndex", + "type": "string", + "id": "pineconeUpsert_0-input-pineconeIndex-string" + }, + { + "label": "Pinecone Namespace", + "name": "pineconeNamespace", + "type": "string", + "placeholder": "my-first-namespace", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-pineconeNamespace-string" + }, + { + "label": "Top K", + "name": "topK", + "description": "Number of top results to fetch. Default to 4", + "placeholder": "4", + "type": "number", + "additionalParams": true, + "optional": true, + "id": "pineconeUpsert_0-input-topK-number" + } + ], + "inputAnchors": [ + { + "label": "Document", + "name": "document", + "type": "Document", + "list": true, + "id": "pineconeUpsert_0-input-document-Document" + }, + { + "label": "Embeddings", + "name": "embeddings", + "type": "Embeddings", + "id": "pineconeUpsert_0-input-embeddings-Embeddings" + } + ], + "inputs": { + "document": ["{{cheerioWebScraper_0.data.instance}}"], + "embeddings": "{{openAIEmbeddings_0.data.instance}}", + "pineconeIndex": "", + "pineconeNamespace": "", + "topK": "" + }, + "outputAnchors": [ + { + "name": "output", + "label": "Output", + "type": "options", + "options": [ + { + "id": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "name": "retriever", + "label": "Pinecone Retriever", + "type": "Pinecone | VectorStoreRetriever | BaseRetriever" + }, + { + "id": "pineconeUpsert_0-output-vectorStore-Pinecone|VectorStore", + "name": "vectorStore", + "label": "Pinecone Vector Store", + "type": "Pinecone | VectorStore" + } + ], + "default": "retriever" + } + ], + "outputs": { + "output": "retriever" + }, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1178.0855412625938, + "y": -1.6626550640073674 + }, + "dragging": false + }, + { + "width": 300, + "height": 379, + "id": "cheerioWebScraper_0", + "position": { + "x": 829.4409518246235, + "y": -168.78678247276423 + }, + "type": "customNode", + "data": { + "id": "cheerioWebScraper_0", + "label": "Cheerio Web Scraper", + "name": "cheerioWebScraper", + "version": 1, + "type": "Document", + "baseClasses": ["Document"], + "category": "Document Loaders", + "description": "Load data from webpages", + "inputParams": [ + { + "label": "URL", + "name": "url", + "type": "string", + "id": "cheerioWebScraper_0-input-url-string" + }, + { + "label": "Get Relative Links Method", + "name": "relativeLinksMethod", + "type": "options", + "description": "Select a method to retrieve relative links", + "options": [ + { + "label": "Web Crawl", + "name": "webCrawl", + "description": "Crawl relative links from HTML URL" + }, + { + "label": "Scrape XML Sitemap", + "name": "scrapeXMLSitemap", + "description": "Scrape relative links from XML sitemap URL" + } + ], + "optional": true, + "additionalParams": true, + "id": "cheerioWebScraper_0-input-relativeLinksMethod-options" + }, + { + "label": "Get Relative Links Limit", + "name": "limit", + "type": "number", + "optional": true, + "additionalParams": true, + "description": "Only used when \"Get Relative Links Method\" is selected. Set 0 to retrieve all relative links, default limit is 10.", + "warning": "Retreiving all links might take long time, and all links will be upserted again if the flow's state changed (eg: different URL, chunk size, etc)", + "id": "cheerioWebScraper_0-input-limit-number" + }, + { + "label": "Metadata", + "name": "metadata", + "type": "json", + "optional": true, + "additionalParams": true, + "id": "cheerioWebScraper_0-input-metadata-json" + } + ], + "inputAnchors": [ + { + "label": "Text Splitter", + "name": "textSplitter", + "type": "TextSplitter", + "optional": true, + "id": "cheerioWebScraper_0-input-textSplitter-TextSplitter" + } + ], + "inputs": { + "url": "https://www.itsjane.com", + "textSplitter": "{{htmlToMarkdownTextSplitter_0.data.instance}}", + "relativeLinksMethod": "", + "limit": "", + "metadata": "" + }, + "outputAnchors": [ + { + "id": "cheerioWebScraper_0-output-cheerioWebScraper-Document", + "name": "cheerioWebScraper", + "label": "Document", + "type": "Document" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 829.4409518246235, + "y": -168.78678247276423 + }, + "dragging": false + }, + { + "width": 300, + "height": 376, + "id": "htmlToMarkdownTextSplitter_0", + "position": { + "x": 443.00626484042334, + "y": 1.2942107707648631 + }, + "type": "customNode", + "data": { + "id": "htmlToMarkdownTextSplitter_0", + "label": "HtmlToMarkdown Text Splitter", + "name": "htmlToMarkdownTextSplitter", + "version": 1, + "type": "HtmlToMarkdownTextSplitter", + "baseClasses": [ + "HtmlToMarkdownTextSplitter", + "MarkdownTextSplitter", + "RecursiveCharacterTextSplitter", + "TextSplitter", + "BaseDocumentTransformer" + ], + "category": "Text Splitters", + "description": "Converts Html to Markdown and then split your content into documents based on the Markdown headers", + "inputParams": [ + { + "label": "Chunk Size", + "name": "chunkSize", + "type": "number", + "default": 1000, + "optional": true, + "id": "htmlToMarkdownTextSplitter_0-input-chunkSize-number" + }, + { + "label": "Chunk Overlap", + "name": "chunkOverlap", + "type": "number", + "optional": true, + "id": "htmlToMarkdownTextSplitter_0-input-chunkOverlap-number" + } + ], + "inputAnchors": [], + "inputs": { + "chunkSize": 1000, + "chunkOverlap": "" + }, + "outputAnchors": [ + { + "id": "htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer", + "name": "htmlToMarkdownTextSplitter", + "label": "HtmlToMarkdownTextSplitter", + "type": "HtmlToMarkdownTextSplitter | MarkdownTextSplitter | RecursiveCharacterTextSplitter | TextSplitter | BaseDocumentTransformer" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 443.00626484042334, + "y": 1.2942107707648631 + }, + "dragging": false + }, + { + "width": 300, + "height": 479, + "id": "conversationalRetrievalQAChain_0", + "position": { + "x": 1882.5543981868987, + "y": 305.08959224761225 + }, + "type": "customNode", + "data": { + "id": "conversationalRetrievalQAChain_0", + "label": "Conversational Retrieval QA Chain", + "name": "conversationalRetrievalQAChain", + "version": 1, + "type": "ConversationalRetrievalQAChain", + "baseClasses": ["ConversationalRetrievalQAChain", "BaseChain"], + "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": "{{pineconeUpsert_0.data.instance}}", + "memory": "{{motorheadMemory_0.data.instance}}", + "returnSourceDocuments": true, + "systemMessagePrompt": "", + "chainOption": "" + }, + "outputAnchors": [ + { + "id": "conversationalRetrievalQAChain_0-output-conversationalRetrievalQAChain-ConversationalRetrievalQAChain|BaseChain", + "name": "conversationalRetrievalQAChain", + "label": "ConversationalRetrievalQAChain", + "type": "ConversationalRetrievalQAChain | BaseChain" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1882.5543981868987, + "y": 305.08959224761225 + }, + "dragging": false + }, + { + "width": 300, + "height": 426, + "id": "motorheadMemory_0", + "position": { + "x": 1515.4202055109095, + "y": 539.7912360964175 + }, + "type": "customNode", + "data": { + "id": "motorheadMemory_0", + "label": "Motorhead Memory", + "name": "motorheadMemory", + "version": 1, + "type": "MotorheadMemory", + "baseClasses": ["MotorheadMemory", "BaseChatMemory", "BaseMemory"], + "category": "Memory", + "description": "Use Motorhead Memory to store chat conversations", + "inputParams": [ + { + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "optional": true, + "description": "Only needed when using hosted solution - https://getmetal.io", + "credentialNames": ["motorheadMemoryApi"], + "id": "motorheadMemory_0-input-credential-credential" + }, + { + "label": "Base URL", + "name": "baseURL", + "type": "string", + "optional": true, + "description": "To use the online version, leave the URL blank. More details at https://getmetal.io.", + "id": "motorheadMemory_0-input-baseURL-string" + }, + { + "label": "Session Id", + "name": "sessionId", + "type": "string", + "description": "if empty, chatId will be used automatically", + "default": "", + "additionalParams": true, + "optional": true, + "id": "motorheadMemory_0-input-sessionId-string" + }, + { + "label": "Memory Key", + "name": "memoryKey", + "type": "string", + "default": "chat_history", + "additionalParams": true, + "id": "motorheadMemory_0-input-memoryKey-string" + } + ], + "inputAnchors": [], + "inputs": { + "baseURL": "", + "sessionId": "", + "memoryKey": "chat_history" + }, + "outputAnchors": [ + { + "id": "motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory", + "name": "motorheadMemory", + "label": "MotorheadMemory", + "type": "MotorheadMemory | BaseChatMemory | BaseMemory" + } + ], + "outputs": {}, + "selected": false + }, + "selected": false, + "positionAbsolute": { + "x": 1515.4202055109095, + "y": 539.7912360964175 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "openAIEmbeddings_0", + "sourceHandle": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings", + "target": "pineconeUpsert_0", + "targetHandle": "pineconeUpsert_0-input-embeddings-Embeddings", + "type": "buttonedge", + "id": "openAIEmbeddings_0-openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings-pineconeUpsert_0-pineconeUpsert_0-input-embeddings-Embeddings", + "data": { + "label": "" + } + }, + { + "source": "cheerioWebScraper_0", + "sourceHandle": "cheerioWebScraper_0-output-cheerioWebScraper-Document", + "target": "pineconeUpsert_0", + "targetHandle": "pineconeUpsert_0-input-document-Document", + "type": "buttonedge", + "id": "cheerioWebScraper_0-cheerioWebScraper_0-output-cheerioWebScraper-Document-pineconeUpsert_0-pineconeUpsert_0-input-document-Document", + "data": { + "label": "" + } + }, + { + "source": "htmlToMarkdownTextSplitter_0", + "sourceHandle": "htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer", + "target": "cheerioWebScraper_0", + "targetHandle": "cheerioWebScraper_0-input-textSplitter-TextSplitter", + "type": "buttonedge", + "id": "htmlToMarkdownTextSplitter_0-htmlToMarkdownTextSplitter_0-output-htmlToMarkdownTextSplitter-HtmlToMarkdownTextSplitter|MarkdownTextSplitter|RecursiveCharacterTextSplitter|TextSplitter|BaseDocumentTransformer-cheerioWebScraper_0-cheerioWebScraper_0-input-textSplitter-TextSplitter", + "data": { + "label": "" + } + }, + { + "source": "chatOpenAI_0", + "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "type": "buttonedge", + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-model-BaseLanguageModel", + "data": { + "label": "" + } + }, + { + "source": "pineconeUpsert_0", + "sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "type": "buttonedge", + "id": "pineconeUpsert_0-pineconeUpsert_0-output-retriever-Pinecone|VectorStoreRetriever|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever", + "data": { + "label": "" + } + }, + { + "source": "motorheadMemory_0", + "sourceHandle": "motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory", + "target": "conversationalRetrievalQAChain_0", + "targetHandle": "conversationalRetrievalQAChain_0-input-memory-BaseMemory", + "type": "buttonedge", + "id": "motorheadMemory_0-motorheadMemory_0-output-motorheadMemory-MotorheadMemory|BaseChatMemory|BaseMemory-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-memory-BaseMemory", + "data": { + "label": "" + } + } + ] +} diff --git a/packages/server/marketplaces/chatflows/Zapier NLA.json b/packages/server/marketplaces/chatflows/Zapier NLA.json index 19b30107..60258b46 100644 --- a/packages/server/marketplaces/chatflows/Zapier NLA.json +++ b/packages/server/marketplaces/chatflows/Zapier NLA.json @@ -14,6 +14,7 @@ "id": "zapierNLA_0", "label": "Zapier NLA", "name": "zapierNLA", + "version": 1, "type": "ZapierNLA", "baseClasses": ["ZapierNLA", "Tool"], "category": "Tools", @@ -48,27 +49,84 @@ }, { "width": 300, - "height": 524, + "height": 280, + "id": "mrklAgentLLM_0", + "position": { + "x": 1002.5779315680477, + "y": 329.9701389591812 + }, + "type": "customNode", + "data": { + "id": "mrklAgentLLM_0", + "label": "MRKL Agent for LLMs", + "name": "mrklAgentLLM", + "version": 1, + "type": "AgentExecutor", + "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], + "category": "Agents", + "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with LLMs", + "inputParams": [], + "inputAnchors": [ + { + "label": "Allowed Tools", + "name": "tools", + "type": "Tool", + "list": true, + "id": "mrklAgentLLM_0-input-tools-Tool" + }, + { + "label": "Language Model", + "name": "model", + "type": "BaseLanguageModel", + "id": "mrklAgentLLM_0-input-model-BaseLanguageModel" + } + ], + "inputs": { + "tools": ["{{zapierNLA_0.data.instance}}"], + "model": "{{openAI_0.data.instance}}" + }, + "outputAnchors": [ + { + "id": "mrklAgentLLM_0-output-mrklAgentLLM-AgentExecutor|BaseChain|BaseLangChain", + "name": "mrklAgentLLM", + "label": "AgentExecutor", + "type": "AgentExecutor | BaseChain | BaseLangChain" + } + ], + "outputs": {}, + "selected": false + }, + "positionAbsolute": { + "x": 1002.5779315680477, + "y": 329.9701389591812 + }, + "selected": false + }, + { + "width": 300, + "height": 523, "id": "openAI_0", "position": { - "x": 547.3867724775708, - "y": 394.1919189424442 + "x": 550.5957793208096, + "y": 378.30370661617934 }, "type": "customNode", "data": { "id": "openAI_0", "label": "OpenAI", "name": "openAI", + "version": 1, "type": "OpenAI", - "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel", "BaseLangChain"], + "baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"], "category": "LLMs", "description": "Wrapper around OpenAI large language models", "inputParams": [ { - "label": "OpenAI Api Key", - "name": "openAIApiKey", - "type": "password", - "id": "openAI_0-input-openAIApiKey-password" + "label": "Connect Credential", + "name": "credential", + "type": "credential", + "credentialNames": ["openAIApi"], + "id": "openAI_0-input-credential-credential" }, { "label": "Model Name", @@ -179,14 +237,15 @@ "frequencyPenalty": "", "presencePenalty": "", "batchSize": "", - "timeout": "" + "timeout": "", + "basepath": "" }, "outputAnchors": [ { - "id": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "id": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", "name": "openAI", "label": "OpenAI", - "type": "OpenAI | BaseLLM | BaseLanguageModel | BaseLangChain" + "type": "OpenAI | BaseLLM | BaseLanguageModel" } ], "outputs": {}, @@ -194,64 +253,10 @@ }, "selected": false, "positionAbsolute": { - "x": 547.3867724775708, - "y": 394.1919189424442 + "x": 550.5957793208096, + "y": 378.30370661617934 }, "dragging": false - }, - { - "width": 300, - "height": 280, - "id": "mrklAgentLLM_0", - "position": { - "x": 1002.5779315680477, - "y": 329.9701389591812 - }, - "type": "customNode", - "data": { - "id": "mrklAgentLLM_0", - "label": "MRKL Agent for LLMs", - "name": "mrklAgentLLM", - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain", "BaseLangChain"], - "category": "Agents", - "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with LLMs", - "inputParams": [], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "mrklAgentLLM_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "mrklAgentLLM_0-input-model-BaseLanguageModel" - } - ], - "inputs": { - "tools": ["{{zapierNLA_0.data.instance}}"], - "model": "{{openAI_0.data.instance}}" - }, - "outputAnchors": [ - { - "id": "mrklAgentLLM_0-output-mrklAgentLLM-AgentExecutor|BaseChain|BaseLangChain", - "name": "mrklAgentLLM", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "positionAbsolute": { - "x": 1002.5779315680477, - "y": 329.9701389591812 - }, - "selected": false } ], "edges": [ @@ -268,11 +273,11 @@ }, { "source": "openAI_0", - "sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain", + "sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel", "target": "mrklAgentLLM_0", "targetHandle": "mrklAgentLLM_0-input-model-BaseLanguageModel", "type": "buttonedge", - "id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel|BaseLangChain-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", + "id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-mrklAgentLLM_0-mrklAgentLLM_0-input-model-BaseLanguageModel", "data": { "label": "" } diff --git a/packages/server/package.json b/packages/server/package.json index dbf2cc91..a8cf1e65 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "flowise", - "version": "1.2.16", + "version": "1.3.1", "description": "Flowiseai Server", "main": "dist/index", "types": "dist/index.d.ts", @@ -48,6 +48,7 @@ "@oclif/core": "^1.13.10", "axios": "^0.27.2", "cors": "^2.8.5", + "crypto-js": "^4.1.1", "dotenv": "^16.0.0", "express": "^4.17.3", "express-basic-auth": "^1.2.1", @@ -65,6 +66,7 @@ }, "devDependencies": { "@types/cors": "^2.8.12", + "@types/crypto-js": "^4.1.1", "@types/multer": "^1.4.7", "concurrently": "^7.1.0", "nodemon": "^2.0.15", diff --git a/packages/server/src/ChildProcess.ts b/packages/server/src/ChildProcess.ts index 2228cda6..2eae90f8 100644 --- a/packages/server/src/ChildProcess.ts +++ b/packages/server/src/ChildProcess.ts @@ -13,6 +13,7 @@ import { DataSource } from 'typeorm' import { ChatFlow } from './entity/ChatFlow' import { ChatMessage } from './entity/ChatMessage' import { Tool } from './entity/Tool' +import { Credential } from './entity/Credential' import logger from './utils/logger' export class ChildProcess { @@ -148,7 +149,7 @@ export class ChildProcess { } /** - * Initalize DB in child process + * Initialize DB in child process * @returns {DataSource} */ async function initDB() { @@ -162,7 +163,7 @@ async function initDB() { type: 'sqlite', database: path.resolve(homePath, 'database.sqlite'), synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -176,7 +177,7 @@ async function initDB() { database: process.env.DATABASE_NAME, charset: 'utf8mb4', synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -189,7 +190,7 @@ async function initDB() { password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE_NAME, synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -199,7 +200,7 @@ async function initDB() { type: 'sqlite', database: path.resolve(homePath, 'database.sqlite'), synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break diff --git a/packages/server/src/DataSource.ts b/packages/server/src/DataSource.ts index 14e22669..b0d56477 100644 --- a/packages/server/src/DataSource.ts +++ b/packages/server/src/DataSource.ts @@ -3,6 +3,7 @@ import path from 'path' import { DataSource } from 'typeorm' import { ChatFlow } from './entity/ChatFlow' import { ChatMessage } from './entity/ChatMessage' +import { Credential } from './entity/Credential' import { Tool } from './entity/Tool' import { getUserHome } from './utils' @@ -18,7 +19,7 @@ export const init = async (): Promise => { type: 'sqlite', database: path.resolve(homePath, 'database.sqlite'), synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -32,7 +33,7 @@ export const init = async (): Promise => { database: process.env.DATABASE_NAME, charset: 'utf8mb4', synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -45,7 +46,7 @@ export const init = async (): Promise => { password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE_NAME, synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break @@ -55,7 +56,7 @@ export const init = async (): Promise => { type: 'sqlite', database: path.resolve(homePath, 'database.sqlite'), synchronize, - entities: [ChatFlow, ChatMessage, Tool], + entities: [ChatFlow, ChatMessage, Tool, Credential], migrations: [] }) break diff --git a/packages/server/src/Interface.ts b/packages/server/src/Interface.ts index 0c630490..49d61036 100644 --- a/packages/server/src/Interface.ts +++ b/packages/server/src/Interface.ts @@ -38,10 +38,23 @@ export interface ITool { createdDate: Date } +export interface ICredential { + id: string + name: string + credentialName: string + encryptedData: string + updatedDate: Date + createdDate: Date +} + export interface IComponentNodes { [key: string]: INode } +export interface IComponentCredentials { + [key: string]: INode +} + export interface IVariableDict { [key: string]: string } @@ -167,3 +180,17 @@ export interface IChildProcessMessage { key: string value?: any } + +export type ICredentialDataDecrypted = ICommonObject + +// Plain credential object sent to server +export interface ICredentialReqBody { + name: string + credentialName: string + plainDataObj: ICredentialDataDecrypted +} + +// Decrypted credential object sent back to client +export interface ICredentialReturnResponse extends ICredential { + plainDataObj: ICredentialDataDecrypted +} diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts index 1ee506ea..62db41ba 100644 --- a/packages/server/src/NodesPool.ts +++ b/packages/server/src/NodesPool.ts @@ -1,17 +1,27 @@ -import { IComponentNodes } from './Interface' - +import { IComponentNodes, IComponentCredentials } from './Interface' import path from 'path' import { Dirent } from 'fs' import { getNodeModulesPackagePath } from './utils' import { promises } from 'fs' +import { ICommonObject } from 'flowise-components' export class NodesPool { componentNodes: IComponentNodes = {} + componentCredentials: IComponentCredentials = {} + private credentialIconPath: ICommonObject = {} /** - * Initialize to get all nodes + * Initialize to get all nodes & credentials */ async initialize() { + await this.initializeNodes() + await this.initializeCrdentials() + } + + /** + * Initialize nodes + */ + private async initializeNodes() { const packagePath = getNodeModulesPackagePath('flowise-components') const nodesPath = path.join(packagePath, 'dist', 'nodes') const nodeFiles = await this.getFiles(nodesPath) @@ -37,6 +47,13 @@ export class NodesPool { filePath.pop() const nodeIconAbsolutePath = `${filePath.join('/')}/${newNodeInstance.icon}` this.componentNodes[newNodeInstance.name].icon = nodeIconAbsolutePath + + // Store icon path for componentCredentials + if (newNodeInstance.credential) { + for (const credName of newNodeInstance.credential.credentialNames) { + this.credentialIconPath[credName] = nodeIconAbsolutePath + } + } } } } @@ -44,12 +61,33 @@ export class NodesPool { ) } + /** + * Initialize credentials + */ + private async initializeCrdentials() { + const packagePath = getNodeModulesPackagePath('flowise-components') + const nodesPath = path.join(packagePath, 'dist', 'credentials') + const nodeFiles = await this.getFiles(nodesPath) + return Promise.all( + nodeFiles.map(async (file) => { + if (file.endsWith('.credential.js')) { + const credentialModule = await require(file) + if (credentialModule.credClass) { + const newCredInstance = new credentialModule.credClass() + newCredInstance.icon = this.credentialIconPath[newCredInstance.name] ?? '' + this.componentCredentials[newCredInstance.name] = newCredInstance + } + } + }) + ) + } + /** * Recursive function to get node files * @param {string} dir * @returns {string[]} */ - async getFiles(dir: string): Promise { + private async getFiles(dir: string): Promise { const dirents = await promises.readdir(dir, { withFileTypes: true }) const files = await Promise.all( dirents.map((dirent: Dirent) => { diff --git a/packages/server/src/commands/start.ts b/packages/server/src/commands/start.ts index d1287d2f..6c6260b6 100644 --- a/packages/server/src/commands/start.ts +++ b/packages/server/src/commands/start.ts @@ -19,8 +19,10 @@ export default class Start extends Command { FLOWISE_USERNAME: Flags.string(), FLOWISE_PASSWORD: Flags.string(), PORT: Flags.string(), + PASSPHRASE: Flags.string(), DEBUG: Flags.string(), APIKEY_PATH: Flags.string(), + SECRETKEY_PATH: Flags.string(), LOG_PATH: Flags.string(), LOG_LEVEL: Flags.string(), EXECUTION_MODE: Flags.string(), @@ -65,14 +67,25 @@ export default class Start extends Command { }) const { flags } = await this.parse(Start) - if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME - if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD + if (flags.PORT) process.env.PORT = flags.PORT - if (flags.APIKEY_PATH) process.env.APIKEY_PATH = flags.APIKEY_PATH - if (flags.LOG_PATH) process.env.LOG_PATH = flags.LOG_PATH - if (flags.LOG_LEVEL) process.env.LOG_LEVEL = flags.LOG_LEVEL if (flags.EXECUTION_MODE) process.env.EXECUTION_MODE = flags.EXECUTION_MODE if (flags.DEBUG) process.env.DEBUG = flags.DEBUG + + // Authorization + if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME + if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD + if (flags.APIKEY_PATH) process.env.APIKEY_PATH = flags.APIKEY_PATH + + // Credentials + if (flags.PASSPHRASE) process.env.PASSPHRASE = flags.PASSPHRASE + if (flags.SECRETKEY_PATH) process.env.SECRETKEY_PATH = flags.SECRETKEY_PATH + + // Logs + if (flags.LOG_PATH) process.env.LOG_PATH = flags.LOG_PATH + if (flags.LOG_LEVEL) process.env.LOG_LEVEL = flags.LOG_LEVEL + + // Tool functions if (flags.TOOL_FUNCTION_BUILTIN_DEP) process.env.TOOL_FUNCTION_BUILTIN_DEP = flags.TOOL_FUNCTION_BUILTIN_DEP if (flags.TOOL_FUNCTION_EXTERNAL_DEP) process.env.TOOL_FUNCTION_EXTERNAL_DEP = flags.TOOL_FUNCTION_EXTERNAL_DEP diff --git a/packages/server/src/entity/ChatFlow.ts b/packages/server/src/entity/ChatFlow.ts index adaf0917..4c37e083 100644 --- a/packages/server/src/entity/ChatFlow.ts +++ b/packages/server/src/entity/ChatFlow.ts @@ -10,7 +10,7 @@ export class ChatFlow implements IChatFlow { @Column() name: string - @Column({ type: "text" }) + @Column({ type: 'text' }) flowData: string @Column({ nullable: true }) diff --git a/packages/server/src/entity/ChatMessage.ts b/packages/server/src/entity/ChatMessage.ts index 46972f6a..8123020c 100644 --- a/packages/server/src/entity/ChatMessage.ts +++ b/packages/server/src/entity/ChatMessage.ts @@ -14,7 +14,7 @@ export class ChatMessage implements IChatMessage { @Column() chatflowid: string - @Column({ type: "text" }) + @Column({ type: 'text' }) content: string @Column({ nullable: true }) diff --git a/packages/server/src/entity/Credential.ts b/packages/server/src/entity/Credential.ts new file mode 100644 index 00000000..b724eed6 --- /dev/null +++ b/packages/server/src/entity/Credential.ts @@ -0,0 +1,24 @@ +/* eslint-disable */ +import { Entity, Column, PrimaryGeneratedColumn, Index, CreateDateColumn, UpdateDateColumn } from 'typeorm' +import { ICredential } from '../Interface' + +@Entity() +export class Credential implements ICredential { + @PrimaryGeneratedColumn('uuid') + id: string + + @Column() + name: string + + @Column() + credentialName: string + + @Column() + encryptedData: string + + @CreateDateColumn() + createdDate: Date + + @UpdateDateColumn() + updatedDate: Date +} diff --git a/packages/server/src/entity/Tool.ts b/packages/server/src/entity/Tool.ts index 4fc89519..011bf957 100644 --- a/packages/server/src/entity/Tool.ts +++ b/packages/server/src/entity/Tool.ts @@ -10,7 +10,7 @@ export class Tool implements ITool { @Column() name: string - @Column({ type: "text" }) + @Column({ type: 'text' }) description: string @Column() diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 6746278e..34357ea9 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -17,7 +17,8 @@ import { INodeData, IDatabaseExport, IRunChatflowMessageValue, - IChildProcessMessage + IChildProcessMessage, + ICredentialReturnResponse } from './Interface' import { getNodeModulesPackagePath, @@ -40,18 +41,22 @@ import { isVectorStoreFaiss, databaseEntities, getApiKey, + transformToCredentialEntity, + decryptCredentialData, clearSessionMemory, - replaceInputsWithConfig + replaceInputsWithConfig, + getEncryptionKey } from './utils' -import { cloneDeep } from 'lodash' +import { cloneDeep, omit } from 'lodash' import { getDataSource } from './DataSource' import { NodesPool } from './NodesPool' import { ChatFlow } from './entity/ChatFlow' import { ChatMessage } from './entity/ChatMessage' +import { Credential } from './entity/Credential' +import { Tool } from './entity/Tool' import { ChatflowPool } from './ChatflowPool' import { ICommonObject, INodeOptionsValue } from 'flowise-components' import { fork } from 'child_process' -import { Tool } from './entity/Tool' export class App { app: express.Application @@ -69,14 +74,18 @@ export class App { .then(async () => { logger.info('📦 [server]: Data Source has been initialized!') - // Initialize pools + // Initialize nodes pool this.nodesPool = new NodesPool() await this.nodesPool.initialize() + // Initialize chatflow pool this.chatflowPool = new ChatflowPool() // Initialize API keys await getAPIKeys() + + // Initialize encryption key + await getEncryptionKey() }) .catch((err) => { logger.error('❌ [server]: Error during Data Source initialization:', err) @@ -106,6 +115,7 @@ export class App { '/api/v1/public-chatflows', '/api/v1/prediction/', '/api/v1/node-icon/', + '/api/v1/components-credentials-icon/', '/api/v1/chatflows-streaming' ] this.app.use((req, res, next) => { @@ -118,7 +128,7 @@ export class App { const upload = multer({ dest: `${path.join(__dirname, '..', 'uploads')}/` }) // ---------------------------------------- - // Nodes + // Components // ---------------------------------------- // Get all component nodes @@ -131,6 +141,16 @@ export class App { return res.json(returnData) }) + // Get all component credentials + this.app.get('/api/v1/components-credentials', async (req: Request, res: Response) => { + const returnData = [] + for (const credName in this.nodesPool.componentCredentials) { + const clonedCred = cloneDeep(this.nodesPool.componentCredentials[credName]) + returnData.push(clonedCred) + } + return res.json(returnData) + }) + // Get specific component node via name this.app.get('/api/v1/nodes/:name', (req: Request, res: Response) => { if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentNodes, req.params.name)) { @@ -140,6 +160,27 @@ export class App { } }) + // Get component credential via name + this.app.get('/api/v1/components-credentials/:name', (req: Request, res: Response) => { + if (!req.params.name.includes('&')) { + if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentCredentials, req.params.name)) { + return res.json(this.nodesPool.componentCredentials[req.params.name]) + } else { + throw new Error(`Credential ${req.params.name} not found`) + } + } else { + const returnResponse = [] + for (const name of req.params.name.split('&')) { + if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentCredentials, name)) { + returnResponse.push(this.nodesPool.componentCredentials[name]) + } else { + throw new Error(`Credential ${name} not found`) + } + } + return res.json(returnResponse) + } + }) + // Returns specific component node icon via name this.app.get('/api/v1/node-icon/:name', (req: Request, res: Response) => { if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentNodes, req.params.name)) { @@ -159,6 +200,25 @@ export class App { } }) + // Returns specific component credential icon via name + this.app.get('/api/v1/components-credentials-icon/:name', (req: Request, res: Response) => { + if (Object.prototype.hasOwnProperty.call(this.nodesPool.componentCredentials, req.params.name)) { + const credInstance = this.nodesPool.componentCredentials[req.params.name] + if (credInstance.icon === undefined) { + throw new Error(`Credential ${req.params.name} icon not found`) + } + + if (credInstance.icon.endsWith('.svg') || credInstance.icon.endsWith('.png') || credInstance.icon.endsWith('.jpg')) { + const filepath = credInstance.icon + res.sendFile(filepath) + } else { + throw new Error(`Credential ${req.params.name} icon is missing icon`) + } + } else { + throw new Error(`Credential ${req.params.name} not found`) + } + }) + // load async options this.app.post('/api/v1/node-load-method/:name', async (req: Request, res: Response) => { const nodeData: INodeData = req.body @@ -350,6 +410,91 @@ export class App { return res.json(results) }) + // ---------------------------------------- + // Credentials + // ---------------------------------------- + + // Create new credential + this.app.post('/api/v1/credentials', async (req: Request, res: Response) => { + const body = req.body + const newCredential = await transformToCredentialEntity(body) + const credential = this.AppDataSource.getRepository(Credential).create(newCredential) + const results = await this.AppDataSource.getRepository(Credential).save(credential) + return res.json(results) + }) + + // Get all credentials + this.app.get('/api/v1/credentials', async (req: Request, res: Response) => { + if (req.query.credentialName) { + let returnCredentials = [] + if (Array.isArray(req.query.credentialName)) { + for (let i = 0; i < req.query.credentialName.length; i += 1) { + const name = req.query.credentialName[i] as string + const credentials = await this.AppDataSource.getRepository(Credential).findBy({ + credentialName: name + }) + returnCredentials.push(...credentials) + } + } else { + const credentials = await this.AppDataSource.getRepository(Credential).findBy({ + credentialName: req.query.credentialName as string + }) + returnCredentials = [...credentials] + } + return res.json(returnCredentials) + } else { + const credentials = await this.AppDataSource.getRepository(Credential).find() + const returnCredentials = [] + for (const credential of credentials) { + returnCredentials.push(omit(credential, ['encryptedData'])) + } + return res.json(returnCredentials) + } + }) + + // Get specific credential + this.app.get('/api/v1/credentials/:id', async (req: Request, res: Response) => { + const credential = await this.AppDataSource.getRepository(Credential).findOneBy({ + id: req.params.id + }) + + if (!credential) return res.status(404).send(`Credential ${req.params.id} not found`) + + // Decrpyt credentialData + const decryptedCredentialData = await decryptCredentialData( + credential.encryptedData, + credential.credentialName, + this.nodesPool.componentCredentials + ) + const returnCredential: ICredentialReturnResponse = { + ...credential, + plainDataObj: decryptedCredentialData + } + return res.json(omit(returnCredential, ['encryptedData'])) + }) + + // Update credential + this.app.put('/api/v1/credentials/:id', async (req: Request, res: Response) => { + const credential = await this.AppDataSource.getRepository(Credential).findOneBy({ + id: req.params.id + }) + + if (!credential) return res.status(404).send(`Credential ${req.params.id} not found`) + + const body = req.body + const updateCredential = await transformToCredentialEntity(body) + this.AppDataSource.getRepository(Credential).merge(credential, updateCredential) + const result = await this.AppDataSource.getRepository(Credential).save(credential) + + return res.json(result) + }) + + // Delete all chatmessages from chatflowid + this.app.delete('/api/v1/credentials/:id', async (req: Request, res: Response) => { + const results = await this.AppDataSource.getRepository(Credential).delete({ id: req.params.id }) + return res.json(results) + }) + // ---------------------------------------- // Tools // ---------------------------------------- @@ -419,7 +564,13 @@ export class App { const flowData = chatflow.flowData const parsedFlowData: IReactFlowObject = JSON.parse(flowData) const nodes = parsedFlowData.nodes - const availableConfigs = findAvailableConfigs(nodes) + const availableConfigs = findAvailableConfigs(nodes, this.nodesPool.componentCredentials) + return res.json(availableConfigs) + }) + + this.app.post('/api/v1/node-config', async (req: Request, res: Response) => { + const nodes = [{ data: req.body }] as IReactFlowNode[] + const availableConfigs = findAvailableConfigs(nodes, this.nodesPool.componentCredentials) return res.json(availableConfigs) }) @@ -509,6 +660,8 @@ export class App { } templates.push(template) }) + const FlowiseDocsQnA = templates.find((tmp) => tmp.name === 'Flowise Docs QnA') + if (FlowiseDocsQnA) templates.unshift(FlowiseDocsQnA) return res.json(templates) }) diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index 4519a52e..f92cc6dc 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -13,18 +13,26 @@ import { IReactFlowNode, IVariableDict, INodeData, - IOverrideConfig + IOverrideConfig, + ICredentialDataDecrypted, + IComponentCredentials, + ICredentialReqBody } from '../Interface' import { cloneDeep, get, omit, merge } from 'lodash' import { ICommonObject, getInputVariables, IDatabaseEntity, handleEscapeCharacters } from 'flowise-components' import { scryptSync, randomBytes, timingSafeEqual } from 'crypto' +import { lib, PBKDF2, AES, enc } from 'crypto-js' + import { ChatFlow } from '../entity/ChatFlow' import { ChatMessage } from '../entity/ChatMessage' +import { Credential } from '../entity/Credential' import { Tool } from '../entity/Tool' import { DataSource } from 'typeorm' const QUESTION_VAR_PREFIX = 'question' -export const databaseEntities: IDatabaseEntity = { ChatFlow: ChatFlow, ChatMessage: ChatMessage, Tool: Tool } +const REDACTED_CREDENTIAL_VALUE = '_FLOWISE_BLANK_07167752-1a71-43b1-bf8f-4f32252165db' + +export const databaseEntities: IDatabaseEntity = { ChatFlow: ChatFlow, ChatMessage: ChatMessage, Tool: Tool, Credential: Credential } /** * Returns the home folder path of the user if @@ -660,11 +668,12 @@ export const mapMimeTypeToInputField = (mimeType: string) => { } /** - * Find all available inpur params config + * Find all available input params config * @param {IReactFlowNode[]} reactFlowNodes - * @returns {Promise} + * @param {IComponentCredentials} componentCredentials + * @returns {IOverrideConfig[]} */ -export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[]) => { +export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], componentCredentials: IComponentCredentials) => { const configs: IOverrideConfig[] = [] for (const flowNode of reactFlowNodes) { @@ -690,6 +699,23 @@ export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[]) => { .join(', ') : 'string' } + } else if (inputParam.type === 'credential') { + // get component credential inputs + for (const name of inputParam.credentialNames ?? []) { + if (Object.prototype.hasOwnProperty.call(componentCredentials, name)) { + const inputs = componentCredentials[name]?.inputs ?? [] + for (const input of inputs) { + obj = { + node: flowNode.data.label, + label: input.label, + name: input.name, + type: input.type === 'password' ? 'string' : input.type + } + configs.push(obj) + } + } + } + continue } else { obj = { node: flowNode.data.label, @@ -742,3 +768,118 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod return isChatOrLLMsExist && isValidChainOrAgent && !isVectorStoreFaiss(endingNodeData) && process.env.EXECUTION_MODE !== 'child' } + +/** + * Returns the path of encryption key + * @returns {string} + */ +export const getEncryptionKeyPath = (): string => { + return process.env.SECRETKEY_PATH + ? path.join(process.env.SECRETKEY_PATH, 'encryption.key') + : path.join(__dirname, '..', '..', 'encryption.key') +} + +/** + * Generate an encryption key + * @returns {string} + */ +export const generateEncryptKey = (): string => { + const salt = lib.WordArray.random(128 / 8) + const key256Bits = PBKDF2(process.env.PASSPHRASE || 'MYPASSPHRASE', salt, { + keySize: 256 / 32, + iterations: 1000 + }) + return key256Bits.toString() +} + +/** + * Returns the encryption key + * @returns {Promise} + */ +export const getEncryptionKey = async (): Promise => { + try { + return await fs.promises.readFile(getEncryptionKeyPath(), 'utf8') + } catch (error) { + const encryptKey = generateEncryptKey() + await fs.promises.writeFile(getEncryptionKeyPath(), encryptKey) + return encryptKey + } +} + +/** + * Encrypt credential data + * @param {ICredentialDataDecrypted} plainDataObj + * @returns {Promise} + */ +export const encryptCredentialData = async (plainDataObj: ICredentialDataDecrypted): Promise => { + const encryptKey = await getEncryptionKey() + return AES.encrypt(JSON.stringify(plainDataObj), encryptKey).toString() +} + +/** + * Decrypt credential data + * @param {string} encryptedData + * @param {string} componentCredentialName + * @param {IComponentCredentials} componentCredentials + * @returns {Promise} + */ +export const decryptCredentialData = async ( + encryptedData: string, + componentCredentialName?: string, + componentCredentials?: IComponentCredentials +): Promise => { + const encryptKey = await getEncryptionKey() + const decryptedData = AES.decrypt(encryptedData, encryptKey) + try { + if (componentCredentialName && componentCredentials) { + const plainDataObj = JSON.parse(decryptedData.toString(enc.Utf8)) + return redactCredentialWithPasswordType(componentCredentialName, plainDataObj, componentCredentials) + } + return JSON.parse(decryptedData.toString(enc.Utf8)) + } catch (e) { + console.error(e) + throw new Error('Credentials could not be decrypted.') + } +} + +/** + * Transform ICredentialBody from req to Credential entity + * @param {ICredentialReqBody} body + * @returns {Credential} + */ +export const transformToCredentialEntity = async (body: ICredentialReqBody): Promise => { + const encryptedData = await encryptCredentialData(body.plainDataObj) + + const credentialBody = { + name: body.name, + credentialName: body.credentialName, + encryptedData + } + + const newCredential = new Credential() + Object.assign(newCredential, credentialBody) + + return newCredential +} + +/** + * Redact values that are of password type to avoid sending back to client + * @param {string} componentCredentialName + * @param {ICredentialDataDecrypted} decryptedCredentialObj + * @param {IComponentCredentials} componentCredentials + * @returns {ICredentialDataDecrypted} + */ +export const redactCredentialWithPasswordType = ( + componentCredentialName: string, + decryptedCredentialObj: ICredentialDataDecrypted, + componentCredentials: IComponentCredentials +): ICredentialDataDecrypted => { + const plainDataObj = cloneDeep(decryptedCredentialObj) + for (const cred in plainDataObj) { + const inputParam = componentCredentials[componentCredentialName].inputs?.find((inp) => inp.type === 'password' && inp.name === cred) + if (inputParam) { + plainDataObj[cred] = REDACTED_CREDENTIAL_VALUE + } + } + return plainDataObj +} diff --git a/packages/server/src/utils/logger.ts b/packages/server/src/utils/logger.ts index 57d5f64a..839f1ad7 100644 --- a/packages/server/src/utils/logger.ts +++ b/packages/server/src/utils/logger.ts @@ -85,7 +85,8 @@ export function expressRequestLogger(req: Request, res: Response, next: NextFunc GET: '⬇️', POST: '⬆️', PUT: '🖊', - DELETE: '❌' + DELETE: '❌', + OPTION: '🔗' } return requetsEmojis[method] || '?' diff --git a/packages/ui/package.json b/packages/ui/package.json index bdb49846..a2eeec6f 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "flowise-ui", - "version": "1.2.15", + "version": "1.3.0", "license": "SEE LICENSE IN LICENSE.md", "homepage": "https://flowiseai.com", "author": { diff --git a/packages/ui/src/api/config.js b/packages/ui/src/api/config.js index 0fb8297d..47ee51a0 100644 --- a/packages/ui/src/api/config.js +++ b/packages/ui/src/api/config.js @@ -1,7 +1,9 @@ import client from './client' const getConfig = (id) => client.get(`/flow-config/${id}`) +const getNodeConfig = (body) => client.post(`/node-config`, body) export default { - getConfig + getConfig, + getNodeConfig } diff --git a/packages/ui/src/api/credentials.js b/packages/ui/src/api/credentials.js new file mode 100644 index 00000000..9dbdcf7a --- /dev/null +++ b/packages/ui/src/api/credentials.js @@ -0,0 +1,28 @@ +import client from './client' + +const getAllCredentials = () => client.get('/credentials') + +const getCredentialsByName = (componentCredentialName) => client.get(`/credentials?credentialName=${componentCredentialName}`) + +const getAllComponentsCredentials = () => client.get('/components-credentials') + +const getSpecificCredential = (id) => client.get(`/credentials/${id}`) + +const getSpecificComponentCredential = (name) => client.get(`/components-credentials/${name}`) + +const createCredential = (body) => client.post(`/credentials`, body) + +const updateCredential = (id, body) => client.put(`/credentials/${id}`, body) + +const deleteCredential = (id) => client.delete(`/credentials/${id}`) + +export default { + getAllCredentials, + getCredentialsByName, + getAllComponentsCredentials, + getSpecificCredential, + getSpecificComponentCredential, + createCredential, + updateCredential, + deleteCredential +} diff --git a/packages/ui/src/assets/images/account.png b/packages/ui/src/assets/images/account.png new file mode 100644 index 00000000..a758a1db Binary files /dev/null and b/packages/ui/src/assets/images/account.png differ diff --git a/packages/ui/src/assets/images/credential_empty.svg b/packages/ui/src/assets/images/credential_empty.svg new file mode 100644 index 00000000..0951ee07 --- /dev/null +++ b/packages/ui/src/assets/images/credential_empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/ui/src/assets/images/robot.png b/packages/ui/src/assets/images/robot.png new file mode 100644 index 00000000..d4fe920a Binary files /dev/null and b/packages/ui/src/assets/images/robot.png differ diff --git a/packages/ui/src/menu-items/dashboard.js b/packages/ui/src/menu-items/dashboard.js index 948b4e4a..87ef88f9 100644 --- a/packages/ui/src/menu-items/dashboard.js +++ b/packages/ui/src/menu-items/dashboard.js @@ -1,8 +1,8 @@ // assets -import { IconHierarchy, IconBuildingStore, IconKey, IconTool } from '@tabler/icons' +import { IconHierarchy, IconBuildingStore, IconKey, IconTool, IconLock } from '@tabler/icons' // constant -const icons = { IconHierarchy, IconBuildingStore, IconKey, IconTool } +const icons = { IconHierarchy, IconBuildingStore, IconKey, IconTool, IconLock } // ==============================|| DASHBOARD MENU ITEMS ||============================== // @@ -35,6 +35,14 @@ const dashboard = { icon: icons.IconTool, breadcrumbs: true }, + { + id: 'credentials', + title: 'Credentials', + type: 'item', + url: '/credentials', + icon: icons.IconLock, + breadcrumbs: true + }, { id: 'apikey', title: 'API Keys', diff --git a/packages/ui/src/routes/MainRoutes.js b/packages/ui/src/routes/MainRoutes.js index 28e60287..9a1c29af 100644 --- a/packages/ui/src/routes/MainRoutes.js +++ b/packages/ui/src/routes/MainRoutes.js @@ -13,9 +13,12 @@ const Marketplaces = Loadable(lazy(() => import('views/marketplaces'))) // apikey routing const APIKey = Loadable(lazy(() => import('views/apikey'))) -// apikey routing +// tools routing const Tools = Loadable(lazy(() => import('views/tools'))) +// credentials routing +const Credentials = Loadable(lazy(() => import('views/credentials'))) + // ==============================|| MAIN ROUTING ||============================== // const MainRoutes = { @@ -41,6 +44,10 @@ const MainRoutes = { { path: '/tools', element: + }, + { + path: '/credentials', + element: } ] } diff --git a/packages/ui/src/store/actions.js b/packages/ui/src/store/actions.js index 64be4918..0c68f8f2 100644 --- a/packages/ui/src/store/actions.js +++ b/packages/ui/src/store/actions.js @@ -13,6 +13,8 @@ export const REMOVE_DIRTY = '@canvas/REMOVE_DIRTY' export const SET_CHATFLOW = '@canvas/SET_CHATFLOW' export const SHOW_CANVAS_DIALOG = '@canvas/SHOW_CANVAS_DIALOG' export const HIDE_CANVAS_DIALOG = '@canvas/HIDE_CANVAS_DIALOG' +export const SET_COMPONENT_NODES = '@canvas/SET_COMPONENT_NODES' +export const SET_COMPONENT_CREDENTIALS = '@canvas/SET_COMPONENT_CREDENTIALS' // action - notifier reducer export const ENQUEUE_SNACKBAR = 'ENQUEUE_SNACKBAR' diff --git a/packages/ui/src/store/constant.js b/packages/ui/src/store/constant.js index c3138257..c0fce49d 100644 --- a/packages/ui/src/store/constant.js +++ b/packages/ui/src/store/constant.js @@ -5,3 +5,4 @@ export const appDrawerWidth = 320 export const maxScroll = 100000 export const baseURL = process.env.NODE_ENV === 'production' ? window.location.origin : window.location.origin.replace(':8080', ':3000') export const uiBaseURL = window.location.origin +export const FLOWISE_CREDENTIAL_ID = 'FLOWISE_CREDENTIAL_ID' diff --git a/packages/ui/src/store/context/ReactFlowContext.js b/packages/ui/src/store/context/ReactFlowContext.js index 4c35d702..055cb8bc 100644 --- a/packages/ui/src/store/context/ReactFlowContext.js +++ b/packages/ui/src/store/context/ReactFlowContext.js @@ -1,7 +1,9 @@ import { createContext, useState } from 'react' +import { useDispatch } from 'react-redux' import PropTypes from 'prop-types' import { getUniqueNodeId } from 'utils/genericHelper' import { cloneDeep } from 'lodash' +import { SET_DIRTY } from 'store/actions' const initialValue = { reactFlowInstance: null, @@ -14,17 +16,20 @@ const initialValue = { export const flowContext = createContext(initialValue) export const ReactFlowContext = ({ children }) => { + const dispatch = useDispatch() const [reactFlowInstance, setReactFlowInstance] = useState(null) const deleteNode = (nodeid) => { deleteConnectedInput(nodeid, 'node') reactFlowInstance.setNodes(reactFlowInstance.getNodes().filter((n) => n.id !== nodeid)) reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((ns) => ns.source !== nodeid && ns.target !== nodeid)) + dispatch({ type: SET_DIRTY }) } const deleteEdge = (edgeid) => { deleteConnectedInput(edgeid, 'edge') reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((edge) => edge.id !== edgeid)) + dispatch({ type: SET_DIRTY }) } const deleteConnectedInput = (id, type) => { @@ -103,6 +108,7 @@ export const ReactFlowContext = ({ children }) => { } reactFlowInstance.setNodes([...nodes, duplicatedNode]) + dispatch({ type: SET_DIRTY }) } } diff --git a/packages/ui/src/store/reducers/canvasReducer.js b/packages/ui/src/store/reducers/canvasReducer.js index 8dfae527..1c5e486f 100644 --- a/packages/ui/src/store/reducers/canvasReducer.js +++ b/packages/ui/src/store/reducers/canvasReducer.js @@ -4,7 +4,9 @@ import * as actionTypes from '../actions' export const initialState = { isDirty: false, chatflow: null, - canvasDialogShow: false + canvasDialogShow: false, + componentNodes: [], + componentCredentials: [] } // ==============================|| CANVAS REDUCER ||============================== // @@ -36,6 +38,16 @@ const canvasReducer = (state = initialState, action) => { ...state, canvasDialogShow: false } + case actionTypes.SET_COMPONENT_NODES: + return { + ...state, + componentNodes: action.componentNodes + } + case actionTypes.SET_COMPONENT_CREDENTIALS: + return { + ...state, + componentCredentials: action.componentCredentials + } default: return state } diff --git a/packages/ui/src/themes/palette.js b/packages/ui/src/themes/palette.js index 9e7b7620..19a7df11 100644 --- a/packages/ui/src/themes/palette.js +++ b/packages/ui/src/themes/palette.js @@ -90,6 +90,10 @@ export default function themePalette(theme) { }, codeEditor: { main: theme.customization.isDarkMode ? theme.colors?.darkPrimary800 : theme.colors?.primaryLight + }, + nodeToolTip: { + background: theme.customization.isDarkMode ? theme.colors?.darkPrimary800 : theme.colors?.paper, + color: theme.customization.isDarkMode ? theme.colors?.paper : 'rgba(0, 0, 0, 0.87)' } } } diff --git a/packages/ui/src/ui-component/dialog/AdditionalParamsDialog.js b/packages/ui/src/ui-component/dialog/AdditionalParamsDialog.js index 364706f4..7cf9b3b7 100644 --- a/packages/ui/src/ui-component/dialog/AdditionalParamsDialog.js +++ b/packages/ui/src/ui-component/dialog/AdditionalParamsDialog.js @@ -27,6 +27,7 @@ const AdditionalParamsDialog = ({ show, dialogProps, onCancel }) => { useEffect(() => { if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) }, [show, dispatch]) const component = show ? ( diff --git a/packages/ui/src/ui-component/dialog/ExpandTextDialog.js b/packages/ui/src/ui-component/dialog/ExpandTextDialog.js index 50f506fd..2a4ec4f5 100644 --- a/packages/ui/src/ui-component/dialog/ExpandTextDialog.js +++ b/packages/ui/src/ui-component/dialog/ExpandTextDialog.js @@ -36,6 +36,7 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => { useEffect(() => { if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) }, [show, dispatch]) const component = show ? ( diff --git a/packages/ui/src/ui-component/dialog/FormatPromptValuesDialog.js b/packages/ui/src/ui-component/dialog/FormatPromptValuesDialog.js index 95f833c9..233f0762 100644 --- a/packages/ui/src/ui-component/dialog/FormatPromptValuesDialog.js +++ b/packages/ui/src/ui-component/dialog/FormatPromptValuesDialog.js @@ -15,6 +15,7 @@ const FormatPromptValuesDialog = ({ show, dialogProps, onChange, onCancel }) => useEffect(() => { if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) }, [show, dispatch]) const component = show ? ( diff --git a/packages/ui/src/ui-component/dialog/NodeInfoDialog.js b/packages/ui/src/ui-component/dialog/NodeInfoDialog.js new file mode 100644 index 00000000..054353fc --- /dev/null +++ b/packages/ui/src/ui-component/dialog/NodeInfoDialog.js @@ -0,0 +1,141 @@ +import { createPortal } from 'react-dom' +import { useDispatch } from 'react-redux' +import { useEffect } from 'react' +import PropTypes from 'prop-types' + +// Material +import { Dialog, DialogContent, DialogTitle } from '@mui/material' +import { TableViewOnly } from 'ui-component/table/Table' + +// Store +import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' +import { baseURL } from 'store/constant' + +// API +import configApi from 'api/config' +import useApi from 'hooks/useApi' + +const NodeInfoDialog = ({ show, dialogProps, onCancel }) => { + const portalElement = document.getElementById('portal') + const dispatch = useDispatch() + + const getNodeConfigApi = useApi(configApi.getNodeConfig) + + useEffect(() => { + if (dialogProps.data) { + getNodeConfigApi.request(dialogProps.data) + } + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [dialogProps]) + + useEffect(() => { + if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) + else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) + }, [show, dispatch]) + + const component = show ? ( + + + {dialogProps.data && dialogProps.data.name && dialogProps.data.label && ( +
+
+ {dialogProps.data.name} +
+
+ {dialogProps.data.label} +
+
+ {dialogProps.data.id} +
+ {dialogProps.data.version && ( +
+ version {dialogProps.data.version} +
+ )} +
+
+
+ )} +
+ + {dialogProps.data?.description && ( +
+ {dialogProps.data.description} +
+ )} + {getNodeConfigApi.data && getNodeConfigApi.data.length > 0 && ( + + )} +
+
+ ) : null + + return createPortal(component, portalElement) +} + +NodeInfoDialog.propTypes = { + show: PropTypes.bool, + dialogProps: PropTypes.object, + onCancel: PropTypes.func +} + +export default NodeInfoDialog diff --git a/packages/ui/src/ui-component/dropdown/AsyncDropdown.js b/packages/ui/src/ui-component/dropdown/AsyncDropdown.js index 8dfd782d..b24fa02b 100644 --- a/packages/ui/src/ui-component/dropdown/AsyncDropdown.js +++ b/packages/ui/src/ui-component/dropdown/AsyncDropdown.js @@ -1,13 +1,17 @@ import { useState, useEffect, Fragment } from 'react' import { useSelector } from 'react-redux' - import PropTypes from 'prop-types' import axios from 'axios' +// Material import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete' import { Popper, CircularProgress, TextField, Box, Typography } from '@mui/material' import { styled } from '@mui/material/styles' +// API +import credentialsApi from 'api/credentials' + +// const import { baseURL } from 'store/constant' const StyledPopper = styled(Popper)({ @@ -49,6 +53,7 @@ export const AsyncDropdown = ({ onSelect, isCreateNewOption, onCreateNew, + credentialNames = [], disabled = false, disableClearable = false }) => { @@ -62,11 +67,36 @@ export const AsyncDropdown = ({ const addNewOption = [{ label: '- Create New -', name: '-create-' }] let [internalValue, setInternalValue] = useState(value ?? 'choose an option') + const fetchCredentialList = async () => { + try { + let names = '' + if (credentialNames.length > 1) { + names = credentialNames.join('&credentialName=') + } else { + names = credentialNames[0] + } + const resp = await credentialsApi.getCredentialsByName(names) + if (resp.data) { + const returnList = [] + for (let i = 0; i < resp.data.length; i += 1) { + const data = { + label: resp.data[i].name, + name: resp.data[i].id + } + returnList.push(data) + } + return returnList + } + } catch (error) { + console.error(error) + } + } + useEffect(() => { setLoading(true) ;(async () => { const fetchData = async () => { - let response = await fetchList({ name, nodeData }) + let response = credentialNames.length ? await fetchCredentialList() : await fetchList({ name, nodeData }) if (isCreateNewOption) setOptions([...response, ...addNewOption]) else setOptions([...response]) setLoading(false) @@ -142,6 +172,7 @@ AsyncDropdown.propTypes = { onSelect: PropTypes.func, onCreateNew: PropTypes.func, disabled: PropTypes.bool, + credentialNames: PropTypes.array, disableClearable: PropTypes.bool, isCreateNewOption: PropTypes.bool } diff --git a/packages/ui/src/ui-component/input/Input.js b/packages/ui/src/ui-component/input/Input.js index b7e161db..95bf968d 100644 --- a/packages/ui/src/ui-component/input/Input.js +++ b/packages/ui/src/ui-component/input/Input.js @@ -37,7 +37,7 @@ export const Input = ({ inputParam, value, onChange, disabled = false, showDialo onChange(e.target.value) }} inputProps={{ - step: inputParam.step ?? 0.1, + step: inputParam.step ?? 1, style: { height: inputParam.rows ? '90px' : 'inherit' } diff --git a/packages/ui/src/utils/genericHelper.js b/packages/ui/src/utils/genericHelper.js index 305326f7..7bf8998e 100644 --- a/packages/ui/src/utils/genericHelper.js +++ b/packages/ui/src/utils/genericHelper.js @@ -41,6 +41,7 @@ export const initNode = (nodeData, newNodeId) => { const whitelistTypes = ['asyncOptions', 'options', 'string', 'number', 'boolean', 'password', 'json', 'code', 'date', 'file', 'folder'] + // Inputs for (let i = 0; i < incoming; i += 1) { const newInput = { ...nodeData.inputs[i], @@ -53,6 +54,16 @@ export const initNode = (nodeData, newNodeId) => { } } + // Credential + if (nodeData.credential) { + const newInput = { + ...nodeData.credential, + id: `${newNodeId}-input-${nodeData.credential.name}-${nodeData.credential.type}` + } + inputParams.unshift(newInput) + } + + // Outputs const outputAnchors = [] for (let i = 0; i < outgoing; i += 1) { if (nodeData.outputs && nodeData.outputs.length) { @@ -129,6 +140,8 @@ export const initNode = (nodeData, newNodeId) => { } ] */ + + // Inputs if (nodeData.inputs) { nodeData.inputAnchors = inputAnchors nodeData.inputParams = inputParams @@ -139,13 +152,17 @@ export const initNode = (nodeData, newNodeId) => { nodeData.inputs = {} } + // Outputs if (nodeData.outputs) { nodeData.outputs = initializeDefaultNodeData(outputAnchors) } else { nodeData.outputs = {} } - nodeData.outputAnchors = outputAnchors + + // Credential + if (nodeData.credential) nodeData.credential = '' + nodeData.id = newNodeId return nodeData @@ -251,6 +268,7 @@ export const generateExportFlowData = (flowData) => { const newNodeData = { id: node.data.id, label: node.data.label, + version: node.data.version, name: node.data.name, type: node.data.type, baseClasses: node.data.baseClasses, diff --git a/packages/ui/src/views/canvas/AddNodes.js b/packages/ui/src/views/canvas/AddNodes.js index 810fc53f..c6134cb9 100644 --- a/packages/ui/src/views/canvas/AddNodes.js +++ b/packages/ui/src/views/canvas/AddNodes.js @@ -1,5 +1,5 @@ import { useState, useRef, useEffect } from 'react' -import { useSelector } from 'react-redux' +import { useSelector, useDispatch } from 'react-redux' import PropTypes from 'prop-types' // material-ui @@ -38,12 +38,14 @@ import { IconPlus, IconSearch, IconMinus, IconX } from '@tabler/icons' // const import { baseURL } from 'store/constant' +import { SET_COMPONENT_NODES } from 'store/actions' // ==============================|| ADD NODES||============================== // const AddNodes = ({ nodesData, node }) => { const theme = useTheme() const customization = useSelector((state) => state.customization) + const dispatch = useDispatch() const [searchValue, setSearchValue] = useState('') const [nodes, setNodes] = useState({}) @@ -131,8 +133,11 @@ const AddNodes = ({ nodesData, node }) => { }, [node]) useEffect(() => { - if (nodesData) groupByCategory(nodesData) - }, [nodesData]) + if (nodesData) { + groupByCategory(nodesData) + dispatch({ type: SET_COMPONENT_NODES, componentNodes: nodesData }) + } + }, [nodesData, dispatch]) return ( <> diff --git a/packages/ui/src/views/canvas/CanvasNode.js b/packages/ui/src/views/canvas/CanvasNode.js index 9263d4b6..cabe2329 100644 --- a/packages/ui/src/views/canvas/CanvasNode.js +++ b/packages/ui/src/views/canvas/CanvasNode.js @@ -1,19 +1,22 @@ import PropTypes from 'prop-types' -import { useContext, useState } from 'react' +import { useContext, useState, useEffect } from 'react' +import { useSelector } from 'react-redux' // material-ui import { styled, useTheme } from '@mui/material/styles' import { IconButton, Box, Typography, Divider, Button } from '@mui/material' +import Tooltip, { tooltipClasses } from '@mui/material/Tooltip' // project imports import MainCard from 'ui-component/cards/MainCard' import NodeInputHandler from './NodeInputHandler' import NodeOutputHandler from './NodeOutputHandler' import AdditionalParamsDialog from 'ui-component/dialog/AdditionalParamsDialog' +import NodeInfoDialog from 'ui-component/dialog/NodeInfoDialog' // const import { baseURL } from 'store/constant' -import { IconTrash, IconCopy } from '@tabler/icons' +import { IconTrash, IconCopy, IconInfoCircle, IconAlertTriangle } from '@tabler/icons' import { flowContext } from 'store/context/ReactFlowContext' const CardWrapper = styled(MainCard)(({ theme }) => ({ @@ -30,14 +33,39 @@ const CardWrapper = styled(MainCard)(({ theme }) => ({ } })) +const LightTooltip = styled(({ className, ...props }) => )(({ theme }) => ({ + [`& .${tooltipClasses.tooltip}`]: { + backgroundColor: theme.palette.nodeToolTip.background, + color: theme.palette.nodeToolTip.color, + boxShadow: theme.shadows[1] + } +})) + // ===========================|| CANVAS NODE ||=========================== // const CanvasNode = ({ data }) => { const theme = useTheme() + const canvas = useSelector((state) => state.canvas) const { deleteNode, duplicateNode } = useContext(flowContext) const [showDialog, setShowDialog] = useState(false) const [dialogProps, setDialogProps] = useState({}) + const [showInfoDialog, setShowInfoDialog] = useState(false) + const [infoDialogProps, setInfoDialogProps] = useState({}) + const [warningMessage, setWarningMessage] = useState('') + const [open, setOpen] = useState(false) + + const handleClose = () => { + setOpen(false) + } + + const handleOpen = () => { + setOpen(true) + } + + const nodeOutdatedMessage = (oldVersion, newVersion) => `Node version ${oldVersion} outdated\nUpdate to latest version ${newVersion}` + + const nodeVersionEmptyMessage = (newVersion) => `Node outdated\nUpdate to latest version ${newVersion}` const onDialogClicked = () => { const dialogProps = { @@ -50,6 +78,17 @@ const CanvasNode = ({ data }) => { setShowDialog(true) } + useEffect(() => { + const componentNode = canvas.componentNodes.find((nd) => nd.name === data.name) + if (componentNode) { + if (!data.version) { + setWarningMessage(nodeVersionEmptyMessage(componentNode.version)) + } else { + if (componentNode.version > data.version) setWarningMessage(nodeOutdatedMessage(data.version, componentNode.version)) + } + } + }, [canvas.componentNodes, data.name, data.version]) + return ( <> { }} border={false} > - -
- -
- Notification -
-
- - - {data.label} - - -
- { - duplicateNode(data.id) - }} - sx={{ height: 35, width: 35, '&:hover': { color: theme?.palette.primary.main } }} - color={theme?.customization?.isDarkMode ? theme.colors?.paper : 'inherit'} - > - - - { - deleteNode(data.id) - }} - sx={{ height: 35, width: 35, mr: 1, '&:hover': { color: 'red' } }} - color={theme?.customization?.isDarkMode ? theme.colors?.paper : 'inherit'} - > - - -
- {(data.inputAnchors.length > 0 || data.inputParams.length > 0) && ( - <> - - - - Inputs - - - - - )} - {data.inputAnchors.map((inputAnchor, index) => ( - - ))} - {data.inputParams.map((inputParam, index) => ( - - ))} - {data.inputParams.find((param) => param.additionalParams) && ( + param.additionalParams).length === - data.inputParams.length + data.inputAnchors.length - ? 20 - : 0 + background: 'transparent', + display: 'flex', + flexDirection: 'column' }} > - + { + duplicateNode(data.id) + }} + sx={{ height: '35px', width: '35px', '&:hover': { color: theme?.palette.primary.main } }} + color={theme?.customization?.isDarkMode ? theme.colors?.paper : 'inherit'} + > + + + { + deleteNode(data.id) + }} + sx={{ height: '35px', width: '35px', '&:hover': { color: 'red' } }} + color={theme?.customization?.isDarkMode ? theme.colors?.paper : 'inherit'} + > + + + { + setInfoDialogProps({ data }) + setShowInfoDialog(true) + }} + sx={{ height: '35px', width: '35px', '&:hover': { color: theme?.palette.secondary.main } }} + color={theme?.customization?.isDarkMode ? theme.colors?.paper : 'inherit'} + > + + - )} - - - - Output - - - + } + placement='right-start' + > + +
+ +
+ Notification +
+
+ + + {data.label} + + + {warningMessage && ( + <> +
+ {warningMessage}} placement='top'> + + + + + + )} +
+ {(data.inputAnchors.length > 0 || data.inputParams.length > 0) && ( + <> + + + + Inputs + + + + + )} + {data.inputAnchors.map((inputAnchor, index) => ( + + ))} + {data.inputParams.map((inputParam, index) => ( + + ))} + {data.inputParams.find((param) => param.additionalParams) && ( +
param.additionalParams).length === + data.inputParams.length + data.inputAnchors.length + ? 20 + : 0 + }} + > + +
+ )} + + + + Output + + + - {data.outputAnchors.map((outputAnchor, index) => ( - - ))} -
+ {data.outputAnchors.map((outputAnchor, index) => ( + + ))} +
+
setShowDialog(false)} > + setShowInfoDialog(false)}> ) } diff --git a/packages/ui/src/views/canvas/CredentialInputHandler.js b/packages/ui/src/views/canvas/CredentialInputHandler.js new file mode 100644 index 00000000..4f874719 --- /dev/null +++ b/packages/ui/src/views/canvas/CredentialInputHandler.js @@ -0,0 +1,149 @@ +import PropTypes from 'prop-types' +import { useRef, useState } from 'react' + +// material-ui +import { IconButton } from '@mui/material' +import { IconEdit } from '@tabler/icons' + +// project import +import { AsyncDropdown } from 'ui-component/dropdown/AsyncDropdown' +import AddEditCredentialDialog from 'views/credentials/AddEditCredentialDialog' +import CredentialListDialog from 'views/credentials/CredentialListDialog' + +// API +import credentialsApi from 'api/credentials' + +// ===========================|| CredentialInputHandler ||=========================== // + +const CredentialInputHandler = ({ inputParam, data, onSelect, disabled = false }) => { + const ref = useRef(null) + const [credentialId, setCredentialId] = useState(data?.credential ?? '') + const [showCredentialListDialog, setShowCredentialListDialog] = useState(false) + const [credentialListDialogProps, setCredentialListDialogProps] = useState({}) + const [showSpecificCredentialDialog, setShowSpecificCredentialDialog] = useState(false) + const [specificCredentialDialogProps, setSpecificCredentialDialogProps] = useState({}) + const [reloadTimestamp, setReloadTimestamp] = useState(Date.now().toString()) + + const editCredential = (credentialId) => { + const dialogProp = { + type: 'EDIT', + cancelButtonName: 'Cancel', + confirmButtonName: 'Save', + credentialId + } + setSpecificCredentialDialogProps(dialogProp) + setShowSpecificCredentialDialog(true) + } + + const addAsyncOption = async () => { + try { + let names = '' + if (inputParam.credentialNames.length > 1) { + names = inputParam.credentialNames.join('&') + } else { + names = inputParam.credentialNames[0] + } + const componentCredentialsResp = await credentialsApi.getSpecificComponentCredential(names) + if (componentCredentialsResp.data) { + if (Array.isArray(componentCredentialsResp.data)) { + const dialogProp = { + title: 'Add New Credential', + componentsCredentials: componentCredentialsResp.data + } + setCredentialListDialogProps(dialogProp) + setShowCredentialListDialog(true) + } else { + const dialogProp = { + type: 'ADD', + cancelButtonName: 'Cancel', + confirmButtonName: 'Add', + credentialComponent: componentCredentialsResp.data + } + setSpecificCredentialDialogProps(dialogProp) + setShowSpecificCredentialDialog(true) + } + } + } catch (error) { + console.error(error) + } + } + + const onConfirmAsyncOption = (selectedCredentialId = '') => { + setCredentialId(selectedCredentialId) + setReloadTimestamp(Date.now().toString()) + setSpecificCredentialDialogProps({}) + setShowSpecificCredentialDialog(false) + onSelect(selectedCredentialId) + } + + const onCredentialSelected = (credentialComponent) => { + setShowCredentialListDialog(false) + const dialogProp = { + type: 'ADD', + cancelButtonName: 'Cancel', + confirmButtonName: 'Add', + credentialComponent + } + setSpecificCredentialDialogProps(dialogProp) + setShowSpecificCredentialDialog(true) + } + + return ( +
+ {inputParam && ( + <> + {inputParam.type === 'credential' && ( + <> +
+
+ { + setCredentialId(newValue) + onSelect(newValue) + }} + onCreateNew={() => addAsyncOption(inputParam.name)} + /> + {credentialId && ( + editCredential(credentialId)}> + + + )} +
+ + )} + + )} + {showSpecificCredentialDialog && ( + setShowSpecificCredentialDialog(false)} + onConfirm={onConfirmAsyncOption} + > + )} + {showCredentialListDialog && ( + setShowCredentialListDialog(false)} + onCredentialSelected={onCredentialSelected} + > + )} +
+ ) +} + +CredentialInputHandler.propTypes = { + inputParam: PropTypes.object, + data: PropTypes.object, + onSelect: PropTypes.func, + disabled: PropTypes.bool +} + +export default CredentialInputHandler diff --git a/packages/ui/src/views/canvas/NodeInputHandler.js b/packages/ui/src/views/canvas/NodeInputHandler.js index ba72a4ce..176df52f 100644 --- a/packages/ui/src/views/canvas/NodeInputHandler.js +++ b/packages/ui/src/views/canvas/NodeInputHandler.js @@ -21,9 +21,14 @@ import { JsonEditorInput } from 'ui-component/json/JsonEditor' import { TooltipWithParser } from 'ui-component/tooltip/TooltipWithParser' import ToolDialog from 'views/tools/ToolDialog' import FormatPromptValuesDialog from 'ui-component/dialog/FormatPromptValuesDialog' +import CredentialInputHandler from './CredentialInputHandler' +// utils import { getInputVariables } from 'utils/genericHelper' +// const +import { FLOWISE_CREDENTIAL_ID } from 'store/constant' + const EDITABLE_TOOLS = ['selectedTool'] const CustomWidthTooltip = styled(({ className, ...props }) => )({ @@ -226,6 +231,17 @@ const NodeInputHandler = ({ inputAnchor, inputParam, data, disabled = false, isA {inputParam.warning}
)} + {inputParam.type === 'credential' && ( + { + data.credential = newValue + data.inputs[FLOWISE_CREDENTIAL_ID] = newValue // in case data.credential is not updated + }} + /> + )} {inputParam.type === 'file' && ( { const handleSaveFlow = (chatflowName) => { if (reactFlowInstance) { - setNodes((nds) => - nds.map((node) => { - node.data = { - ...node.data, - selected: false - } - return node - }) - ) + const nodes = reactFlowInstance.getNodes().map((node) => { + const nodeData = cloneDeep(node.data) + if (Object.prototype.hasOwnProperty.call(nodeData.inputs, FLOWISE_CREDENTIAL_ID)) { + nodeData.credential = nodeData.inputs[FLOWISE_CREDENTIAL_ID] + nodeData.inputs = omit(nodeData.inputs, [FLOWISE_CREDENTIAL_ID]) + } + node.data = { + ...nodeData, + selected: false + } + return node + }) const rfInstanceObject = reactFlowInstance.toObject() + rfInstanceObject.nodes = nodes const flowData = JSON.stringify(rfInstanceObject) if (!chatflow.id) { diff --git a/packages/ui/src/views/chatmessage/ChatMessage.js b/packages/ui/src/views/chatmessage/ChatMessage.js index e58fdd00..b89af7bb 100644 --- a/packages/ui/src/views/chatmessage/ChatMessage.js +++ b/packages/ui/src/views/chatmessage/ChatMessage.js @@ -28,6 +28,9 @@ import useApi from 'hooks/useApi' // Const import { baseURL, maxScroll } from 'store/constant' +import robotPNG from 'assets/images/robot.png' +import userPNG from 'assets/images/account.png' + export const ChatMessage = ({ open, chatflowid, isDialog }) => { const theme = useTheme() const customization = useSelector((state) => state.customization) @@ -281,21 +284,9 @@ export const ChatMessage = ({ open, chatflowid, isDialog }) => { > {/* Display the correct icon depending on the message type */} {message.type === 'apiMessage' ? ( - AI + AI ) : ( - Me + Me )}
diff --git a/packages/ui/src/views/credentials/AddEditCredentialDialog.js b/packages/ui/src/views/credentials/AddEditCredentialDialog.js new file mode 100644 index 00000000..65b72a5f --- /dev/null +++ b/packages/ui/src/views/credentials/AddEditCredentialDialog.js @@ -0,0 +1,283 @@ +import { createPortal } from 'react-dom' +import PropTypes from 'prop-types' +import { useState, useEffect } from 'react' +import { useDispatch } from 'react-redux' +import { enqueueSnackbar as enqueueSnackbarAction, closeSnackbar as closeSnackbarAction } from 'store/actions' +import parser from 'html-react-parser' + +// Material +import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Box, Stack, OutlinedInput, Typography } from '@mui/material' + +// Project imports +import { StyledButton } from 'ui-component/button/StyledButton' +import ConfirmDialog from 'ui-component/dialog/ConfirmDialog' +import CredentialInputHandler from './CredentialInputHandler' + +// Icons +import { IconX } from '@tabler/icons' + +// API +import credentialsApi from 'api/credentials' + +// Hooks +import useApi from 'hooks/useApi' + +// utils +import useNotifier from 'utils/useNotifier' + +// const +import { baseURL } from 'store/constant' +import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' + +const AddEditCredentialDialog = ({ show, dialogProps, onCancel, onConfirm }) => { + const portalElement = document.getElementById('portal') + + const dispatch = useDispatch() + + // ==============================|| Snackbar ||============================== // + + useNotifier() + + const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) + const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) + + const getSpecificCredentialApi = useApi(credentialsApi.getSpecificCredential) + const getSpecificComponentCredentialApi = useApi(credentialsApi.getSpecificComponentCredential) + + const [credential, setCredential] = useState({}) + const [name, setName] = useState('') + const [credentialData, setCredentialData] = useState({}) + const [componentCredential, setComponentCredential] = useState({}) + + useEffect(() => { + if (getSpecificCredentialApi.data) { + setCredential(getSpecificCredentialApi.data) + if (getSpecificCredentialApi.data.name) { + setName(getSpecificCredentialApi.data.name) + } + if (getSpecificCredentialApi.data.plainDataObj) { + setCredentialData(getSpecificCredentialApi.data.plainDataObj) + } + getSpecificComponentCredentialApi.request(getSpecificCredentialApi.data.credentialName) + } + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [getSpecificCredentialApi.data]) + + useEffect(() => { + if (getSpecificComponentCredentialApi.data) { + setComponentCredential(getSpecificComponentCredentialApi.data) + } + }, [getSpecificComponentCredentialApi.data]) + + useEffect(() => { + if (dialogProps.type === 'EDIT' && dialogProps.data) { + // When credential dialog is opened from Credentials dashboard + getSpecificCredentialApi.request(dialogProps.data.id) + } else if (dialogProps.type === 'EDIT' && dialogProps.credentialId) { + // When credential dialog is opened from node in canvas + getSpecificCredentialApi.request(dialogProps.credentialId) + } else if (dialogProps.type === 'ADD' && dialogProps.credentialComponent) { + // When credential dialog is to add a new credential + setName('') + setCredential({}) + setCredentialData({}) + setComponentCredential(dialogProps.credentialComponent) + } + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [dialogProps]) + + useEffect(() => { + if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) + else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) + }, [show, dispatch]) + + const addNewCredential = async () => { + try { + const obj = { + name, + credentialName: componentCredential.name, + plainDataObj: credentialData + } + const createResp = await credentialsApi.createCredential(obj) + if (createResp.data) { + enqueueSnackbar({ + message: 'New Credential added', + options: { + key: new Date().getTime() + Math.random(), + variant: 'success', + action: (key) => ( + + ) + } + }) + onConfirm(createResp.data.id) + } + } catch (error) { + const errorData = error.response.data || `${error.response.status}: ${error.response.statusText}` + enqueueSnackbar({ + message: `Failed to add new Credential: ${errorData}`, + options: { + key: new Date().getTime() + Math.random(), + variant: 'error', + persist: true, + action: (key) => ( + + ) + } + }) + onCancel() + } + } + + const saveCredential = async () => { + try { + const saveResp = await credentialsApi.updateCredential(credential.id, { + name, + credentialName: componentCredential.name, + plainDataObj: credentialData + }) + if (saveResp.data) { + enqueueSnackbar({ + message: 'Credential saved', + options: { + key: new Date().getTime() + Math.random(), + variant: 'success', + action: (key) => ( + + ) + } + }) + onConfirm(saveResp.data.id) + } + } catch (error) { + const errorData = error.response.data || `${error.response.status}: ${error.response.statusText}` + enqueueSnackbar({ + message: `Failed to save Credential: ${errorData}`, + options: { + key: new Date().getTime() + Math.random(), + variant: 'error', + persist: true, + action: (key) => ( + + ) + } + }) + onCancel() + } + } + + const component = show ? ( + + + {componentCredential && componentCredential.label && ( +
+
+ {componentCredential.name} +
+ {componentCredential.label} +
+ )} +
+ + {componentCredential && componentCredential.description && ( + +
+ {parser(componentCredential.description)} +
+
+ )} + {componentCredential && componentCredential.label && ( + + + + Credential Name +  * + + + setName(e.target.value)} + /> + + )} + {componentCredential && + componentCredential.inputs && + componentCredential.inputs.map((inputParam, index) => ( + + ))} +
+ + (dialogProps.type === 'ADD' ? addNewCredential() : saveCredential())} + > + {dialogProps.confirmButtonName} + + + +
+ ) : null + + return createPortal(component, portalElement) +} + +AddEditCredentialDialog.propTypes = { + show: PropTypes.bool, + dialogProps: PropTypes.object, + onCancel: PropTypes.func, + onConfirm: PropTypes.func +} + +export default AddEditCredentialDialog diff --git a/packages/ui/src/views/credentials/CredentialInputHandler.js b/packages/ui/src/views/credentials/CredentialInputHandler.js new file mode 100644 index 00000000..30cc5746 --- /dev/null +++ b/packages/ui/src/views/credentials/CredentialInputHandler.js @@ -0,0 +1,137 @@ +import PropTypes from 'prop-types' +import { useRef, useState } from 'react' +import { useSelector } from 'react-redux' + +// material-ui +import { Box, Typography, IconButton } from '@mui/material' +import { IconArrowsMaximize, IconAlertTriangle } from '@tabler/icons' + +// project import +import { Dropdown } from 'ui-component/dropdown/Dropdown' +import { Input } from 'ui-component/input/Input' +import { SwitchInput } from 'ui-component/switch/Switch' +import { JsonEditorInput } from 'ui-component/json/JsonEditor' +import { TooltipWithParser } from 'ui-component/tooltip/TooltipWithParser' + +// ===========================|| NodeInputHandler ||=========================== // + +const CredentialInputHandler = ({ inputParam, data, disabled = false }) => { + const customization = useSelector((state) => state.customization) + const ref = useRef(null) + + const [showExpandDialog, setShowExpandDialog] = useState(false) + const [expandDialogProps, setExpandDialogProps] = useState({}) + + const onExpandDialogClicked = (value, inputParam) => { + const dialogProp = { + value, + inputParam, + disabled, + confirmButtonName: 'Save', + cancelButtonName: 'Cancel' + } + setExpandDialogProps(dialogProp) + setShowExpandDialog(true) + } + + const onExpandDialogSave = (newValue, inputParamName) => { + setShowExpandDialog(false) + data[inputParamName] = newValue + } + + return ( +
+ {inputParam && ( + <> + +
+ + {inputParam.label} + {!inputParam.optional &&  *} + {inputParam.description && } + +
+ {inputParam.type === 'string' && inputParam.rows && ( + onExpandDialogClicked(data[inputParam.name] ?? inputParam.default ?? '', inputParam)} + > + + + )} +
+ {inputParam.warning && ( +
+ + {inputParam.warning} +
+ )} + + {inputParam.type === 'boolean' && ( + (data[inputParam.name] = newValue)} + value={data[inputParam.name] ?? inputParam.default ?? false} + /> + )} + {(inputParam.type === 'string' || inputParam.type === 'password' || inputParam.type === 'number') && ( + (data[inputParam.name] = newValue)} + value={data[inputParam.name] ?? inputParam.default ?? ''} + showDialog={showExpandDialog} + dialogProps={expandDialogProps} + onDialogCancel={() => setShowExpandDialog(false)} + onDialogConfirm={(newValue, inputParamName) => onExpandDialogSave(newValue, inputParamName)} + /> + )} + {inputParam.type === 'json' && ( + (data[inputParam.name] = newValue)} + value={data[inputParam.name] ?? inputParam.default ?? ''} + isDarkMode={customization.isDarkMode} + /> + )} + {inputParam.type === 'options' && ( + (data[inputParam.name] = newValue)} + value={data[inputParam.name] ?? inputParam.default ?? 'choose an option'} + /> + )} +
+ + )} +
+ ) +} + +CredentialInputHandler.propTypes = { + inputAnchor: PropTypes.object, + inputParam: PropTypes.object, + data: PropTypes.object, + disabled: PropTypes.bool +} + +export default CredentialInputHandler diff --git a/packages/ui/src/views/credentials/CredentialListDialog.js b/packages/ui/src/views/credentials/CredentialListDialog.js new file mode 100644 index 00000000..e0a3e08d --- /dev/null +++ b/packages/ui/src/views/credentials/CredentialListDialog.js @@ -0,0 +1,179 @@ +import { useState, useEffect } from 'react' +import { createPortal } from 'react-dom' +import { useSelector, useDispatch } from 'react-redux' +import PropTypes from 'prop-types' +import { + List, + ListItemButton, + ListItem, + ListItemAvatar, + ListItemText, + Dialog, + DialogContent, + DialogTitle, + Box, + OutlinedInput, + InputAdornment +} from '@mui/material' +import { useTheme } from '@mui/material/styles' +import { IconSearch, IconX } from '@tabler/icons' + +// const +import { baseURL } from 'store/constant' +import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' + +const CredentialListDialog = ({ show, dialogProps, onCancel, onCredentialSelected }) => { + const portalElement = document.getElementById('portal') + const customization = useSelector((state) => state.customization) + const dispatch = useDispatch() + const theme = useTheme() + const [searchValue, setSearchValue] = useState('') + const [componentsCredentials, setComponentsCredentials] = useState([]) + + const filterSearch = (value) => { + setSearchValue(value) + setTimeout(() => { + if (value) { + const searchData = dialogProps.componentsCredentials.filter((crd) => crd.name.toLowerCase().includes(value.toLowerCase())) + setComponentsCredentials(searchData) + } else if (value === '') { + setComponentsCredentials(dialogProps.componentsCredentials) + } + // scrollTop() + }, 500) + } + + useEffect(() => { + if (dialogProps.componentsCredentials) { + setComponentsCredentials(dialogProps.componentsCredentials) + } + }, [dialogProps]) + + useEffect(() => { + if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) + else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) + }, [show, dispatch]) + + const component = show ? ( + + + {dialogProps.title} + + filterSearch(e.target.value)} + placeholder='Search credential' + startAdornment={ + + + + } + endAdornment={ + + filterSearch('')} + style={{ + cursor: 'pointer' + }} + /> + + } + aria-describedby='search-helper-text' + inputProps={{ + 'aria-label': 'weight' + }} + /> + + + + + {[...componentsCredentials].map((componentCredential) => ( +
+ onCredentialSelected(componentCredential)} + sx={{ p: 0, borderRadius: `${customization.borderRadius}px` }} + > + + +
+ {componentCredential.name} +
+
+ +
+
+
+ ))} +
+
+
+ ) : null + + return createPortal(component, portalElement) +} + +CredentialListDialog.propTypes = { + show: PropTypes.bool, + dialogProps: PropTypes.object, + onCancel: PropTypes.func, + onCredentialSelected: PropTypes.func +} + +export default CredentialListDialog diff --git a/packages/ui/src/views/credentials/index.js b/packages/ui/src/views/credentials/index.js new file mode 100644 index 00000000..9db990a7 --- /dev/null +++ b/packages/ui/src/views/credentials/index.js @@ -0,0 +1,276 @@ +import { useEffect, useState } from 'react' +import { useDispatch, useSelector } from 'react-redux' +import { enqueueSnackbar as enqueueSnackbarAction, closeSnackbar as closeSnackbarAction } from 'store/actions' +import moment from 'moment' + +// material-ui +import { Button, Box, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, IconButton } from '@mui/material' +import { useTheme } from '@mui/material/styles' + +// project imports +import MainCard from 'ui-component/cards/MainCard' +import { StyledButton } from 'ui-component/button/StyledButton' +import CredentialListDialog from './CredentialListDialog' +import ConfirmDialog from 'ui-component/dialog/ConfirmDialog' +import AddEditCredentialDialog from './AddEditCredentialDialog' + +// API +import credentialsApi from 'api/credentials' + +// Hooks +import useApi from 'hooks/useApi' +import useConfirm from 'hooks/useConfirm' + +// utils +import useNotifier from 'utils/useNotifier' + +// Icons +import { IconTrash, IconEdit, IconX, IconPlus } from '@tabler/icons' +import CredentialEmptySVG from 'assets/images/credential_empty.svg' + +// const +import { baseURL } from 'store/constant' +import { SET_COMPONENT_CREDENTIALS } from 'store/actions' + +// ==============================|| Credentials ||============================== // + +const Credentials = () => { + const theme = useTheme() + const customization = useSelector((state) => state.customization) + + const dispatch = useDispatch() + useNotifier() + + const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) + const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) + + const [showCredentialListDialog, setShowCredentialListDialog] = useState(false) + const [credentialListDialogProps, setCredentialListDialogProps] = useState({}) + const [showSpecificCredentialDialog, setShowSpecificCredentialDialog] = useState(false) + const [specificCredentialDialogProps, setSpecificCredentialDialogProps] = useState({}) + const [credentials, setCredentials] = useState([]) + const [componentsCredentials, setComponentsCredentials] = useState([]) + + const { confirm } = useConfirm() + + const getAllCredentialsApi = useApi(credentialsApi.getAllCredentials) + const getAllComponentsCredentialsApi = useApi(credentialsApi.getAllComponentsCredentials) + + const listCredential = () => { + const dialogProp = { + title: 'Add New Credential', + componentsCredentials + } + setCredentialListDialogProps(dialogProp) + setShowCredentialListDialog(true) + } + + const addNew = (credentialComponent) => { + const dialogProp = { + type: 'ADD', + cancelButtonName: 'Cancel', + confirmButtonName: 'Add', + credentialComponent + } + setSpecificCredentialDialogProps(dialogProp) + setShowSpecificCredentialDialog(true) + } + + const edit = (credential) => { + const dialogProp = { + type: 'EDIT', + cancelButtonName: 'Cancel', + confirmButtonName: 'Save', + data: credential + } + setSpecificCredentialDialogProps(dialogProp) + setShowSpecificCredentialDialog(true) + } + + const deleteCredential = async (credential) => { + const confirmPayload = { + title: `Delete`, + description: `Delete credential ${credential.name}?`, + confirmButtonName: 'Delete', + cancelButtonName: 'Cancel' + } + const isConfirmed = await confirm(confirmPayload) + + if (isConfirmed) { + try { + const deleteResp = await credentialsApi.deleteCredential(credential.id) + if (deleteResp.data) { + enqueueSnackbar({ + message: 'Credential deleted', + options: { + key: new Date().getTime() + Math.random(), + variant: 'success', + action: (key) => ( + + ) + } + }) + onConfirm() + } + } catch (error) { + const errorData = error.response.data || `${error.response.status}: ${error.response.statusText}` + enqueueSnackbar({ + message: `Failed to delete Credential: ${errorData}`, + options: { + key: new Date().getTime() + Math.random(), + variant: 'error', + persist: true, + action: (key) => ( + + ) + } + }) + onCancel() + } + } + } + + const onCredentialSelected = (credentialComponent) => { + setShowCredentialListDialog(false) + addNew(credentialComponent) + } + + const onConfirm = () => { + setShowCredentialListDialog(false) + setShowSpecificCredentialDialog(false) + getAllCredentialsApi.request() + } + + useEffect(() => { + getAllCredentialsApi.request() + getAllComponentsCredentialsApi.request() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + + useEffect(() => { + if (getAllCredentialsApi.data) { + setCredentials(getAllCredentialsApi.data) + } + }, [getAllCredentialsApi.data]) + + useEffect(() => { + if (getAllComponentsCredentialsApi.data) { + setComponentsCredentials(getAllComponentsCredentialsApi.data) + dispatch({ type: SET_COMPONENT_CREDENTIALS, componentsCredentials: getAllComponentsCredentialsApi.data }) + } + }, [getAllComponentsCredentialsApi.data, dispatch]) + + return ( + <> + + +

Credentials 

+ + + } + > + Add Credential + +
+ {credentials.length <= 0 && ( + + + CredentialEmptySVG + +
No Credentials Yet
+
+ )} + {credentials.length > 0 && ( + + + + + Name + Last Updated + Created + + + + + + {credentials.map((credential, index) => ( + + +
+
+ {credential.credentialName} +
+ {credential.name} +
+
+ {moment(credential.updatedDate).format('DD-MMM-YY')} + {moment(credential.createdDate).format('DD-MMM-YY')} + + edit(credential)}> + + + + + deleteCredential(credential)}> + + + +
+ ))} +
+
+
+ )} +
+ setShowCredentialListDialog(false)} + onCredentialSelected={onCredentialSelected} + > + setShowSpecificCredentialDialog(false)} + onConfirm={onConfirm} + > + + + ) +} + +export default Credentials diff --git a/packages/ui/src/views/tools/ToolDialog.js b/packages/ui/src/views/tools/ToolDialog.js index 77ef770d..5e286789 100644 --- a/packages/ui/src/views/tools/ToolDialog.js +++ b/packages/ui/src/views/tools/ToolDialog.js @@ -29,6 +29,7 @@ import useApi from 'hooks/useApi' // utils import useNotifier from 'utils/useNotifier' import { generateRandomGradient } from 'utils/genericHelper' +import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' const exampleAPIFunc = `/* * You can use any libraries imported in Flowise @@ -155,6 +156,12 @@ const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm }) = } } + useEffect(() => { + if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) + else dispatch({ type: HIDE_CANVAS_DIALOG }) + return () => dispatch({ type: HIDE_CANVAS_DIALOG }) + }, [show, dispatch]) + useEffect(() => { if (getSpecificToolApi.data) { setToolId(getSpecificToolApi.data.id)