only_ever_generator 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +48 -52
- package/dist/typology_gen/generate_typology.js +1 -1
- package/package.json +3 -3
- package/src/index.ts +48 -48
package/dist/index.js
CHANGED
|
@@ -1,59 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
// import express from "express";
|
|
4
|
+
// import { returnCardGenPrompt } from "./constants/prompts/card_gen_prompt";
|
|
5
|
+
// import { returnTypologyPrompt } from "./constants/prompts/typology_prompt";
|
|
6
|
+
// import { GenerateArgs } from "./utils/generate_args";
|
|
7
|
+
// import { returnHeadings, returnSourceData } from "./constants/source_data";
|
|
20
8
|
const app_1 = require("./bootstrap/app");
|
|
21
|
-
|
|
22
|
-
const app = (
|
|
23
|
-
const port = 3000;
|
|
9
|
+
// import config from "./config";
|
|
10
|
+
// const app = express();
|
|
11
|
+
// const port = 3000;
|
|
24
12
|
/// While Publishing the package , and using this code as a separate npm module
|
|
25
13
|
/// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
|
|
26
|
-
|
|
14
|
+
exports.default = app_1.OnlyEverGenerator;
|
|
27
15
|
/// All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
28
16
|
/// below this line
|
|
29
|
-
let oeGen =
|
|
30
|
-
app.get('/', (req, res)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
app.get('/openAI', (req,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
app.get('/typology', (req,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
17
|
+
// let oeGen = new OnlyEverGenerator(config.openAIKey,"gpt-3.5-turbo-1106" ,returnSourceData())
|
|
18
|
+
// app.get('/', async (req, res) => {
|
|
19
|
+
// let data = oeGen._returnParsedContent();
|
|
20
|
+
// // let parsedData = parseResponse()
|
|
21
|
+
// res.send(data);
|
|
22
|
+
// });
|
|
23
|
+
// app.get('/openAI', async (req,res)=> {
|
|
24
|
+
// // let prompt = returnPromt();
|
|
25
|
+
// let prompt = returnCardGenPrompt();
|
|
26
|
+
// let content = returnSourceData().toString()
|
|
27
|
+
// let headings = returnHeadings();
|
|
28
|
+
// // let aiRequest = await openAIRequest(prompt,content);
|
|
29
|
+
// let aiRequest = await oeGen.generateCard(prompt,content);
|
|
30
|
+
// res.send(aiRequest);
|
|
31
|
+
// });
|
|
32
|
+
// app.get('/typology', async(req,res)=>{
|
|
33
|
+
// {
|
|
34
|
+
// let typologyPrompt = returnTypologyPrompt();
|
|
35
|
+
// let cardPrompt = returnCardGenPrompt();
|
|
36
|
+
// let args = new GenerateArgs(
|
|
37
|
+
// true,
|
|
38
|
+
// true,
|
|
39
|
+
// false,
|
|
40
|
+
// {
|
|
41
|
+
// typology_prompt: typologyPrompt,
|
|
42
|
+
// card_gen_prompt: cardPrompt,
|
|
43
|
+
// summary_prompt: "",
|
|
44
|
+
// }
|
|
45
|
+
// )
|
|
46
|
+
// let typologyRequest = await oeGen.generate(
|
|
47
|
+
// true,
|
|
48
|
+
// true
|
|
49
|
+
// );
|
|
50
|
+
// res.send(typologyRequest);
|
|
51
|
+
// }
|
|
52
|
+
// });
|
|
53
|
+
// app.listen(port, () => {
|
|
54
|
+
// console.log(`Example app listening at http://localhost:${port}`);
|
|
55
|
+
// });
|
|
@@ -24,7 +24,7 @@ class GenerateTypology {
|
|
|
24
24
|
const response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(this.prompt, this.content));
|
|
25
25
|
response['type'] = 'typology';
|
|
26
26
|
response.metadata = {
|
|
27
|
-
"req_time": response.
|
|
27
|
+
"req_time": response.generated_at,
|
|
28
28
|
"req_type": response.type,
|
|
29
29
|
"req_tokens": response.usage_data.prompt_tokens,
|
|
30
30
|
"res_tokens": response.usage_data.completion_tokens,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "only_ever_generator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "nodemon dist/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"axios": "^1.7.2",
|
|
22
|
-
"dotenv": "^16.4.5"
|
|
23
|
-
|
|
22
|
+
"dotenv": "^16.4.5"
|
|
23
|
+
|
|
24
24
|
},
|
|
25
25
|
"eslintConfig": {
|
|
26
26
|
"parser": "typescript-eslint-parser",
|
package/src/index.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
|
|
2
|
-
import express from "express";
|
|
3
|
-
import { returnCardGenPrompt } from "./constants/prompts/card_gen_prompt";
|
|
4
|
-
import { returnTypologyPrompt } from "./constants/prompts/typology_prompt";
|
|
5
|
-
import { GenerateArgs } from "./utils/generate_args";
|
|
6
|
-
import { returnHeadings, returnSourceData } from "./constants/source_data";
|
|
2
|
+
// import express from "express";
|
|
3
|
+
// import { returnCardGenPrompt } from "./constants/prompts/card_gen_prompt";
|
|
4
|
+
// import { returnTypologyPrompt } from "./constants/prompts/typology_prompt";
|
|
5
|
+
// import { GenerateArgs } from "./utils/generate_args";
|
|
6
|
+
// import { returnHeadings, returnSourceData } from "./constants/source_data";
|
|
7
7
|
import { OnlyEverGenerator } from "./bootstrap/app";
|
|
8
|
-
import config from "./config";
|
|
9
|
-
const app = express();
|
|
10
|
-
const port = 3000;
|
|
8
|
+
// import config from "./config";
|
|
9
|
+
// const app = express();
|
|
10
|
+
// const port = 3000;
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
/// While Publishing the package , and using this code as a separate npm module
|
|
15
15
|
/// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
|
|
16
|
-
|
|
16
|
+
export default OnlyEverGenerator;
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
/// All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
|
|
22
22
|
/// below this line
|
|
23
|
-
let oeGen = new OnlyEverGenerator(config.openAIKey,"gpt-3.5-turbo-1106" ,returnSourceData())
|
|
24
|
-
app.get('/', async (req, res) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
23
|
+
// let oeGen = new OnlyEverGenerator(config.openAIKey,"gpt-3.5-turbo-1106" ,returnSourceData())
|
|
24
|
+
// app.get('/', async (req, res) => {
|
|
25
|
+
// let data = oeGen._returnParsedContent();
|
|
26
|
+
// // let parsedData = parseResponse()
|
|
27
|
+
// res.send(data);
|
|
28
|
+
// });
|
|
29
29
|
|
|
30
|
-
app.get('/openAI', async (req,res)=> {
|
|
31
|
-
|
|
30
|
+
// app.get('/openAI', async (req,res)=> {
|
|
31
|
+
// // let prompt = returnPromt();
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
33
|
+
// let prompt = returnCardGenPrompt();
|
|
34
|
+
// let content = returnSourceData().toString()
|
|
35
|
+
// let headings = returnHeadings();
|
|
36
|
+
// // let aiRequest = await openAIRequest(prompt,content);
|
|
37
|
+
// let aiRequest = await oeGen.generateCard(prompt,content);
|
|
38
|
+
// res.send(aiRequest);
|
|
39
|
+
// });
|
|
40
40
|
|
|
41
|
-
app.get('/typology', async(req,res)=>{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
// app.get('/typology', async(req,res)=>{
|
|
42
|
+
// {
|
|
43
|
+
// let typologyPrompt = returnTypologyPrompt();
|
|
44
|
+
// let cardPrompt = returnCardGenPrompt();
|
|
45
|
+
// let args = new GenerateArgs(
|
|
46
|
+
// true,
|
|
47
|
+
// true,
|
|
48
|
+
// false,
|
|
49
|
+
// {
|
|
50
|
+
// typology_prompt: typologyPrompt,
|
|
51
|
+
// card_gen_prompt: cardPrompt,
|
|
52
|
+
// summary_prompt: "",
|
|
53
|
+
// }
|
|
54
|
+
// )
|
|
55
|
+
// let typologyRequest = await oeGen.generate(
|
|
56
|
+
// true,
|
|
57
|
+
// true
|
|
58
|
+
// );
|
|
59
|
+
// res.send(typologyRequest);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
});
|
|
61
|
+
// }
|
|
62
|
+
// });
|
|
63
63
|
|
|
64
|
-
app.listen(port, () => {
|
|
65
|
-
|
|
66
|
-
});
|
|
64
|
+
// app.listen(port, () => {
|
|
65
|
+
// console.log(`Example app listening at http://localhost:${port}`);
|
|
66
|
+
// });
|