@byline/ai 1.9.0 → 1.10.0

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.
Files changed (129) hide show
  1. package/dist/@types.d.ts +0 -9
  2. package/dist/@types.d.ts.map +1 -1
  3. package/dist/@types.js +0 -10
  4. package/dist/@types.js.map +1 -1
  5. package/dist/execute.d.ts.map +1 -1
  6. package/dist/execute.js +13 -38
  7. package/dist/execute.js.map +1 -1
  8. package/dist/generate.d.ts +1 -2
  9. package/dist/generate.d.ts.map +1 -1
  10. package/dist/generate.js +53 -49
  11. package/dist/generate.js.map +1 -1
  12. package/dist/index.d.ts +3 -5
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -8
  15. package/dist/index.js.map +1 -1
  16. package/dist/lib/logger.d.ts +2 -2
  17. package/dist/lib/logger.d.ts.map +1 -1
  18. package/dist/lib/logger.js +27 -5
  19. package/dist/lib/logger.js.map +1 -1
  20. package/dist/models/anthropic/generate.d.ts +51 -8
  21. package/dist/models/anthropic/generate.d.ts.map +1 -1
  22. package/dist/models/anthropic/generate.js +261 -18
  23. package/dist/models/anthropic/generate.js.map +1 -1
  24. package/dist/models/anthropic/generate.test.node.js +7 -56
  25. package/dist/models/anthropic/generate.test.node.js.map +1 -1
  26. package/dist/models/anthropic/patch.d.ts +25 -4
  27. package/dist/models/anthropic/patch.d.ts.map +1 -1
  28. package/dist/models/anthropic/patch.js +142 -6
  29. package/dist/models/anthropic/patch.js.map +1 -1
  30. package/dist/models/anthropic/patch.test.node.js +7 -57
  31. package/dist/models/anthropic/patch.test.node.js.map +1 -1
  32. package/dist/models/google/generate.d.ts +51 -8
  33. package/dist/models/google/generate.d.ts.map +1 -1
  34. package/dist/models/google/generate.js +235 -19
  35. package/dist/models/google/generate.js.map +1 -1
  36. package/dist/models/google/generate.test.node.js +8 -56
  37. package/dist/models/google/generate.test.node.js.map +1 -1
  38. package/dist/models/google/patch.d.ts +25 -4
  39. package/dist/models/google/patch.d.ts.map +1 -1
  40. package/dist/models/google/patch.js +154 -6
  41. package/dist/models/google/patch.js.map +1 -1
  42. package/dist/models/google/patch.test.node.js +7 -57
  43. package/dist/models/google/patch.test.node.js.map +1 -1
  44. package/dist/models/openai/generate.d.ts +57 -8
  45. package/dist/models/openai/generate.d.ts.map +1 -1
  46. package/dist/models/openai/generate.js +266 -18
  47. package/dist/models/openai/generate.js.map +1 -1
  48. package/dist/models/openai/generate.test.node.js +7 -56
  49. package/dist/models/openai/generate.test.node.js.map +1 -1
  50. package/dist/models/openai/patch.d.ts +25 -4
  51. package/dist/models/openai/patch.d.ts.map +1 -1
  52. package/dist/models/openai/patch.js +141 -6
  53. package/dist/models/openai/patch.js.map +1 -1
  54. package/dist/models/openai/patch.test.node.js +7 -57
  55. package/dist/models/openai/patch.test.node.js.map +1 -1
  56. package/dist/patch.d.ts +2 -3
  57. package/dist/patch.d.ts.map +1 -1
  58. package/dist/patch.js +18 -16
  59. package/dist/patch.js.map +1 -1
  60. package/dist/plugins/ai-plugin-base.d.ts +1 -2
  61. package/dist/plugins/ai-plugin-base.d.ts.map +1 -1
  62. package/dist/plugins/ai-plugin-base.js +5 -20
  63. package/dist/plugins/ai-plugin-base.js.map +1 -1
  64. package/dist/plugins/lexical/plugin.d.ts.map +1 -1
  65. package/dist/plugins/lexical/plugin.js +3 -5
  66. package/dist/plugins/lexical/plugin.js.map +1 -1
  67. package/dist/plugins/storage.d.ts +1 -2
  68. package/dist/plugins/storage.d.ts.map +1 -1
  69. package/dist/plugins/storage.js +2 -4
  70. package/dist/plugins/storage.js.map +1 -1
  71. package/dist/plugins/text/plugin.d.ts.map +1 -1
  72. package/dist/plugins/text/plugin.js +3 -5
  73. package/dist/plugins/text/plugin.js.map +1 -1
  74. package/dist/{models/anthropic/anthropic.d.ts → utils/has-text.test.node.d.ts} +2 -2
  75. package/dist/utils/has-text.test.node.d.ts.map +1 -0
  76. package/dist/utils/has-text.test.node.js +70 -0
  77. package/dist/utils/has-text.test.node.js.map +1 -0
  78. package/package.json +6 -14
  79. package/dist/models/anthropic/anthropic.d.ts.map +0 -1
  80. package/dist/models/anthropic/anthropic.js +0 -20
  81. package/dist/models/anthropic/anthropic.js.map +0 -1
  82. package/dist/models/anthropic/generate-native.d.ts +0 -59
  83. package/dist/models/anthropic/generate-native.d.ts.map +0 -1
  84. package/dist/models/anthropic/generate-native.js +0 -271
  85. package/dist/models/anthropic/generate-native.js.map +0 -1
  86. package/dist/models/anthropic/generate-vercel.d.ts +0 -59
  87. package/dist/models/anthropic/generate-vercel.d.ts.map +0 -1
  88. package/dist/models/anthropic/generate-vercel.js +0 -126
  89. package/dist/models/anthropic/generate-vercel.js.map +0 -1
  90. package/dist/models/anthropic/patch-native.d.ts +0 -33
  91. package/dist/models/anthropic/patch-native.d.ts.map +0 -1
  92. package/dist/models/anthropic/patch-native.js +0 -152
  93. package/dist/models/anthropic/patch-native.js.map +0 -1
  94. package/dist/models/anthropic/patch-vercel.d.ts +0 -33
  95. package/dist/models/anthropic/patch-vercel.d.ts.map +0 -1
  96. package/dist/models/anthropic/patch-vercel.js +0 -47
  97. package/dist/models/anthropic/patch-vercel.js.map +0 -1
  98. package/dist/models/google/generate-native.d.ts +0 -59
  99. package/dist/models/google/generate-native.d.ts.map +0 -1
  100. package/dist/models/google/generate-native.js +0 -244
  101. package/dist/models/google/generate-native.js.map +0 -1
  102. package/dist/models/google/generate-vercel.d.ts +0 -59
  103. package/dist/models/google/generate-vercel.d.ts.map +0 -1
  104. package/dist/models/google/generate-vercel.js +0 -133
  105. package/dist/models/google/generate-vercel.js.map +0 -1
  106. package/dist/models/google/patch-native.d.ts +0 -33
  107. package/dist/models/google/patch-native.d.ts.map +0 -1
  108. package/dist/models/google/patch-native.js +0 -164
  109. package/dist/models/google/patch-native.js.map +0 -1
  110. package/dist/models/google/patch-vercel.d.ts +0 -33
  111. package/dist/models/google/patch-vercel.d.ts.map +0 -1
  112. package/dist/models/google/patch-vercel.js +0 -49
  113. package/dist/models/google/patch-vercel.js.map +0 -1
  114. package/dist/models/openai/generate-native.d.ts +0 -65
  115. package/dist/models/openai/generate-native.d.ts.map +0 -1
  116. package/dist/models/openai/generate-native.js +0 -276
  117. package/dist/models/openai/generate-native.js.map +0 -1
  118. package/dist/models/openai/generate-vercel.d.ts +0 -59
  119. package/dist/models/openai/generate-vercel.d.ts.map +0 -1
  120. package/dist/models/openai/generate-vercel.js +0 -132
  121. package/dist/models/openai/generate-vercel.js.map +0 -1
  122. package/dist/models/openai/patch-native.d.ts +0 -33
  123. package/dist/models/openai/patch-native.d.ts.map +0 -1
  124. package/dist/models/openai/patch-native.js +0 -151
  125. package/dist/models/openai/patch-native.js.map +0 -1
  126. package/dist/models/openai/patch-vercel.d.ts +0 -33
  127. package/dist/models/openai/patch-vercel.d.ts.map +0 -1
  128. package/dist/models/openai/patch-vercel.js +0 -49
  129. package/dist/models/openai/patch-vercel.js.map +0 -1
@@ -1,132 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- import { createOpenAI } from '@ai-sdk/openai';
9
- import { generateText as generateTextAi, jsonSchema, Output, streamText as streamTextAi } from 'ai';
10
- import { buildGenerateHtmlSystemPrompt, buildGenerateHtmlUserPrompt, buildGenerateSystemPrompt, buildGenerateTextSystemPrompt, buildGenerateTextUserPrompt, } from '../../prompts';
11
- import { openaiGenerationSchema } from './schema';
12
- export async function generateHtml(options) {
13
- const openai = createOpenAI({ apiKey: options.apiKey });
14
- const result = await generateTextAi({
15
- model: openai(options.model),
16
- system: buildGenerateHtmlSystemPrompt(),
17
- prompt: buildGenerateHtmlUserPrompt(options.prompt),
18
- abortSignal: options.signal,
19
- });
20
- return result.text;
21
- }
22
- export function generateHtmlStreaming(options) {
23
- const openai = createOpenAI({ apiKey: options.apiKey });
24
- const result = streamTextAi({
25
- model: openai(options.model),
26
- system: buildGenerateHtmlSystemPrompt(),
27
- prompt: buildGenerateHtmlUserPrompt(options.prompt),
28
- abortSignal: options.signal,
29
- });
30
- return {
31
- text: result.textStream,
32
- final: result.text,
33
- };
34
- }
35
- export async function generateText(options) {
36
- const openai = createOpenAI({ apiKey: options.apiKey });
37
- const maxLength = typeof options.maxLength === 'number' && Number.isFinite(options.maxLength)
38
- ? Math.floor(options.maxLength)
39
- : undefined;
40
- const promptWithLength = typeof maxLength === 'number' && maxLength > 0
41
- ? `${options.prompt}\n\nConstraints:\n- Maximum length: ${maxLength} characters.`
42
- : options.prompt;
43
- const result = await generateTextAi({
44
- model: openai(options.model),
45
- system: buildGenerateTextSystemPrompt(),
46
- prompt: buildGenerateTextUserPrompt(promptWithLength),
47
- abortSignal: options.signal,
48
- });
49
- const normalized = result.text.trim();
50
- if (typeof maxLength === 'number' && maxLength > 0) {
51
- return normalized.length > maxLength ? normalized.slice(0, maxLength).trimEnd() : normalized;
52
- }
53
- return normalized;
54
- }
55
- export function generateTextStreaming(options) {
56
- const openai = createOpenAI({ apiKey: options.apiKey });
57
- const maxLength = typeof options.maxLength === 'number' && Number.isFinite(options.maxLength)
58
- ? Math.floor(options.maxLength)
59
- : undefined;
60
- const promptWithLength = typeof maxLength === 'number' && maxLength > 0
61
- ? `${options.prompt}\n\nConstraints:\n- Maximum length: ${maxLength} characters.`
62
- : options.prompt;
63
- const result = streamTextAi({
64
- model: openai(options.model),
65
- system: buildGenerateTextSystemPrompt(),
66
- prompt: buildGenerateTextUserPrompt(promptWithLength),
67
- abortSignal: options.signal,
68
- });
69
- const text = (async function* () {
70
- let remaining = typeof maxLength === 'number' && maxLength > 0 ? maxLength : undefined;
71
- for await (const delta of result.textStream) {
72
- if (typeof remaining === 'number') {
73
- if (remaining <= 0) {
74
- continue;
75
- }
76
- const chunk = delta.slice(0, remaining);
77
- remaining -= chunk.length;
78
- if (chunk.length > 0) {
79
- yield chunk;
80
- }
81
- continue;
82
- }
83
- yield delta;
84
- }
85
- })();
86
- const final = result.text.then((t) => {
87
- const normalized = (t ?? '').trim();
88
- if (typeof maxLength === 'number' && maxLength > 0) {
89
- return normalized.length > maxLength ? normalized.slice(0, maxLength).trimEnd() : normalized;
90
- }
91
- return normalized;
92
- });
93
- return { text, final };
94
- }
95
- export async function generateDoc(options) {
96
- const openai = createOpenAI({ apiKey: options.apiKey });
97
- const schema = jsonSchema({
98
- ...(openaiGenerationSchema.schema ?? openaiGenerationSchema),
99
- $schema: undefined,
100
- });
101
- const result = await generateTextAi({
102
- model: openai(options.model),
103
- system: buildGenerateSystemPrompt(),
104
- prompt: options.prompt,
105
- abortSignal: options.signal,
106
- output: Output.object({
107
- schema,
108
- }),
109
- });
110
- return result.output;
111
- }
112
- export function generateDocStreaming(options) {
113
- const openai = createOpenAI({ apiKey: options.apiKey });
114
- const schema = jsonSchema({
115
- ...(openaiGenerationSchema.schema ?? openaiGenerationSchema),
116
- $schema: undefined,
117
- });
118
- const result = streamTextAi({
119
- model: openai(options.model),
120
- system: buildGenerateSystemPrompt(),
121
- prompt: options.prompt,
122
- abortSignal: options.signal,
123
- output: Output.object({
124
- schema,
125
- }),
126
- });
127
- return {
128
- text: result.textStream,
129
- final: result.output,
130
- };
131
- }
132
- //# sourceMappingURL=generate-vercel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-vercel.js","sourceRoot":"","sources":["../../../src/models/openai/generate-vercel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,IAAI,CAAA;AAEnG,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,sBAAsB,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AAC,KAAK,CAAC;QAC5B,MAAM,EAAE,yBAAyB,EAAE;QACnC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,MAAM;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,MAAM;SACP,CAAC;KACH,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,UAAU;QACvB,KAAK,EAAE,MAAM,CAAC,MAA+B;KAC9C,CAAA;AACH,CAAC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- import type { LexicalTextEditsResponse } from '../../utils/lexical-text-edits';
9
- export type PatchDocStreamingResult = {
10
- text: AsyncIterable<string>;
11
- final: Promise<LexicalTextEditsResponse>;
12
- };
13
- export declare function patchDoc(options: {
14
- apiKey: string;
15
- model: string;
16
- prompt: string;
17
- textNodes: Array<{
18
- id: number;
19
- text: string;
20
- }>;
21
- signal?: AbortSignal;
22
- }): Promise<LexicalTextEditsResponse>;
23
- export declare function patchDocStreaming(options: {
24
- apiKey: string;
25
- model: string;
26
- prompt: string;
27
- textNodes: Array<{
28
- id: number;
29
- text: string;
30
- }>;
31
- signal?: AbortSignal;
32
- }): PatchDocStreamingResult;
33
- //# sourceMappingURL=patch-native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-native.d.ts","sourceRoot":"","sources":["../../../src/models/openai/patch-native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAsC1E,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3B,KAAK,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACzC,CAAA;AAgDD,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAsCpC;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,uBAAuB,CAmD1B"}
@@ -1,151 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- import OpenAI from 'openai';
9
- import { buildPatchSystemPrompt } from '../../prompts';
10
- const buildPatchUserPrompt = (instruction, textNodes) => {
11
- return [
12
- `INSTRUCTION: ${instruction}`,
13
- '',
14
- 'INPUT_TEXT_NODES_JSON:',
15
- JSON.stringify(textNodes),
16
- ].join('\n');
17
- };
18
- const openaiPatchSchema = {
19
- name: 'lexical_text_edits_v1',
20
- strict: true,
21
- schema: {
22
- type: 'object',
23
- additionalProperties: false,
24
- properties: {
25
- edits: {
26
- type: 'array',
27
- items: {
28
- type: 'object',
29
- additionalProperties: false,
30
- properties: {
31
- id: { type: 'number' },
32
- text: { type: 'string' },
33
- },
34
- required: ['id', 'text'],
35
- },
36
- },
37
- },
38
- required: ['edits'],
39
- },
40
- };
41
- const getOutputText = (result) => {
42
- if (typeof result?.output_text === 'string') {
43
- return result.output_text;
44
- }
45
- if (Array.isArray(result?.output)) {
46
- const texts = [];
47
- for (const output of result.output) {
48
- if (output?.type !== 'message' || !Array.isArray(output?.content)) {
49
- continue;
50
- }
51
- for (const content of output.content) {
52
- if (content?.type === 'output_text' && typeof content?.text === 'string') {
53
- texts.push(content.text);
54
- }
55
- }
56
- }
57
- if (texts.length > 0) {
58
- return texts.join('');
59
- }
60
- }
61
- return undefined;
62
- };
63
- const parsePatchResponse = (result) => {
64
- const parsed = result.output_parsed;
65
- if (parsed && typeof parsed === 'object') {
66
- return parsed;
67
- }
68
- const outputText = getOutputText(result);
69
- if (typeof outputText === 'string' && outputText.trim().length > 0) {
70
- try {
71
- const json = JSON.parse(outputText);
72
- if (json && typeof json === 'object') {
73
- return json;
74
- }
75
- }
76
- catch {
77
- // fall through to error below
78
- }
79
- }
80
- throw new Error('OpenAI structured output did not return a parsed object.');
81
- };
82
- export async function patchDoc(options) {
83
- const client = new OpenAI({ apiKey: options.apiKey });
84
- const format = {
85
- type: 'json_schema',
86
- ...openaiPatchSchema,
87
- };
88
- const result = await client.responses.parse({
89
- model: options.model,
90
- input: [
91
- {
92
- role: 'system',
93
- content: buildPatchSystemPrompt(),
94
- },
95
- {
96
- role: 'user',
97
- content: buildPatchUserPrompt(options.prompt, options.textNodes),
98
- },
99
- ],
100
- text: {
101
- format,
102
- },
103
- }, options.signal ? { signal: options.signal } : undefined);
104
- // console.log(result.usage)
105
- const refusal = result?.output?.[0]?.content?.find((c) => c?.type === 'refusal')?.refusal;
106
- if (typeof refusal === 'string' && refusal.length > 0) {
107
- throw new Error(refusal);
108
- }
109
- return parsePatchResponse(result);
110
- }
111
- export function patchDocStreaming(options) {
112
- const client = new OpenAI({ apiKey: options.apiKey });
113
- const format = {
114
- type: 'json_schema',
115
- ...openaiPatchSchema,
116
- };
117
- const stream = client.responses.stream({
118
- model: options.model,
119
- input: [
120
- {
121
- role: 'system',
122
- content: buildPatchSystemPrompt(),
123
- },
124
- {
125
- role: 'user',
126
- content: buildPatchUserPrompt(options.prompt, options.textNodes),
127
- },
128
- ],
129
- text: {
130
- format,
131
- },
132
- stream: true,
133
- }, options.signal ? { signal: options.signal } : undefined);
134
- const text = (async function* () {
135
- for await (const event of stream) {
136
- if (event.type === 'response.output_text.delta') {
137
- yield event.delta;
138
- }
139
- }
140
- })();
141
- const final = (async () => {
142
- const result = await stream.finalResponse();
143
- const refusal = result?.output?.[0]?.content?.find((c) => c?.type === 'refusal')?.refusal;
144
- if (typeof refusal === 'string' && refusal.length > 0) {
145
- throw new Error(refusal);
146
- }
147
- return parsePatchResponse(result);
148
- })();
149
- return { text, final };
150
- }
151
- //# sourceMappingURL=patch-native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-native.js","sourceRoot":"","sources":["../../../src/models/openai/patch-native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAGlD,MAAM,oBAAoB,GAAG,CAC3B,WAAmB,EACnB,SAA8C,EAC9C,EAAE;IACF,OAAO;QACL,gBAAgB,WAAW,EAAE;QAC7B,EAAE;QACF,wBAAwB;QACxB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;KAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,oBAAoB,EAAE,KAAK;oBAC3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AAI,KAAK,CAAC,IAAI,KAAK,4BAA4B,EAAE,CAAC;gBAChD,MAAM,KAAK,CAAC,KAAK,CAAA;YACnB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,EAAE,CAAA;QAE3C,MAAM,OAAO,GAAI,MAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CACzD,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,SAAS,CAClC,EAAE,OAAO,CAAA;QACV,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;QAC1B,CAAC;QAED,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AACxB,CAAC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- import { type LexicalTextEditsResponse } from '../../utils/lexical-text-edits';
9
- export type PatchDocStreamingResult = {
10
- text: AsyncIterable<string>;
11
- final: Promise<LexicalTextEditsResponse>;
12
- };
13
- export declare function patchDoc(options: {
14
- apiKey: string;
15
- model: string;
16
- prompt: string;
17
- textNodes: Array<{
18
- id: number;
19
- text: string;
20
- }>;
21
- signal?: AbortSignal;
22
- }): Promise<LexicalTextEditsResponse>;
23
- export declare function patchDocStreaming(options: {
24
- apiKey: string;
25
- model: string;
26
- prompt: string;
27
- textNodes: Array<{
28
- id: number;
29
- text: string;
30
- }>;
31
- signal?: AbortSignal;
32
- }): PatchDocStreamingResult;
33
- //# sourceMappingURL=patch-vercel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-vercel.d.ts","sourceRoot":"","sources":["../../../src/models/openai/patch-vercel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,4BAA4B,CAAA;AAcnC,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3B,KAAK,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACzC,CAAA;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAcpC;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,uBAAuB,CAiB1B"}
@@ -1,49 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
- import { createOpenAI } from '@ai-sdk/openai';
9
- import { generateText, Output, streamText } from 'ai';
10
- import { buildPatchSystemPrompt } from '../../prompts';
11
- import { lexicalTextEditsResponseSchema, } from '../../utils/lexical-text-edits';
12
- const buildPatchUserPrompt = (instruction, textNodes) => {
13
- return [
14
- `INSTRUCTION: ${instruction}`,
15
- '',
16
- 'INPUT_TEXT_NODES_JSON:',
17
- JSON.stringify(textNodes),
18
- ].join('\n');
19
- };
20
- export async function patchDoc(options) {
21
- const openai = createOpenAI({ apiKey: options.apiKey });
22
- const result = await generateText({
23
- model: openai(options.model),
24
- system: buildPatchSystemPrompt(),
25
- prompt: buildPatchUserPrompt(options.prompt, options.textNodes),
26
- abortSignal: options.signal,
27
- output: Output.object({
28
- schema: lexicalTextEditsResponseSchema,
29
- }),
30
- });
31
- return result.output;
32
- }
33
- export function patchDocStreaming(options) {
34
- const openai = createOpenAI({ apiKey: options.apiKey });
35
- const result = streamText({
36
- model: openai(options.model),
37
- system: buildPatchSystemPrompt(),
38
- prompt: buildPatchUserPrompt(options.prompt, options.textNodes),
39
- abortSignal: options.signal,
40
- output: Output.object({
41
- schema: lexicalTextEditsResponseSchema,
42
- }),
43
- });
44
- return {
45
- text: result.textStream,
46
- final: result.output,
47
- };
48
- }
49
- //# sourceMappingURL=patch-vercel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-vercel.js","sourceRoot":"","sources":["../../../src/models/openai/patch-vercel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAEL,8BAA8B,GAC/B,MAAM,4BAA4B,CAAA;AAEnC,MAAM,oBAAoB,GAAG,CAC3B,WAAmB,EACnB,SAA8C,EAC9C,EAAE;IACF,OAAO;QACL,gBAAgB,WAA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