-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
56 lines (39 loc) · 1.66 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { ColoredConsole } from './coloredConsole.js';
import { ChatOpenAI } from "@langchain/openai"
import { StringOutputParser } from "@langchain/core/output_parsers"
//configure which AI model to use for each prompt. Create one or many models and pass to the promptPairs below.
const aiModel= new ChatOpenAI({
// modelName: "gpt-4",
// temperature: 0,
});
/* prompt configuration can be made below, adapting inputs and choosing which files to fetch */
//please configure so each prompt gets exactly its values it expects in its placeholders, like {input}, {language}
const promptInput1 = {
input: 'What is NASA?'
}
const promptInput2 = {
input: 'What is NASA?'
}
export const outputParser = new StringOutputParser();
// name/index of prompt, system message file, user message file
export const promptPairs = [
['system1.txt', 'user1.txt', promptInput1, aiModel],
['system2.txt', 'user2.txt', promptInput2, aiModel],
]
/* object structure related tweaks can be made below,
for example how to print each result and adapting structure,
for example extracting objects from arrays:*/
export const printResult = (obj) => {
const prettyConsole = new ColoredConsole()
prettyConsole.print('green', '', `\u27a4 ${obj.result}`)
}
export const adaptResultStructure = (result) => {
//if needed, adapt result structure, for example extract individual items from arrays if the call returns an array.
//if the result is already in a desired structure, just return it.
// const finalArray = [];
// result.forEach((item) => {
// // extract objects from arrays or adapt structure here
// });
// return finalArray
return result
}