MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / getAPIChain

Function getAPIChain

packages/components/nodes/chains/ApiChain/GETApiChain.ts:120–138  ·  view source on GitHub ↗
(documents: string, llm: BaseLanguageModel, headers: string, urlPrompt: string, ansPrompt: string)

Source from the content-addressed store, hash-verified

118}
119
120const getAPIChain = async (documents: string, llm: BaseLanguageModel, headers: string, urlPrompt: string, ansPrompt: string) => {
121 const apiUrlPrompt = new PromptTemplate({
122 inputVariables: ['api_docs', 'question'],
123 template: urlPrompt ? urlPrompt : API_URL_RAW_PROMPT_TEMPLATE
124 })
125
126 const apiResponsePrompt = new PromptTemplate({
127 inputVariables: ['api_docs', 'question', 'api_url', 'api_response'],
128 template: ansPrompt ? ansPrompt : API_RESPONSE_RAW_PROMPT_TEMPLATE
129 })
130
131 const chain = APIChain.fromLLMAndAPIDocs(llm, documents, {
132 apiUrlPrompt,
133 apiResponsePrompt,
134 verbose: process.env.DEBUG === 'true' ? true : false,
135 headers: typeof headers === 'object' ? headers : headers ? JSON.parse(headers) : {}
136 })
137 return chain
138}
139
140module.exports = { nodeClass: GETApiChain_Chains }

Callers 2

initMethod · 0.70
runMethod · 0.70

Calls 2

fromLLMAndAPIDocsMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected