Merge branch 'main' into feature/ChatHistory2

This commit is contained in:
chungyau97
2023-09-21 13:58:15 +08:00
9 changed files with 101 additions and 113 deletions
@@ -114,7 +114,7 @@ class GoogleVertexAI_ChatModels implements INode {
const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string
const topP = nodeData.inputs?.topP as string
const obj: Partial<GoogleVertexAIChatInput> = {
const obj: GoogleVertexAIChatInput<GoogleAuthOptions> = {
temperature: parseFloat(temperature),
model: modelName
}
@@ -1,8 +1,10 @@
import { INode, INodeData, INodeParams } from '../../../src/Interface'
import { TextSplitter } from 'langchain/text_splitter'
import { CheerioWebBaseLoader } from 'langchain/document_loaders/web/cheerio'
import { CheerioWebBaseLoader, WebBaseLoaderParams } from 'langchain/document_loaders/web/cheerio'
import { test } from 'linkifyjs'
import { parse } from 'css-what'
import { webCrawl, xmlScrape } from '../../../src'
import { SelectorType } from 'cheerio'
class Cheerio_DocumentLoaders implements INode {
label: string
@@ -18,7 +20,7 @@ class Cheerio_DocumentLoaders implements INode {
constructor() {
this.label = 'Cheerio Web Scraper'
this.name = 'cheerioWebScraper'
this.version = 1.0
this.version = 1.1
this.type = 'Document'
this.icon = 'cheerio.svg'
this.category = 'Document Loaders'
@@ -66,6 +68,14 @@ class Cheerio_DocumentLoaders implements INode {
'Only used when "Get Relative Links Method" is selected. Set 0 to retrieve all relative links, default limit is 10.',
warning: `Retrieving 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)`
},
{
label: 'Selector (CSS)',
name: 'selector',
type: 'string',
description: 'Specify a CSS selector to select the content to be extracted',
optional: true,
additionalParams: true
},
{
label: 'Metadata',
name: 'metadata',
@@ -88,10 +98,18 @@ class Cheerio_DocumentLoaders implements INode {
throw new Error('Invalid URL')
}
const selector: SelectorType = nodeData.inputs?.selector as SelectorType
let params: WebBaseLoaderParams = {}
if (selector) {
parse(selector) // comes with cheerio - will throw error if invalid
params['selector'] = selector
}
async function cheerioLoader(url: string): Promise<any> {
try {
let docs = []
const loader = new CheerioWebBaseLoader(url)
const loader = new CheerioWebBaseLoader(url, params)
if (textSplitter) {
docs = await loader.loadAndSplit(textSplitter)
} else {
@@ -17,7 +17,7 @@ class OpenAI_LLMs implements INode {
constructor() {
this.label = 'OpenAI'
this.name = 'openAI'
this.version = 1.0
this.version = 2.0
this.type = 'OpenAI'
this.icon = 'openai.png'
this.category = 'LLMs'
@@ -36,23 +36,19 @@ class OpenAI_LLMs implements INode {
type: 'options',
options: [
{
label: 'text-davinci-003',
name: 'text-davinci-003'
label: 'gpt-3.5-turbo-instruct',
name: 'gpt-3.5-turbo-instruct'
},
{
label: 'text-davinci-002',
name: 'text-davinci-002'
label: 'babbage-002',
name: 'babbage-002'
},
{
label: 'text-curie-001',
name: 'text-curie-001'
},
{
label: 'text-babbage-001',
name: 'text-babbage-001'
label: 'davinci-002',
name: 'davinci-002'
}
],
default: 'text-davinci-003',
default: 'gpt-3.5-turbo-instruct',
optional: true
},
{
@@ -1,6 +1,7 @@
import { Chroma, ChromaLibArgs } from 'langchain/vectorstores/chroma'
import { Embeddings } from 'langchain/embeddings/base'
import type { Collection } from 'chromadb'
import { ChromaClient } from 'chromadb'
interface ChromaAuth {
chromaApiKey?: string
@@ -23,7 +24,6 @@ export class ChromaExtended extends Chroma {
async ensureCollection(): Promise<Collection> {
if (!this.collection) {
if (!this.index) {
const { ChromaClient } = await Chroma.imports()
const obj: any = {
path: this.url
}
@@ -37,8 +37,9 @@ export class ChromaExtended extends Chroma {
this.index = new ChromaClient(obj)
}
try {
this.collection = await this.index.getOrCreateCollection({
name: this.collectionName
this.collection = await this.index!.getOrCreateCollection({
name: this.collectionName,
...(this.collectionMetadata && { metadata: this.collectionMetadata })
})
} catch (err) {
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "flowise-components",
"version": "1.3.5",
"version": "1.3.6",
"description": "Flowiseai Components",
"main": "dist/src/index",
"types": "dist/src/index.d.ts",
@@ -32,7 +32,7 @@
"apify-client": "^2.7.1",
"axios": "^0.27.2",
"cheerio": "^1.0.0-rc.12",
"chromadb": "^1.5.3",
"chromadb": "^1.5.11",
"cohere-ai": "^6.2.0",
"d3-dsv": "2",
"dotenv": "^16.0.0",
@@ -42,7 +42,7 @@
"google-auth-library": "^9.0.0",
"graphql": "^16.6.0",
"html-to-text": "^9.0.5",
"langchain": "^0.0.147",
"langchain": "^0.0.152",
"langfuse-langchain": "^1.0.14-alpha.0",
"langsmith": "^0.0.32",
"linkifyjs": "^4.1.1",
@@ -328,7 +328,7 @@
"id": "openAI_2",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -347,23 +347,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_2-input-modelName-options"
},
@@ -442,7 +438,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -743,7 +739,7 @@
"id": "openAI_3",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -762,23 +758,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_3-input-modelName-options"
},
@@ -857,7 +849,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -1008,7 +1000,7 @@
"id": "openAI_4",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -1027,23 +1019,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_4-input-modelName-options"
},
@@ -1122,7 +1110,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -296,7 +296,7 @@
"id": "openAI_1",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -315,23 +315,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_1-input-modelName-options"
},
@@ -410,7 +406,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -452,7 +448,7 @@
"id": "openAI_2",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -471,23 +467,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_2-input-modelName-options"
},
@@ -565,8 +557,9 @@
}
],
"inputAnchors": [],
"default": "gpt-3.5-turbo-instruct",
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -155,7 +155,7 @@
"id": "openAI_0",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -174,23 +174,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_0-input-modelName-options"
},
@@ -269,7 +265,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",
@@ -115,7 +115,7 @@
"id": "openAI_0",
"label": "OpenAI",
"name": "openAI",
"version": 1,
"version": 2,
"type": "OpenAI",
"baseClasses": ["OpenAI", "BaseLLM", "BaseLanguageModel"],
"category": "LLMs",
@@ -134,23 +134,19 @@
"type": "options",
"options": [
{
"label": "text-davinci-003",
"name": "text-davinci-003"
"label": "gpt-3.5-turbo-instruct",
"name": "gpt-3.5-turbo-instruct"
},
{
"label": "text-davinci-002",
"name": "text-davinci-002"
"label": "babbage-002",
"name": "babbage-002"
},
{
"label": "text-curie-001",
"name": "text-curie-001"
},
{
"label": "text-babbage-001",
"name": "text-babbage-001"
"label": "davinci-002",
"name": "davinci-002"
}
],
"default": "text-davinci-003",
"default": "gpt-3.5-turbo-instruct",
"optional": true,
"id": "openAI_0-input-modelName-options"
},
@@ -229,7 +225,7 @@
],
"inputAnchors": [],
"inputs": {
"modelName": "text-davinci-003",
"modelName": "gpt-3.5-turbo-instruct",
"temperature": 0.7,
"maxTokens": "",
"topP": "",