@modelprofile.com/flexharness-providers 7.0.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.
- package/dist_ts_media_openai/image.d.ts +46 -0
- package/dist_ts_media_openai/image.js +110 -0
- package/dist_ts_media_openai/index.d.ts +10 -0
- package/dist_ts_media_openai/index.js +16 -0
- package/dist_ts_media_openai/plugins.d.ts +3 -0
- package/dist_ts_media_openai/plugins.js +4 -0
- package/dist_ts_openai_account/index.d.ts +6 -0
- package/dist_ts_openai_account/index.js +7 -0
- package/dist_ts_openai_account/plugins.d.ts +7 -0
- package/dist_ts_openai_account/plugins.js +6 -0
- package/dist_ts_openai_account/smartai.providers.credentials.d.ts +7 -0
- package/dist_ts_openai_account/smartai.providers.credentials.js +126 -0
- package/dist_ts_openai_account/smartai.providers.error.d.ts +11 -0
- package/dist_ts_openai_account/smartai.providers.error.js +30 -0
- package/dist_ts_openai_account/smartai.providers.interfaces.d.ts +161 -0
- package/dist_ts_openai_account/smartai.providers.interfaces.js +2 -0
- package/dist_ts_openai_account/smartai.providers.openai.d.ts +29 -0
- package/dist_ts_openai_account/smartai.providers.openai.js +1075 -0
- package/dist_ts_openai_account/smartai.providers.registry.d.ts +11 -0
- package/dist_ts_openai_account/smartai.providers.registry.js +53 -0
- package/dist_ts_openai_auth/index.d.ts +6 -0
- package/dist_ts_openai_auth/index.js +10 -0
- package/dist_ts_openai_auth/interfaces.d.ts +71 -0
- package/dist_ts_openai_auth/interfaces.js +2 -0
- package/dist_ts_openai_auth/smartai.auth.openai.d.ts +34 -0
- package/dist_ts_openai_auth/smartai.auth.openai.js +603 -0
- package/dist_ts_openai_auth/smartai.middleware.openai.d.ts +6 -0
- package/dist_ts_openai_auth/smartai.middleware.openai.js +47 -0
- package/dist_ts_openai_auth_files/index.d.ts +43 -0
- package/dist_ts_openai_auth_files/index.js +377 -0
- package/dist_ts_openai_auth_files/plugins.d.ts +9 -0
- package/dist_ts_openai_auth_files/plugins.js +10 -0
- package/dist_ts_providers/anthropic/index.d.ts +8 -0
- package/dist_ts_providers/anthropic/index.js +13 -0
- package/dist_ts_providers/anthropic/plugins.d.ts +4 -0
- package/dist_ts_providers/anthropic/plugins.js +4 -0
- package/dist_ts_providers/anthropic/smartai.middleware.anthropic.d.ts +8 -0
- package/dist_ts_providers/anthropic/smartai.middleware.anthropic.js +10 -0
- package/dist_ts_providers/google/index.d.ts +5 -0
- package/dist_ts_providers/google/index.js +6 -0
- package/dist_ts_providers/google/plugins.d.ts +3 -0
- package/dist_ts_providers/google/plugins.js +3 -0
- package/dist_ts_providers/groq/index.d.ts +5 -0
- package/dist_ts_providers/groq/index.js +6 -0
- package/dist_ts_providers/groq/plugins.d.ts +3 -0
- package/dist_ts_providers/groq/plugins.js +3 -0
- package/dist_ts_providers/index.d.ts +8 -0
- package/dist_ts_providers/index.js +9 -0
- package/dist_ts_providers/mistral/index.d.ts +5 -0
- package/dist_ts_providers/mistral/index.js +6 -0
- package/dist_ts_providers/mistral/plugins.d.ts +3 -0
- package/dist_ts_providers/mistral/plugins.js +3 -0
- package/dist_ts_providers/ollama/index.d.ts +6 -0
- package/dist_ts_providers/ollama/index.js +7 -0
- package/dist_ts_providers/ollama/interfaces.d.ts +26 -0
- package/dist_ts_providers/ollama/interfaces.js +2 -0
- package/dist_ts_providers/ollama/smartai.provider.ollama.d.ts +8 -0
- package/dist_ts_providers/ollama/smartai.provider.ollama.js +378 -0
- package/dist_ts_providers/openai/index.d.ts +15 -0
- package/dist_ts_providers/openai/index.js +14 -0
- package/dist_ts_providers/openai/plugins.d.ts +6 -0
- package/dist_ts_providers/openai/plugins.js +4 -0
- package/dist_ts_providers/perplexity/index.d.ts +5 -0
- package/dist_ts_providers/perplexity/index.js +6 -0
- package/dist_ts_providers/perplexity/plugins.d.ts +3 -0
- package/dist_ts_providers/perplexity/plugins.js +3 -0
- package/dist_ts_providers/xai/index.d.ts +5 -0
- package/dist_ts_providers/xai/index.js +6 -0
- package/dist_ts_providers/xai/plugins.d.ts +3 -0
- package/dist_ts_providers/xai/plugins.js +3 -0
- package/dist_ts_research/index.d.ts +19 -0
- package/dist_ts_research/index.js +98 -0
- package/dist_ts_research/plugins.d.ts +2 -0
- package/dist_ts_research/plugins.js +3 -0
- package/license.md +21 -0
- package/openai-codex-license.txt +201 -0
- package/package.json +105 -0
- package/readme.md +62 -0
- package/third-party-notices.md +19 -0
- package/ts_media_openai/image.ts +147 -0
- package/ts_media_openai/index.ts +26 -0
- package/ts_media_openai/plugins.ts +3 -0
- package/ts_media_openai/readme.md +37 -0
- package/ts_openai_account/index.ts +11 -0
- package/ts_openai_account/plugins.ts +9 -0
- package/ts_openai_account/readme.md +37 -0
- package/ts_openai_account/smartai.providers.credentials.ts +163 -0
- package/ts_openai_account/smartai.providers.error.ts +49 -0
- package/ts_openai_account/smartai.providers.interfaces.ts +222 -0
- package/ts_openai_account/smartai.providers.openai.ts +1209 -0
- package/ts_openai_account/smartai.providers.registry.ts +57 -0
- package/ts_openai_auth/index.ts +12 -0
- package/ts_openai_auth/interfaces.ts +89 -0
- package/ts_openai_auth/readme.md +37 -0
- package/ts_openai_auth/smartai.auth.openai.ts +789 -0
- package/ts_openai_auth/smartai.middleware.openai.ts +55 -0
- package/ts_openai_auth_files/index.ts +499 -0
- package/ts_openai_auth_files/plugins.ts +13 -0
- package/ts_openai_auth_files/readme.md +37 -0
- package/ts_providers/anthropic/index.ts +20 -0
- package/ts_providers/anthropic/plugins.ts +4 -0
- package/ts_providers/anthropic/readme.md +37 -0
- package/ts_providers/anthropic/smartai.middleware.anthropic.ts +12 -0
- package/ts_providers/google/index.ts +8 -0
- package/ts_providers/google/plugins.ts +3 -0
- package/ts_providers/google/readme.md +37 -0
- package/ts_providers/groq/index.ts +8 -0
- package/ts_providers/groq/plugins.ts +3 -0
- package/ts_providers/groq/readme.md +37 -0
- package/ts_providers/index.ts +8 -0
- package/ts_providers/mistral/index.ts +8 -0
- package/ts_providers/mistral/plugins.ts +3 -0
- package/ts_providers/mistral/readme.md +37 -0
- package/ts_providers/ollama/index.ts +8 -0
- package/ts_providers/ollama/interfaces.ts +28 -0
- package/ts_providers/ollama/readme.md +37 -0
- package/ts_providers/ollama/smartai.provider.ollama.ts +426 -0
- package/ts_providers/openai/index.ts +29 -0
- package/ts_providers/openai/plugins.ts +6 -0
- package/ts_providers/openai/readme.md +37 -0
- package/ts_providers/perplexity/index.ts +8 -0
- package/ts_providers/perplexity/plugins.ts +3 -0
- package/ts_providers/perplexity/readme.md +37 -0
- package/ts_providers/readme.md +62 -0
- package/ts_providers/xai/index.ts +8 -0
- package/ts_providers/xai/plugins.ts +3 -0
- package/ts_providers/xai/readme.md +37 -0
- package/ts_research/index.ts +120 -0
- package/ts_research/plugins.ts +2 -0
- package/ts_research/readme.md +37 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
export async function research(options) {
|
|
3
|
+
const client = new plugins.Anthropic({ apiKey: options.apiKey });
|
|
4
|
+
const systemMessage = `You are a research assistant with web search capabilities.
|
|
5
|
+
Provide comprehensive, well-researched answers with citations and sources.
|
|
6
|
+
When searching the web, be thorough and cite your sources accurately.`;
|
|
7
|
+
// Build web search tool config
|
|
8
|
+
const webSearchTool = {
|
|
9
|
+
type: 'web_search_20250305',
|
|
10
|
+
name: 'web_search',
|
|
11
|
+
};
|
|
12
|
+
if (options.maxSources) {
|
|
13
|
+
webSearchTool.max_uses = options.maxSources;
|
|
14
|
+
}
|
|
15
|
+
if (options.allowedDomains?.length) {
|
|
16
|
+
webSearchTool.allowed_domains = options.allowedDomains;
|
|
17
|
+
}
|
|
18
|
+
else if (options.blockedDomains?.length) {
|
|
19
|
+
webSearchTool.blocked_domains = options.blockedDomains;
|
|
20
|
+
}
|
|
21
|
+
const result = await client.messages.create({
|
|
22
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
23
|
+
system: systemMessage,
|
|
24
|
+
messages: [
|
|
25
|
+
{ role: 'user', content: options.query },
|
|
26
|
+
],
|
|
27
|
+
max_tokens: 20000,
|
|
28
|
+
temperature: 0.7,
|
|
29
|
+
tools: [webSearchTool],
|
|
30
|
+
});
|
|
31
|
+
// Extract answer, sources, and search queries
|
|
32
|
+
let answer = '';
|
|
33
|
+
const sources = [];
|
|
34
|
+
const searchQueries = [];
|
|
35
|
+
for (const block of result.content) {
|
|
36
|
+
const b = block;
|
|
37
|
+
if ('text' in b) {
|
|
38
|
+
answer += b.text;
|
|
39
|
+
// Extract citations if present
|
|
40
|
+
if (b.citations && Array.isArray(b.citations)) {
|
|
41
|
+
for (const citation of b.citations) {
|
|
42
|
+
if (citation.type === 'web_search_result_location') {
|
|
43
|
+
sources.push({
|
|
44
|
+
title: citation.title || '',
|
|
45
|
+
url: citation.url || '',
|
|
46
|
+
snippet: citation.cited_text || '',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (b.type === 'server_tool_use') {
|
|
53
|
+
if (b.name === 'web_search' && b.input?.query) {
|
|
54
|
+
searchQueries.push(b.input.query);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (b.type === 'web_search_tool_result') {
|
|
58
|
+
if (Array.isArray(b.content)) {
|
|
59
|
+
for (const item of b.content) {
|
|
60
|
+
if (item.type === 'web_search_result') {
|
|
61
|
+
if (!sources.some(s => s.url === item.url)) {
|
|
62
|
+
sources.push({
|
|
63
|
+
title: item.title || '',
|
|
64
|
+
url: item.url || '',
|
|
65
|
+
snippet: '',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Fallback: parse markdown links if no citations found
|
|
74
|
+
if (sources.length === 0) {
|
|
75
|
+
const urlRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
76
|
+
let match;
|
|
77
|
+
while ((match = urlRegex.exec(answer)) !== null) {
|
|
78
|
+
sources.push({
|
|
79
|
+
title: match[1],
|
|
80
|
+
url: match[2],
|
|
81
|
+
snippet: '',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const usage = result.usage;
|
|
86
|
+
return {
|
|
87
|
+
answer,
|
|
88
|
+
sources,
|
|
89
|
+
searchQueries: searchQueries.length > 0 ? searchQueries : undefined,
|
|
90
|
+
metadata: {
|
|
91
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
92
|
+
searchDepth: options.searchDepth || 'basic',
|
|
93
|
+
tokensUsed: usage?.output_tokens,
|
|
94
|
+
webSearchesPerformed: usage?.server_tool_use?.web_search_requests ?? 0,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19yZXNlYXJjaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQWtCeEMsTUFBTSxDQUFDLEtBQUssVUFBVSxRQUFRLENBQUMsT0FBeUI7SUFDdEQsTUFBTSxNQUFNLEdBQUcsSUFBSSxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDO0lBRWpFLE1BQU0sYUFBYSxHQUFHOztzRUFFOEMsQ0FBQztJQUVyRSwrQkFBK0I7SUFDL0IsTUFBTSxhQUFhLEdBQVE7UUFDekIsSUFBSSxFQUFFLHFCQUFxQjtRQUMzQixJQUFJLEVBQUUsWUFBWTtLQUNuQixDQUFDO0lBRUYsSUFBSSxPQUFPLENBQUMsVUFBVSxFQUFFLENBQUM7UUFDdkIsYUFBYSxDQUFDLFFBQVEsR0FBRyxPQUFPL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0FBQyxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQyxTQUFTO1FBQ25FLFFBQVEsRUFBRTtZQUNSLEtBQUssRUFBRSw0QkFBNEI7WUFDbkMsV0FBVyxFQUFFLE9BQU8sQ0FBQyxXQUFXLElBQUksT0FBTztZQUMzQyxVQUFVLEVBQUUsS0FBSyxFQUFFLGFBQWE7WUFDaEMsb0JBQW9CLEVBQUUsS0FBSyxFQUFFLGVBQWUsRUFBRSxtQkFBbUIsSUFBSSxDQUFDO1NBQ3ZFO0tBQ0YsQ0FBQztBQUNKLENBQUMifQ==
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
2
|
+
export { Anthropic };
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3Jlc2VhcmNoL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxTQUFTLE1BQU0sbUJBQW1CLENBQUM7QUFDMUMsT0FBTyxFQUFFLFNBQVMsRUFBRSxDQUFDIn0=
|
package/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Task Venture Capital GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 OpenAI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/package.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Task Venture Capital GmbH",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"name": "@modelprofile.com/flexharness-providers",
|
|
5
|
+
"version": "7.0.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "Model providers, authentication, account management, media and research integrations in one package.",
|
|
8
|
+
"main": "./dist_ts_providers/index.js",
|
|
9
|
+
"types": "./dist_ts_providers/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist_ts_providers/index.d.ts",
|
|
13
|
+
"import": "./dist_ts_providers/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./anthropic": {
|
|
16
|
+
"types": "./dist_ts_providers/anthropic/index.d.ts",
|
|
17
|
+
"import": "./dist_ts_providers/anthropic/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./openai": {
|
|
20
|
+
"types": "./dist_ts_providers/openai/index.d.ts",
|
|
21
|
+
"import": "./dist_ts_providers/openai/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./google": {
|
|
24
|
+
"types": "./dist_ts_providers/google/index.d.ts",
|
|
25
|
+
"import": "./dist_ts_providers/google/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./groq": {
|
|
28
|
+
"types": "./dist_ts_providers/groq/index.d.ts",
|
|
29
|
+
"import": "./dist_ts_providers/groq/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./mistral": {
|
|
32
|
+
"types": "./dist_ts_providers/mistral/index.d.ts",
|
|
33
|
+
"import": "./dist_ts_providers/mistral/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./xai": {
|
|
36
|
+
"types": "./dist_ts_providers/xai/index.d.ts",
|
|
37
|
+
"import": "./dist_ts_providers/xai/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./perplexity": {
|
|
40
|
+
"types": "./dist_ts_providers/perplexity/index.d.ts",
|
|
41
|
+
"import": "./dist_ts_providers/perplexity/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./ollama": {
|
|
44
|
+
"types": "./dist_ts_providers/ollama/index.d.ts",
|
|
45
|
+
"import": "./dist_ts_providers/ollama/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./auth": {
|
|
48
|
+
"types": "./dist_ts_openai_auth/index.d.ts",
|
|
49
|
+
"import": "./dist_ts_openai_auth/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./accounts": {
|
|
52
|
+
"types": "./dist_ts_openai_account/index.d.ts",
|
|
53
|
+
"import": "./dist_ts_openai_account/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./auth/files": {
|
|
56
|
+
"types": "./dist_ts_openai_auth_files/index.d.ts",
|
|
57
|
+
"import": "./dist_ts_openai_auth_files/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./media": {
|
|
60
|
+
"types": "./dist_ts_media_openai/index.d.ts",
|
|
61
|
+
"import": "./dist_ts_media_openai/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./research": {
|
|
64
|
+
"types": "./dist_ts_research/index.d.ts",
|
|
65
|
+
"import": "./dist_ts_research/index.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@ai-sdk/anthropic": "^4.0.42",
|
|
70
|
+
"@ai-sdk/google": "^4.0.51",
|
|
71
|
+
"@ai-sdk/groq": "^4.0.31",
|
|
72
|
+
"@ai-sdk/mistral": "^4.0.33",
|
|
73
|
+
"@ai-sdk/openai": "^4.0.47",
|
|
74
|
+
"@ai-sdk/perplexity": "^4.0.32",
|
|
75
|
+
"@ai-sdk/provider": "^4.0.8",
|
|
76
|
+
"@ai-sdk/xai": "^4.0.44",
|
|
77
|
+
"@anthropic-ai/sdk": "0.95.2",
|
|
78
|
+
"@modelprofile.com/flexharness-models": "7.0.0",
|
|
79
|
+
"ai": "^7.0.79",
|
|
80
|
+
"openai": "^6.37.0",
|
|
81
|
+
"proper-lockfile": "^4.1.2"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=24"
|
|
85
|
+
},
|
|
86
|
+
"sideEffects": false,
|
|
87
|
+
"files": [
|
|
88
|
+
"ts_providers",
|
|
89
|
+
"dist_ts_providers",
|
|
90
|
+
"ts_openai_auth",
|
|
91
|
+
"dist_ts_openai_auth",
|
|
92
|
+
"ts_openai_account",
|
|
93
|
+
"dist_ts_openai_account",
|
|
94
|
+
"ts_openai_auth_files",
|
|
95
|
+
"dist_ts_openai_auth_files",
|
|
96
|
+
"ts_media_openai",
|
|
97
|
+
"dist_ts_media_openai",
|
|
98
|
+
"ts_research",
|
|
99
|
+
"dist_ts_research",
|
|
100
|
+
"openai-codex-license.txt",
|
|
101
|
+
"third-party-notices.md",
|
|
102
|
+
"readme.md",
|
|
103
|
+
"license.md"
|
|
104
|
+
]
|
|
105
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
FlexHarness Providers supplies all model adapters and provider capabilities in one package. Import a specific subpath to select the implementation you use.
|
|
2
|
+
|
|
3
|
+
## Issue Reporting and Security
|
|
4
|
+
|
|
5
|
+
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
|
6
|
+
|
|
7
|
+
## Install and use
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @modelprofile.com/flexharness-providers @modelprofile.com/flexharness-models
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ModelRegistry } from '@modelprofile.com/flexharness-models';
|
|
15
|
+
import { createOpenAiModelProvider } from '@modelprofile.com/flexharness-providers/openai';
|
|
16
|
+
|
|
17
|
+
const models = new ModelRegistry().register(createOpenAiModelProvider());
|
|
18
|
+
const model = models.getModel({ provider: 'openai', model: 'gpt-5.5', apiKey: process.env.OPENAI_API_KEY });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Provider subpaths
|
|
22
|
+
|
|
23
|
+
Install `@modelprofile.com/flexharness-providers` once. Its root exports all provider
|
|
24
|
+
factories; use a provider subpath to import just that implementation.
|
|
25
|
+
|
|
26
|
+
| Import suffix | Capability |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `/anthropic`, `/openai`, `/google`, `/groq`, `/mistral`, `/xai`, `/perplexity`, `/ollama` | Model adapters and their request types |
|
|
29
|
+
| `/auth` | ChatGPT browser/device authentication, refresh and model connections |
|
|
30
|
+
| `/accounts` | Account lifecycle, model catalogs, rate limits and credential envelopes |
|
|
31
|
+
| `/auth/files` | Explicit interoperability with external credential files |
|
|
32
|
+
| `/media` | OpenAI audio and image generation |
|
|
33
|
+
| `/research` | Anthropic research utilities |
|
|
34
|
+
|
|
35
|
+
Provider SDKs are installed together. Authentication, file access and vendor media
|
|
36
|
+
are separate entrypoints and are not imported by the provider factory root. For
|
|
37
|
+
ChatGPT authentication, pass
|
|
38
|
+
`connection: createOpenAiChatGptModelConnection(credentials)` from `/auth` to the
|
|
39
|
+
OpenAI model options. API-key inference needs no authentication setup.
|
|
40
|
+
|
|
41
|
+
The package includes the applicable OpenAI Codex license and third-party notices.
|
|
42
|
+
|
|
43
|
+
## License and Legal Information
|
|
44
|
+
|
|
45
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
|
|
46
|
+
|
|
47
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
### Trademarks
|
|
50
|
+
|
|
51
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
52
|
+
|
|
53
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
54
|
+
|
|
55
|
+
### Company Information
|
|
56
|
+
|
|
57
|
+
Task Venture Capital GmbH<br>
|
|
58
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
59
|
+
|
|
60
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
61
|
+
|
|
62
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
## OpenAI Codex
|
|
4
|
+
|
|
5
|
+
OpenAI Codex
|
|
6
|
+
Copyright 2025 OpenAI
|
|
7
|
+
|
|
8
|
+
The OpenAI ChatGPT browser authentication protocol, account-aware Codex model
|
|
9
|
+
catalog, and account rate-limit wire contracts in this package are adapted in
|
|
10
|
+
TypeScript from
|
|
11
|
+
OpenAI Codex rust-v0.146.1, commit
|
|
12
|
+
`79b4f03d35962b005b007a015113b38930711665`:
|
|
13
|
+
https://github.com/openai/codex
|
|
14
|
+
|
|
15
|
+
The affected TypeScript files contain modifications and integration work
|
|
16
|
+
copyright 2026 Task Venture Capital GmbH.
|
|
17
|
+
|
|
18
|
+
OpenAI Codex is licensed under the Apache License, Version 2.0. A verbatim copy
|
|
19
|
+
of the upstream license is distributed in [openai-codex-license.txt](./openai-codex-license.txt).
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export interface IImageGenerateOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
prompt: string;
|
|
6
|
+
model?: 'gpt-image-1' | 'dall-e-3' | 'dall-e-2';
|
|
7
|
+
quality?: 'low' | 'medium' | 'high' | 'standard' | 'hd' | 'auto';
|
|
8
|
+
size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | '1792x1024' | '1024x1792' | 'auto';
|
|
9
|
+
style?: 'vivid' | 'natural';
|
|
10
|
+
background?: 'transparent' | 'opaque' | 'auto';
|
|
11
|
+
outputFormat?: 'png' | 'jpeg' | 'webp';
|
|
12
|
+
outputCompression?: number;
|
|
13
|
+
moderation?: 'low' | 'auto';
|
|
14
|
+
n?: number;
|
|
15
|
+
stream?: boolean;
|
|
16
|
+
partialImages?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IImageEditOptions {
|
|
20
|
+
apiKey: string;
|
|
21
|
+
image: Buffer;
|
|
22
|
+
prompt: string;
|
|
23
|
+
mask?: Buffer;
|
|
24
|
+
model?: 'gpt-image-1' | 'dall-e-2';
|
|
25
|
+
quality?: 'low' | 'medium' | 'high' | 'standard' | 'auto';
|
|
26
|
+
size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto';
|
|
27
|
+
background?: 'transparent' | 'opaque' | 'auto';
|
|
28
|
+
outputFormat?: 'png' | 'jpeg' | 'webp';
|
|
29
|
+
outputCompression?: number;
|
|
30
|
+
n?: number;
|
|
31
|
+
stream?: boolean;
|
|
32
|
+
partialImages?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IImageResponse {
|
|
36
|
+
images: Array<{
|
|
37
|
+
b64_json?: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
revisedPrompt?: string;
|
|
40
|
+
}>;
|
|
41
|
+
metadata?: {
|
|
42
|
+
model: string;
|
|
43
|
+
quality?: string;
|
|
44
|
+
size?: string;
|
|
45
|
+
outputFormat?: string;
|
|
46
|
+
tokensUsed?: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function generateImage(options: IImageGenerateOptions): Promise<IImageResponse> {
|
|
51
|
+
const client = new plugins.OpenAI({ apiKey: options.apiKey });
|
|
52
|
+
const model = options.model || 'gpt-image-1';
|
|
53
|
+
|
|
54
|
+
const requestParams: Record<string, unknown> = {
|
|
55
|
+
model,
|
|
56
|
+
prompt: options.prompt,
|
|
57
|
+
n: options.n || 1,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (model === 'gpt-image-1') {
|
|
61
|
+
if (options.quality) requestParams.quality = options.quality;
|
|
62
|
+
if (options.size) requestParams.size = options.size;
|
|
63
|
+
if (options.background) requestParams.background = options.background;
|
|
64
|
+
if (options.outputFormat) requestParams.output_format = options.outputFormat;
|
|
65
|
+
if (options.outputCompression !== undefined) requestParams.output_compression = options.outputCompression;
|
|
66
|
+
if (options.moderation) requestParams.moderation = options.moderation;
|
|
67
|
+
if (options.stream !== undefined) requestParams.stream = options.stream;
|
|
68
|
+
if (options.partialImages !== undefined) requestParams.partial_images = options.partialImages;
|
|
69
|
+
} else if (model === 'dall-e-3') {
|
|
70
|
+
if (options.quality) requestParams.quality = options.quality;
|
|
71
|
+
if (options.size) requestParams.size = options.size;
|
|
72
|
+
if (options.style) requestParams.style = options.style;
|
|
73
|
+
requestParams.response_format = 'b64_json';
|
|
74
|
+
} else if (model === 'dall-e-2') {
|
|
75
|
+
if (options.size) requestParams.size = options.size;
|
|
76
|
+
requestParams.response_format = 'b64_json';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const result: any = await client.images.generate(requestParams as any);
|
|
80
|
+
|
|
81
|
+
const images = (result.data || []).map((img: any) => ({
|
|
82
|
+
b64_json: img.b64_json,
|
|
83
|
+
url: img.url,
|
|
84
|
+
revisedPrompt: img.revised_prompt,
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
images,
|
|
89
|
+
metadata: {
|
|
90
|
+
model,
|
|
91
|
+
quality: result.quality,
|
|
92
|
+
size: result.size,
|
|
93
|
+
outputFormat: result.output_format,
|
|
94
|
+
tokensUsed: result.usage?.total_tokens,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function editImage(options: IImageEditOptions): Promise<IImageResponse> {
|
|
100
|
+
const client = new plugins.OpenAI({ apiKey: options.apiKey });
|
|
101
|
+
const model = options.model || 'gpt-image-1';
|
|
102
|
+
|
|
103
|
+
const imageFile = await plugins.toFile(options.image, 'image.png', { type: 'image/png' });
|
|
104
|
+
|
|
105
|
+
const requestParams: Record<string, unknown> = {
|
|
106
|
+
model,
|
|
107
|
+
image: imageFile,
|
|
108
|
+
prompt: options.prompt,
|
|
109
|
+
n: options.n || 1,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
if (options.mask) {
|
|
113
|
+
requestParams.mask = await plugins.toFile(options.mask, 'mask.png', { type: 'image/png' });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (model === 'gpt-image-1') {
|
|
117
|
+
if (options.quality) requestParams.quality = options.quality;
|
|
118
|
+
if (options.size) requestParams.size = options.size;
|
|
119
|
+
if (options.background) requestParams.background = options.background;
|
|
120
|
+
if (options.outputFormat) requestParams.output_format = options.outputFormat;
|
|
121
|
+
if (options.outputCompression !== undefined) requestParams.output_compression = options.outputCompression;
|
|
122
|
+
if (options.stream !== undefined) requestParams.stream = options.stream;
|
|
123
|
+
if (options.partialImages !== undefined) requestParams.partial_images = options.partialImages;
|
|
124
|
+
} else if (model === 'dall-e-2') {
|
|
125
|
+
if (options.size) requestParams.size = options.size;
|
|
126
|
+
requestParams.response_format = 'b64_json';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const result: any = await client.images.edit(requestParams as any);
|
|
130
|
+
|
|
131
|
+
const images = (result.data || []).map((img: any) => ({
|
|
132
|
+
b64_json: img.b64_json,
|
|
133
|
+
url: img.url,
|
|
134
|
+
revisedPrompt: img.revised_prompt,
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
images,
|
|
139
|
+
metadata: {
|
|
140
|
+
model,
|
|
141
|
+
quality: result.quality,
|
|
142
|
+
size: result.size,
|
|
143
|
+
outputFormat: result.output_format,
|
|
144
|
+
tokensUsed: result.usage?.total_tokens,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|