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

Function getAPIChain

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

Source from the content-addressed store, hash-verified

108}
109
110const getAPIChain = async (documents: string, llm: BaseLanguageModel, headers: string, urlPrompt: string, ansPrompt: string) => {
111 const apiUrlPrompt = new PromptTemplate({
112 inputVariables: ['api_docs', 'question'],
113 template: urlPrompt ? urlPrompt : API_URL_RAW_PROMPT_TEMPLATE
114 })
115
116 const apiResponsePrompt = new PromptTemplate({
117 inputVariables: ['api_docs', 'question', 'api_url_body', 'api_response'],
118 template: ansPrompt ? ansPrompt : API_RESPONSE_RAW_PROMPT_TEMPLATE
119 })
120
121 const chain = APIChain.fromLLMAndAPIDocs(llm, documents, {
122 apiUrlPrompt,
123 apiResponsePrompt,
124 verbose: process.env.DEBUG === 'true' ? true : false,
125 headers: typeof headers === 'object' ? headers : headers ? JSON.parse(headers) : {}
126 })
127 return chain
128}
129
130module.exports = { nodeClass: POSTApiChain_Chains }

Callers 2

initMethod · 0.70
runMethod · 0.70

Calls 2

fromLLMAndAPIDocsMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected