-
Notifications
You must be signed in to change notification settings - Fork 19
/
request-config.js
37 lines (28 loc) · 1.25 KB
/
request-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require("fs")
const { Location, ReturnType, CodeLanguage } = require("@chainlink/functions-toolkit")
// configures request: via settings in the fields below
const requestConfig = {
// source code location (inline only)
codeLocation: Location.Inline,
// (optional) if secrets are expected in the sourceLocation of secrets (only Remote or DONHosted is supported)
secretsLocation: Location.DONHosted,
// source code to be executed
source: fs.readFileSync("./ai-request.js").toString(),
// (optional) accessed within the source code with `secrets.varName` (ie: secrets.apiKey), must be a string.
secrets: {
apiKey: process.env.OPENAI_KEY
},
// args (array[""]): source code accesses via `args[index]`.
args: [
"bitcoin", // token id [0]
"d1", // interval [1]
"6", // precision [2]
"naive", // forecast method [3]
"30", // historical days [4]
],
// code language (JavaScript only)
codeLanguage: CodeLanguage.JavaScript,
// shows: expected type of the returned value.
expectedReturnType: ReturnType.string,
}
module.exports = requestConfig