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

Method _call

packages/components/nodes/chains/ApiChain/postCore.ts:87–112  ·  view source on GitHub ↗

@ignore

(values: ChainValues, runManager?: CallbackManagerForChainRun)

Source from the content-addressed store, hash-verified

85
86 /** @ignore */
87 async _call(values: ChainValues, runManager?: CallbackManagerForChainRun): Promise<ChainValues> {
88 try {
89 const question: string = values[this.inputKey]
90
91 const api_url_body = await this.apiRequestChain.predict({ question, api_docs: this.apiDocs }, runManager?.getChild())
92
93 const { url, data } = JSON.parse(api_url_body)
94
95 const res = await secureFetch(url, {
96 method: 'POST',
97 headers: this.headers,
98 body: JSON.stringify(data)
99 })
100
101 const api_response = await res.text()
102
103 const answer = await this.apiAnswerChain.predict(
104 { question, api_docs: this.apiDocs, api_url_body, api_response },
105 runManager?.getChild()
106 )
107
108 return { [this.outputKey]: answer }
109 } catch (error) {
110 return { [this.outputKey]: error }
111 }
112 }
113
114 _chainType() {
115 return 'api_chain' as const

Callers

nothing calls this directly

Calls 3

secureFetchFunction · 0.90
stringifyMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected