Bugfix/Escape JSON in Prompt Message (#3901)

add fix to only get variables when there is no colon
This commit is contained in:
Henry Heng
2025-01-20 19:18:28 +00:00
committed by GitHub
parent 4c9d46d7e5
commit 4aa97b0c9a
16 changed files with 148 additions and 46 deletions
@@ -6,7 +6,7 @@ import { SqlDatabaseChain, SqlDatabaseChainInput, DEFAULT_SQL_DATABASE_PROMPT }
import { SqlDatabase } from 'langchain/sql_db'
import { ICommonObject, INode, INodeData, INodeParams, IServerSideEventStreamer } from '../../../src/Interface'
import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler'
import { getBaseClasses, getInputVariables } from '../../../src/utils'
import { getBaseClasses, getInputVariables, transformBracesWithColon } from '../../../src/utils'
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
import { formatResponse } from '../../outputparsers/OutputParserHelpers'
@@ -247,6 +247,7 @@ const getSQLDBChain = async (
}
if (customPrompt) {
customPrompt = transformBracesWithColon(customPrompt)
const options: PromptTemplateInput = {
template: customPrompt,
inputVariables: getInputVariables(customPrompt)