mirror of https://github.com/FlowiseAI/Flowise.git
commit
37b3d0bd8f
|
|
@ -0,0 +1,62 @@
|
|||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { BabyAGI } from './core'
|
||||
import { BaseChatModel } from 'langchain/chat_models'
|
||||
import { VectorStore } from 'langchain/vectorstores'
|
||||
|
||||
class BabyAGI_Agents implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'BabyAGI'
|
||||
this.name = 'babyAGI'
|
||||
this.type = 'BabyAGI'
|
||||
this.category = 'Agents'
|
||||
this.icon = 'babyagi.jpg'
|
||||
this.description = 'Task Driven Autonomous Agent which creates new task and reprioritizes task list based on objective'
|
||||
this.baseClasses = ['BabyAGI']
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Chat Model',
|
||||
name: 'model',
|
||||
type: 'BaseChatModel'
|
||||
},
|
||||
{
|
||||
label: 'Vector Store',
|
||||
name: 'vectorStore',
|
||||
type: 'VectorStore'
|
||||
},
|
||||
{
|
||||
label: 'Task Loop',
|
||||
name: 'taskLoop',
|
||||
type: 'number',
|
||||
default: 3
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const model = nodeData.inputs?.model as BaseChatModel
|
||||
const vectorStore = nodeData.inputs?.vectorStore as VectorStore
|
||||
const taskLoop = nodeData.inputs?.taskLoop as string
|
||||
|
||||
const babyAgi = BabyAGI.fromLLM(model, vectorStore, parseInt(taskLoop, 10))
|
||||
return babyAgi
|
||||
}
|
||||
|
||||
async run(nodeData: INodeData, input: string): Promise<string> {
|
||||
const executor = nodeData.instance as BabyAGI
|
||||
const objective = input
|
||||
|
||||
const res = await executor.call({ objective })
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: BabyAGI_Agents }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
|
|
@ -0,0 +1,266 @@
|
|||
import { LLMChain } from 'langchain/chains'
|
||||
import { BaseChatModel } from 'langchain/chat_models'
|
||||
import { VectorStore } from 'langchain/dist/vectorstores/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { PromptTemplate } from 'langchain/prompts'
|
||||
|
||||
class TaskCreationChain extends LLMChain {
|
||||
constructor(prompt: PromptTemplate, llm: BaseChatModel) {
|
||||
super({ prompt, llm })
|
||||
}
|
||||
|
||||
static from_llm(llm: BaseChatModel): LLMChain {
|
||||
const taskCreationTemplate: string =
|
||||
'You are a task creation AI that uses the result of an execution agent' +
|
||||
' to create new tasks with the following objective: {objective},' +
|
||||
' The last completed task has the result: {result}.' +
|
||||
' This result was based on this task description: {task_description}.' +
|
||||
' These are incomplete tasks list: {incomplete_tasks}.' +
|
||||
' Based on the result, create new tasks to be completed' +
|
||||
' by the AI system that do not overlap with incomplete tasks.' +
|
||||
' Return the tasks as an array.'
|
||||
|
||||
const prompt = new PromptTemplate({
|
||||
template: taskCreationTemplate,
|
||||
inputVariables: ['result', 'task_description', 'incomplete_tasks', 'objective']
|
||||
})
|
||||
|
||||
return new TaskCreationChain(prompt, llm)
|
||||
}
|
||||
}
|
||||
|
||||
class TaskPrioritizationChain extends LLMChain {
|
||||
constructor(prompt: PromptTemplate, llm: BaseChatModel) {
|
||||
super({ prompt, llm })
|
||||
}
|
||||
|
||||
static from_llm(llm: BaseChatModel): TaskPrioritizationChain {
|
||||
const taskPrioritizationTemplate: string =
|
||||
'You are a task prioritization AI tasked with cleaning the formatting of and reprioritizing' +
|
||||
' the following task list: {task_names}.' +
|
||||
' Consider the ultimate objective of your team: {objective}.' +
|
||||
' Do not remove any tasks. Return the result as a numbered list, like:' +
|
||||
' #. First task' +
|
||||
' #. Second task' +
|
||||
' Start the task list with number {next_task_id}.'
|
||||
const prompt = new PromptTemplate({
|
||||
template: taskPrioritizationTemplate,
|
||||
inputVariables: ['task_names', 'next_task_id', 'objective']
|
||||
})
|
||||
return new TaskPrioritizationChain(prompt, llm)
|
||||
}
|
||||
}
|
||||
|
||||
class ExecutionChain extends LLMChain {
|
||||
constructor(prompt: PromptTemplate, llm: BaseChatModel) {
|
||||
super({ prompt, llm })
|
||||
}
|
||||
|
||||
static from_llm(llm: BaseChatModel): LLMChain {
|
||||
const executionTemplate: string =
|
||||
'You are an AI who performs one task based on the following objective: {objective}.' +
|
||||
' Take into account these previously completed tasks: {context}.' +
|
||||
' Your task: {task}.' +
|
||||
' Response:'
|
||||
|
||||
const prompt = new PromptTemplate({
|
||||
template: executionTemplate,
|
||||
inputVariables: ['objective', 'context', 'task']
|
||||
})
|
||||
|
||||
return new ExecutionChain(prompt, llm)
|
||||
}
|
||||
}
|
||||
|
||||
async function getNextTask(
|
||||
taskCreationChain: LLMChain,
|
||||
result: string,
|
||||
taskDescription: string,
|
||||
taskList: string[],
|
||||
objective: string
|
||||
): Promise<any[]> {
|
||||
const incompleteTasks: string = taskList.join(', ')
|
||||
const response: string = await taskCreationChain.predict({
|
||||
result,
|
||||
task_description: taskDescription,
|
||||
incomplete_tasks: incompleteTasks,
|
||||
objective
|
||||
})
|
||||
|
||||
const newTasks: string[] = response.split('\n')
|
||||
|
||||
return newTasks.filter((taskName) => taskName.trim()).map((taskName) => ({ task_name: taskName }))
|
||||
}
|
||||
|
||||
interface Task {
|
||||
task_id: number
|
||||
task_name: string
|
||||
}
|
||||
|
||||
async function prioritizeTasks(
|
||||
taskPrioritizationChain: LLMChain,
|
||||
thisTaskId: number,
|
||||
taskList: Task[],
|
||||
objective: string
|
||||
): Promise<Task[]> {
|
||||
const next_task_id = thisTaskId + 1
|
||||
const task_names = taskList.map((t) => t.task_name).join(', ')
|
||||
const response = await taskPrioritizationChain.predict({ task_names, next_task_id, objective })
|
||||
const newTasks = response.split('\n')
|
||||
const prioritizedTaskList: Task[] = []
|
||||
|
||||
for (const taskString of newTasks) {
|
||||
if (!taskString.trim()) {
|
||||
// eslint-disable-next-line no-continue
|
||||
continue
|
||||
}
|
||||
const taskParts = taskString.trim().split('. ', 2)
|
||||
if (taskParts.length === 2) {
|
||||
const task_id = parseInt(taskParts[0].trim(), 10)
|
||||
const task_name = taskParts[1].trim()
|
||||
prioritizedTaskList.push({ task_id, task_name })
|
||||
}
|
||||
}
|
||||
|
||||
return prioritizedTaskList
|
||||
}
|
||||
|
||||
export async function get_top_tasks(vectorStore: VectorStore, query: string, k: number): Promise<string[]> {
|
||||
const docs = await vectorStore.similaritySearch(query, k)
|
||||
let returnDocs: string[] = []
|
||||
for (const doc of docs) {
|
||||
returnDocs.push(doc.metadata.task)
|
||||
}
|
||||
return returnDocs
|
||||
}
|
||||
|
||||
async function executeTask(vectorStore: VectorStore, executionChain: LLMChain, objective: string, task: string, k = 5): Promise<string> {
|
||||
const context = await get_top_tasks(vectorStore, objective, k)
|
||||
return executionChain.predict({ objective, context, task })
|
||||
}
|
||||
|
||||
export class BabyAGI {
|
||||
taskList: Array<Task> = []
|
||||
|
||||
taskCreationChain: TaskCreationChain
|
||||
|
||||
taskPrioritizationChain: TaskPrioritizationChain
|
||||
|
||||
executionChain: ExecutionChain
|
||||
|
||||
taskIdCounter = 1
|
||||
|
||||
vectorStore: VectorStore
|
||||
|
||||
maxIterations = 3
|
||||
|
||||
constructor(
|
||||
taskCreationChain: TaskCreationChain,
|
||||
taskPrioritizationChain: TaskPrioritizationChain,
|
||||
executionChain: ExecutionChain,
|
||||
vectorStore: VectorStore,
|
||||
maxIterations: number
|
||||
) {
|
||||
this.taskCreationChain = taskCreationChain
|
||||
this.taskPrioritizationChain = taskPrioritizationChain
|
||||
this.executionChain = executionChain
|
||||
this.vectorStore = vectorStore
|
||||
this.maxIterations = maxIterations
|
||||
}
|
||||
|
||||
addTask(task: Task) {
|
||||
this.taskList.push(task)
|
||||
}
|
||||
|
||||
printTaskList() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\x1b[95m\x1b[1m\n*****TASK LIST*****\n\x1b[0m\x1b[0m')
|
||||
// eslint-disable-next-line no-console
|
||||
this.taskList.forEach((t) => console.log(`${t.task_id}: ${t.task_name}`))
|
||||
}
|
||||
|
||||
printNextTask(task: Task) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\x1b[92m\x1b[1m\n*****NEXT TASK*****\n\x1b[0m\x1b[0m')
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${task.task_id}: ${task.task_name}`)
|
||||
}
|
||||
|
||||
printTaskResult(result: string) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\x1b[93m\x1b[1m\n*****TASK RESULT*****\n\x1b[0m\x1b[0m')
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(result)
|
||||
}
|
||||
|
||||
getInputKeys(): string[] {
|
||||
return ['objective']
|
||||
}
|
||||
|
||||
getOutputKeys(): string[] {
|
||||
return []
|
||||
}
|
||||
|
||||
async call(inputs: Record<string, any>): Promise<string> {
|
||||
const { objective } = inputs
|
||||
const firstTask = inputs.first_task || 'Make a todo list'
|
||||
this.addTask({ task_id: 1, task_name: firstTask })
|
||||
let numIters = 0
|
||||
let loop = true
|
||||
let finalResult = ''
|
||||
|
||||
while (loop) {
|
||||
if (this.taskList.length) {
|
||||
this.printTaskList()
|
||||
|
||||
// Step 1: Pull the first task
|
||||
const task = this.taskList.shift()
|
||||
if (!task) break
|
||||
this.printNextTask(task)
|
||||
|
||||
// Step 2: Execute the task
|
||||
const result = await executeTask(this.vectorStore, this.executionChain, objective, task.task_name)
|
||||
const thisTaskId = task.task_id
|
||||
finalResult = result
|
||||
this.printTaskResult(result)
|
||||
|
||||
// Step 3: Store the result in Pinecone
|
||||
const docs = new Document({ pageContent: result, metadata: { task: task.task_name } })
|
||||
this.vectorStore.addDocuments([docs])
|
||||
|
||||
// Step 4: Create new tasks and reprioritize task list
|
||||
const newTasks = await getNextTask(
|
||||
this.taskCreationChain,
|
||||
result,
|
||||
task.task_name,
|
||||
this.taskList.map((t) => t.task_name),
|
||||
objective
|
||||
)
|
||||
newTasks.forEach((newTask) => {
|
||||
this.taskIdCounter += 1
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
newTask.task_id = this.taskIdCounter
|
||||
this.addTask(newTask)
|
||||
})
|
||||
this.taskList = await prioritizeTasks(this.taskPrioritizationChain, thisTaskId, this.taskList, objective)
|
||||
}
|
||||
|
||||
numIters += 1
|
||||
if (this.maxIterations !== null && numIters === this.maxIterations) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\x1b[91m\x1b[1m\n*****TASK ENDING*****\n\x1b[0m\x1b[0m')
|
||||
loop = false
|
||||
this.taskList = []
|
||||
}
|
||||
}
|
||||
|
||||
return finalResult
|
||||
}
|
||||
|
||||
static fromLLM(llm: BaseChatModel, vectorstore: VectorStore, maxIterations = 3): BabyAGI {
|
||||
const taskCreationChain = TaskCreationChain.from_llm(llm)
|
||||
const taskPrioritizationChain = TaskPrioritizationChain.from_llm(llm)
|
||||
const executionChain = ExecutionChain.from_llm(llm)
|
||||
return new BabyAGI(taskCreationChain, taskPrioritizationChain, executionChain, vectorstore, maxIterations)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
{
|
||||
"description": "Use BabyAGI to create tasks and reprioritize for a given objective",
|
||||
"nodes": [
|
||||
{
|
||||
"width": 300,
|
||||
"height": 472,
|
||||
"id": "chatOpenAI_0",
|
||||
"position": {
|
||||
"x": 623.4625717728469,
|
||||
"y": -384.9179263816219
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "chatOpenAI_0",
|
||||
"label": "ChatOpenAI",
|
||||
"name": "chatOpenAI",
|
||||
"type": "ChatOpenAI",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"label": "Model Name",
|
||||
"name": "modelName",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"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-3.5-turbo",
|
||||
"name": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"label": "gpt-3.5-turbo-0301",
|
||||
"name": "gpt-3.5-turbo-0301"
|
||||
}
|
||||
],
|
||||
"default": "gpt-3.5-turbo",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"label": "Temperature",
|
||||
"name": "temperature",
|
||||
"type": "number",
|
||||
"default": 0.9,
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {
|
||||
"modelName": "gpt-3.5-turbo",
|
||||
"temperature": "0"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
|
||||
"name": "chatOpenAI",
|
||||
"label": "ChatOpenAI",
|
||||
"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
|
||||
}
|
||||
],
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 623.4625717728469,
|
||||
"y": -384.9179263816219
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 278,
|
||||
"id": "openAIEmbeddings_0",
|
||||
"position": {
|
||||
"x": -85.14926831129219,
|
||||
"y": -175.8984338500009
|
||||
},
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [],
|
||||
"inputs": {},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "openAIEmbeddings_0-output-openAIEmbeddings-OpenAIEmbeddings|Embeddings",
|
||||
"name": "openAIEmbeddings",
|
||||
"label": "OpenAIEmbeddings",
|
||||
"type": "OpenAIEmbeddings | Embeddings"
|
||||
}
|
||||
],
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": -85.14926831129219,
|
||||
"y": -175.8984338500009
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 552,
|
||||
"id": "pineconeExistingIndex_0",
|
||||
"position": {
|
||||
"x": 264.86118448732543,
|
||||
"y": -305.52350050145094
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pineconeExistingIndex_0",
|
||||
"label": "Pinecone Load Existing Index",
|
||||
"name": "pineconeExistingIndex",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["Pinecone", "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"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "pineconeExistingIndex_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"pineconeEnv": "us-west4-gcp",
|
||||
"pineconeIndex": "test"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "pineconeExistingIndex_0-output-retriever-Pinecone|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Pinecone Retriever",
|
||||
"type": "Pinecone | 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": 264.86118448732543,
|
||||
"y": -305.52350050145094
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 379,
|
||||
"id": "babyAGI_0",
|
||||
"position": {
|
||||
"x": 982.9913269506158,
|
||||
"y": -53.95939754784533
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "babyAGI_0",
|
||||
"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",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Task Loop",
|
||||
"name": "taskLoop",
|
||||
"type": "number",
|
||||
"default": 3,
|
||||
"id": "babyAGI_0-input-taskLoop-number"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Chat Model",
|
||||
"name": "model",
|
||||
"type": "BaseChatModel",
|
||||
"id": "babyAGI_0-input-model-BaseChatModel"
|
||||
},
|
||||
{
|
||||
"label": "Vector Store",
|
||||
"name": "vectorStore",
|
||||
"type": "VectorStore",
|
||||
"id": "babyAGI_0-input-vectorStore-VectorStore"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"model": "{{chatOpenAI_0.data.instance}}",
|
||||
"vectorStore": "{{pineconeExistingIndex_0.data.instance}}",
|
||||
"taskLoop": 3
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "babyAGI_0-output-babyAGI-BabyAGI",
|
||||
"name": "babyAGI",
|
||||
"label": "BabyAGI",
|
||||
"type": "BabyAGI"
|
||||
}
|
||||
],
|
||||
"outputs": {},
|
||||
"selected": false
|
||||
},
|
||||
"positionAbsolute": {
|
||||
"x": 982.9913269506158,
|
||||
"y": -53.95939754784533
|
||||
},
|
||||
"selected": 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": "babyAGI_0",
|
||||
"targetHandle": "babyAGI_0-input-model-BaseChatModel",
|
||||
"type": "buttonedge",
|
||||
"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-babyAGI_0-babyAGI_0-input-model-BaseChatModel",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeExistingIndex_0",
|
||||
"sourceHandle": "pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore",
|
||||
"target": "babyAGI_0",
|
||||
"targetHandle": "babyAGI_0-input-vectorStore-VectorStore",
|
||||
"type": "buttonedge",
|
||||
"id": "pineconeExistingIndex_0-pineconeExistingIndex_0-output-vectorStore-Pinecone|VectorStore-babyAGI_0-babyAGI_0-input-vectorStore-VectorStore",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -230,77 +230,6 @@
|
|||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 577,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1212.220130988712,
|
||||
"y": 526.8130243230098
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pineconeUpsert_0",
|
||||
"label": "Pinecone Upsert Document",
|
||||
"name": "pineconeUpsert",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "Upsert documents to Pinecone",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Pinecone Api Key",
|
||||
"name": "pineconeApiKey",
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Environment",
|
||||
"name": "pineconeEnv",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Index",
|
||||
"name": "pineconeIndex",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"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}}",
|
||||
"pineconeEnv": "us-west4-gcp",
|
||||
"pineconeIndex": "test"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "pineconeUpsert_0-output-pineconeUpsert-BaseRetriever",
|
||||
"name": "pineconeUpsert",
|
||||
"label": "Pinecone",
|
||||
"type": "BaseRetriever"
|
||||
}
|
||||
],
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1212.220130988712,
|
||||
"y": 526.8130243230098
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 280,
|
||||
|
|
@ -353,6 +282,97 @@
|
|||
"y": 410.3973881655837
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 603,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1207.9646568749058,
|
||||
"y": 531.8684248168081
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pineconeUpsert_0",
|
||||
"label": "Pinecone Upsert Document",
|
||||
"name": "pineconeUpsert",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["Pinecone", "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"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"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}}",
|
||||
"pineconeEnv": "us-west4-gcp",
|
||||
"pineconeIndex": "test"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Pinecone Retriever",
|
||||
"type": "Pinecone | 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": 1207.9646568749058,
|
||||
"y": 531.8684248168081
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
|
|
@ -367,6 +387,28 @@
|
|||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAI_0",
|
||||
"sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-llm-BaseLLM",
|
||||
"type": "buttonedge",
|
||||
"id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-llm-BaseLLM",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "textFile_0",
|
||||
"sourceHandle": "textFile_0-output-textFile-Document",
|
||||
|
|
@ -388,28 +430,6 @@
|
|||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "openAI_0",
|
||||
"sourceHandle": "openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-llm-BaseLLM",
|
||||
"type": "buttonedge",
|
||||
"id": "openAI_0-openAI_0-output-openAI-OpenAI|BaseLLM|BaseLanguageModel-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-llm-BaseLLM",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-pineconeUpsert-BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-pineconeUpsert-BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,77 +245,6 @@
|
|||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 577,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1265.1304547629002,
|
||||
"y": 376.13121569675315
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pineconeUpsert_0",
|
||||
"label": "Pinecone Upsert Document",
|
||||
"name": "pineconeUpsert",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["BaseRetriever"],
|
||||
"category": "Vector Stores",
|
||||
"description": "Upsert documents to Pinecone",
|
||||
"inputParams": [
|
||||
{
|
||||
"label": "Pinecone Api Key",
|
||||
"name": "pineconeApiKey",
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Environment",
|
||||
"name": "pineconeEnv",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"label": "Pinecone Index",
|
||||
"name": "pineconeIndex",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"id": "pineconeUpsert_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "pineconeUpsert_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": "{{github_0.data.instance}}",
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"pineconeEnv": "us-west4-gcp",
|
||||
"pineconeIndex": "test"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"id": "pineconeUpsert_0-output-pineconeUpsert-BaseRetriever",
|
||||
"name": "pineconeUpsert",
|
||||
"label": "Pinecone",
|
||||
"type": "BaseRetriever"
|
||||
}
|
||||
],
|
||||
"selected": false
|
||||
},
|
||||
"selected": false,
|
||||
"positionAbsolute": {
|
||||
"x": 1265.1304547629002,
|
||||
"y": 376.13121569675315
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 280,
|
||||
|
|
@ -368,6 +297,97 @@
|
|||
"y": 197.0636463189023
|
||||
},
|
||||
"dragging": false
|
||||
},
|
||||
{
|
||||
"width": 300,
|
||||
"height": 603,
|
||||
"id": "pineconeUpsert_0",
|
||||
"position": {
|
||||
"x": 1275.7940479898277,
|
||||
"y": 379.2784546164221
|
||||
},
|
||||
"type": "customNode",
|
||||
"data": {
|
||||
"id": "pineconeUpsert_0",
|
||||
"label": "Pinecone Upsert Document",
|
||||
"name": "pineconeUpsert",
|
||||
"type": "Pinecone",
|
||||
"baseClasses": ["Pinecone", "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"
|
||||
}
|
||||
],
|
||||
"inputAnchors": [
|
||||
{
|
||||
"label": "Document",
|
||||
"name": "document",
|
||||
"type": "Document",
|
||||
"id": "pineconeUpsert_0-input-document-Document"
|
||||
},
|
||||
{
|
||||
"label": "Embeddings",
|
||||
"name": "embeddings",
|
||||
"type": "Embeddings",
|
||||
"id": "pineconeUpsert_0-input-embeddings-Embeddings"
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"document": "{{github_0.data.instance}}",
|
||||
"embeddings": "{{openAIEmbeddings_0.data.instance}}",
|
||||
"pineconeEnv": "us-west4-gcp",
|
||||
"pineconeIndex": "test"
|
||||
},
|
||||
"outputAnchors": [
|
||||
{
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "options",
|
||||
"options": [
|
||||
{
|
||||
"id": "pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever",
|
||||
"name": "retriever",
|
||||
"label": "Pinecone Retriever",
|
||||
"type": "Pinecone | 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": 1275.7940479898277,
|
||||
"y": 379.2784546164221
|
||||
},
|
||||
"dragging": false
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
|
|
@ -383,12 +403,12 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-pineconeUpsert-BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"source": "recursiveCharacterTextSplitter_0",
|
||||
"sourceHandle": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"target": "github_0",
|
||||
"targetHandle": "github_0-input-textSplitter-TextSplitter",
|
||||
"type": "buttonedge",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-pineconeUpsert-BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"id": "recursiveCharacterTextSplitter_0-recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-github_0-github_0-input-textSplitter-TextSplitter",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
|
|
@ -416,12 +436,12 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"source": "recursiveCharacterTextSplitter_0",
|
||||
"sourceHandle": "recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter",
|
||||
"target": "github_0",
|
||||
"targetHandle": "github_0-input-textSplitter-TextSplitter",
|
||||
"source": "pineconeUpsert_0",
|
||||
"sourceHandle": "pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever",
|
||||
"target": "conversationalRetrievalQAChain_0",
|
||||
"targetHandle": "conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"type": "buttonedge",
|
||||
"id": "recursiveCharacterTextSplitter_0-recursiveCharacterTextSplitter_0-output-recursiveCharacterTextSplitter-RecursiveCharacterTextSplitter|TextSplitter-github_0-github_0-input-textSplitter-TextSplitter",
|
||||
"id": "pineconeUpsert_0-pineconeUpsert_0-output-retriever-Pinecone|BaseRetriever-conversationalRetrievalQAChain_0-conversationalRetrievalQAChain_0-input-vectorStoreRetriever-BaseRetriever",
|
||||
"data": {
|
||||
"label": ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue