@adminforth/completion-adapter-open-ai-chat-gpt 1.0.7 → 1.0.9
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 +2 -1
- package/index.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export default class CompletionAdapterOpenAIChatGPT {
|
|
|
11
11
|
constructor(options) {
|
|
12
12
|
this.complete = (content_1, ...args_1) => __awaiter(this, [content_1, ...args_1], void 0, function* (content, stop = ["."], maxTokens = 50) {
|
|
13
13
|
var _a;
|
|
14
|
+
// stop parameter is alredy not supported
|
|
15
|
+
// adapter users should explicitely ask model to stop at dot if needed (or "Complete only up to the end of sentence")
|
|
14
16
|
const model = this.options.model || "gpt-4o-mini";
|
|
15
17
|
const resp = yield fetch("https://api.openai.com/v1/chat/completions", {
|
|
16
18
|
method: "POST",
|
|
@@ -28,7 +30,6 @@ export default class CompletionAdapterOpenAIChatGPT {
|
|
|
28
30
|
],
|
|
29
31
|
temperature: ((_a = this.options.expert) === null || _a === void 0 ? void 0 : _a.temperature) || 0.7,
|
|
30
32
|
max_completion_tokens: maxTokens,
|
|
31
|
-
stop, //param
|
|
32
33
|
}),
|
|
33
34
|
});
|
|
34
35
|
const data = yield resp.json();
|
package/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export default class CompletionAdapterOpenAIChatGPT
|
|
|
21
21
|
finishReason?: string;
|
|
22
22
|
error?: string;
|
|
23
23
|
}> => {
|
|
24
|
+
// stop parameter is alredy not supported
|
|
25
|
+
// adapter users should explicitely ask model to stop at dot if needed (or "Complete only up to the end of sentence")
|
|
24
26
|
const model = this.options.model || "gpt-4o-mini";
|
|
25
27
|
const resp = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
26
28
|
method: "POST",
|
|
@@ -38,7 +40,6 @@ export default class CompletionAdapterOpenAIChatGPT
|
|
|
38
40
|
],
|
|
39
41
|
temperature: this.options.expert?.temperature || 0.7,
|
|
40
42
|
max_completion_tokens: maxTokens,
|
|
41
|
-
stop, //param
|
|
42
43
|
}),
|
|
43
44
|
});
|
|
44
45
|
const data = await resp.json();
|