@workglow/openai 0.4.9 → 0.5.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/ai/common/OpenAI_ModelSearch.d.ts.map +1 -1
- package/dist/ai-runtime.browser.js +33 -36
- package/dist/ai-runtime.browser.js.map +5 -5
- package/dist/ai-runtime.js +33 -36
- package/dist/ai-runtime.js.map +5 -5
- package/dist/ai.js +32 -36
- package/dist/ai.js.map +3 -3
- package/dist/web-search/OpenAiWebSearchProvider.d.ts +36 -0
- package/dist/web-search/OpenAiWebSearchProvider.d.ts.map +1 -0
- package/dist/web-search.d.ts +9 -0
- package/dist/web-search.d.ts.map +1 -0
- package/dist/web-search.js +108 -0
- package/dist/web-search.js.map +11 -0
- package/package.json +24 -14
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IExecuteContext } from "@workglow/task-graph";
|
|
7
|
+
import type { IWebSearchProvider, WebSearchCapabilities, WebSearchRequest, WebSearchResponse } from "@workglow/web-search";
|
|
8
|
+
import OpenAI from "openai";
|
|
9
|
+
export interface OpenAiWebSearchOptions {
|
|
10
|
+
readonly client?: OpenAI | undefined;
|
|
11
|
+
readonly apiKey?: string | undefined;
|
|
12
|
+
readonly model?: string | undefined;
|
|
13
|
+
/** How much context window the search may spend. */
|
|
14
|
+
readonly searchContextSize?: "low" | "medium" | "high" | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare class OpenAiWebSearchProvider implements IWebSearchProvider {
|
|
17
|
+
readonly name = "openai";
|
|
18
|
+
/** Reached through the vendor SDK, not a fetch this package owns. */
|
|
19
|
+
readonly endpoint: undefined;
|
|
20
|
+
/** The SDK carries the key; `credentialKey` never reaches this request. */
|
|
21
|
+
readonly acceptsCredentialKey = false;
|
|
22
|
+
readonly capabilities: WebSearchCapabilities;
|
|
23
|
+
private client;
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly model;
|
|
26
|
+
private readonly searchContextSize;
|
|
27
|
+
constructor(options?: OpenAiWebSearchOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Built on first search, not in the constructor, so registering the provider
|
|
30
|
+
* cannot throw out of the vendor SDK on a machine that has no key yet, and a
|
|
31
|
+
* missing key reports through this repo's named error rather than the SDK's.
|
|
32
|
+
*/
|
|
33
|
+
private getClient;
|
|
34
|
+
search(request: WebSearchRequest, context: IExecuteContext): Promise<WebSearchResponse>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=OpenAiWebSearchProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAiWebSearchProvider.d.ts","sourceRoot":"","sources":["../../src/web-search/OpenAiWebSearchProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EACV,kBAAkB,EAElB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,oDAAoD;IACpD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;CACpE;AAQD,qBAAa,uBAAwB,YAAW,kBAAkB;IAChE,SAAgB,IAAI,YAAY;IAChC,qEAAqE;IACrE,SAAgB,QAAQ,YAAa;IACrC,2EAA2E;IAC3E,SAAgB,oBAAoB,SAAS;IAC7C,SAAgB,YAAY,EAAE,qBAAqB,CASjD;IAEF,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAwC;IAE1E,YAAY,OAAO,GAAE,sBAA2B,EAK/C;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAWX,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqE5F;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { OpenAiWebSearchOptions } from "./web-search/OpenAiWebSearchProvider";
|
|
7
|
+
export * from "./web-search/OpenAiWebSearchProvider";
|
|
8
|
+
export declare function registerOpenAiWebSearchProvider(options?: OpenAiWebSearchOptions): void;
|
|
9
|
+
//# sourceMappingURL=web-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search.d.ts","sourceRoot":"","sources":["../src/web-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAGnF,cAAc,sCAAsC,CAAC;AAErD,wBAAgB,+BAA+B,CAAC,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAE1F"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/web-search.ts
|
|
2
|
+
import { registerWebSearchProvider } from "@workglow/web-search";
|
|
3
|
+
|
|
4
|
+
// src/web-search/OpenAiWebSearchProvider.ts
|
|
5
|
+
import { resolveApiKey } from "@workglow/ai/provider-utils";
|
|
6
|
+
import { TaskFailedError } from "@workglow/task-graph";
|
|
7
|
+
import { limitResults } from "@workglow/web-search";
|
|
8
|
+
import OpenAI from "openai";
|
|
9
|
+
var DEFAULT_MODEL = "gpt-5.5";
|
|
10
|
+
|
|
11
|
+
class OpenAiWebSearchProvider {
|
|
12
|
+
name = "openai";
|
|
13
|
+
endpoint = undefined;
|
|
14
|
+
acceptsCredentialKey = false;
|
|
15
|
+
capabilities = {
|
|
16
|
+
answer: true,
|
|
17
|
+
content: false,
|
|
18
|
+
domainFilter: "native",
|
|
19
|
+
excludeDomainFilter: false,
|
|
20
|
+
dateFilter: false,
|
|
21
|
+
maxResultsCap: undefined
|
|
22
|
+
};
|
|
23
|
+
client;
|
|
24
|
+
apiKey;
|
|
25
|
+
model;
|
|
26
|
+
searchContextSize;
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.client = options.client;
|
|
29
|
+
this.apiKey = options.apiKey;
|
|
30
|
+
this.model = options.model ?? DEFAULT_MODEL;
|
|
31
|
+
this.searchContextSize = options.searchContextSize;
|
|
32
|
+
}
|
|
33
|
+
getClient() {
|
|
34
|
+
this.client ??= new OpenAI({
|
|
35
|
+
apiKey: resolveApiKey({
|
|
36
|
+
config: { api_key: this.apiKey },
|
|
37
|
+
envVar: "OPENAI_API_KEY",
|
|
38
|
+
providerLabel: "OpenAI"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
return this.client;
|
|
42
|
+
}
|
|
43
|
+
async search(request, context) {
|
|
44
|
+
context.signal.throwIfAborted();
|
|
45
|
+
const client = this.getClient();
|
|
46
|
+
const tool = { type: "web_search" };
|
|
47
|
+
if (this.searchContextSize !== undefined)
|
|
48
|
+
tool.search_context_size = this.searchContextSize;
|
|
49
|
+
if (request.includeDomains?.length) {
|
|
50
|
+
tool.filters = { allowed_domains: [...request.includeDomains] };
|
|
51
|
+
}
|
|
52
|
+
const response = await client.responses.create({
|
|
53
|
+
model: this.model,
|
|
54
|
+
input: request.query,
|
|
55
|
+
tools: [tool]
|
|
56
|
+
}, { signal: context.signal });
|
|
57
|
+
if (!Array.isArray(response.output)) {
|
|
58
|
+
throw new TaskFailedError("OpenAiWebSearchProvider: response carried no output array.");
|
|
59
|
+
}
|
|
60
|
+
const results = [];
|
|
61
|
+
const answerParts = [];
|
|
62
|
+
const seen = new Set;
|
|
63
|
+
for (const item of response.output) {
|
|
64
|
+
if (item.type !== "message")
|
|
65
|
+
continue;
|
|
66
|
+
for (const part of item.content ?? []) {
|
|
67
|
+
if (typeof part.text === "string")
|
|
68
|
+
answerParts.push(part.text);
|
|
69
|
+
for (const annotation of part.annotations ?? []) {
|
|
70
|
+
if (annotation.type !== "url_citation" || annotation.url === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
if (seen.has(annotation.url))
|
|
73
|
+
continue;
|
|
74
|
+
seen.add(annotation.url);
|
|
75
|
+
results.push({
|
|
76
|
+
title: annotation.title ?? annotation.url,
|
|
77
|
+
url: annotation.url,
|
|
78
|
+
snippet: undefined,
|
|
79
|
+
content: undefined,
|
|
80
|
+
publishedDate: undefined,
|
|
81
|
+
score: undefined,
|
|
82
|
+
favicon: undefined
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
results: limitResults(results, request.maxResults),
|
|
89
|
+
answer: request.includeAnswer === true && answerParts.length > 0 ? answerParts.join("") : undefined,
|
|
90
|
+
query: request.query,
|
|
91
|
+
usage: {
|
|
92
|
+
inputTokens: response.usage?.input_tokens,
|
|
93
|
+
outputTokens: response.usage?.output_tokens
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/web-search.ts
|
|
100
|
+
function registerOpenAiWebSearchProvider(options = {}) {
|
|
101
|
+
registerWebSearchProvider(new OpenAiWebSearchProvider(options));
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
OpenAiWebSearchProvider,
|
|
105
|
+
registerOpenAiWebSearchProvider
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//# debugId=F0A7BFD02699B47064756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/web-search.ts", "../src/web-search/OpenAiWebSearchProvider.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * @license\n * Copyright 2026 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { registerWebSearchProvider } from \"@workglow/web-search\";\nimport type { OpenAiWebSearchOptions } from \"./web-search/OpenAiWebSearchProvider\";\nimport { OpenAiWebSearchProvider } from \"./web-search/OpenAiWebSearchProvider\";\n\nexport * from \"./web-search/OpenAiWebSearchProvider\";\n\nexport function registerOpenAiWebSearchProvider(options: OpenAiWebSearchOptions = {}): void {\n registerWebSearchProvider(new OpenAiWebSearchProvider(options));\n}\n",
|
|
6
|
+
"/**\n * @license\n * Copyright 2026 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { resolveApiKey } from \"@workglow/ai/provider-utils\";\nimport type { IExecuteContext } from \"@workglow/task-graph\";\nimport { TaskFailedError } from \"@workglow/task-graph\";\nimport type {\n IWebSearchProvider,\n SearchResult,\n WebSearchCapabilities,\n WebSearchRequest,\n WebSearchResponse,\n} from \"@workglow/web-search\";\nimport { limitResults } from \"@workglow/web-search\";\nimport OpenAI from \"openai\";\n\nconst DEFAULT_MODEL = \"gpt-5.5\";\n\nexport interface OpenAiWebSearchOptions {\n readonly client?: OpenAI | undefined;\n readonly apiKey?: string | undefined;\n readonly model?: string | undefined;\n /** How much context window the search may spend. */\n readonly searchContextSize?: \"low\" | \"medium\" | \"high\" | undefined;\n}\n\ninterface UrlCitation {\n readonly type?: string;\n readonly url?: string;\n readonly title?: string;\n}\n\nexport class OpenAiWebSearchProvider implements IWebSearchProvider {\n public readonly name = \"openai\";\n /** Reached through the vendor SDK, not a fetch this package owns. */\n public readonly endpoint = undefined;\n /** The SDK carries the key; `credentialKey` never reaches this request. */\n public readonly acceptsCredentialKey = false;\n public readonly capabilities: WebSearchCapabilities = {\n answer: true,\n content: false,\n domainFilter: \"native\",\n // `filters` carries allowed_domains only — there is no blocked equivalent,\n // so exclusion is refused rather than accepted and quietly dropped.\n excludeDomainFilter: false,\n dateFilter: false,\n maxResultsCap: undefined,\n };\n\n private client: OpenAI | undefined;\n private readonly apiKey: string | undefined;\n private readonly model: string;\n private readonly searchContextSize: \"low\" | \"medium\" | \"high\" | undefined;\n\n constructor(options: OpenAiWebSearchOptions = {}) {\n this.client = options.client;\n this.apiKey = options.apiKey;\n this.model = options.model ?? DEFAULT_MODEL;\n this.searchContextSize = options.searchContextSize;\n }\n\n /**\n * Built on first search, not in the constructor, so registering the provider\n * cannot throw out of the vendor SDK on a machine that has no key yet, and a\n * missing key reports through this repo's named error rather than the SDK's.\n */\n private getClient(): OpenAI {\n this.client ??= new OpenAI({\n apiKey: resolveApiKey({\n config: { api_key: this.apiKey },\n envVar: \"OPENAI_API_KEY\",\n providerLabel: \"OpenAI\",\n }),\n });\n return this.client;\n }\n\n async search(request: WebSearchRequest, context: IExecuteContext): Promise<WebSearchResponse> {\n context.signal.throwIfAborted();\n const client = this.getClient();\n\n const tool: Record<string, unknown> = { type: \"web_search\" };\n if (this.searchContextSize !== undefined) tool.search_context_size = this.searchContextSize;\n if (request.includeDomains?.length) {\n tool.filters = { allowed_domains: [...request.includeDomains] };\n }\n\n const response = (await client.responses.create(\n {\n model: this.model,\n input: request.query,\n tools: [tool] as never,\n } as never,\n { signal: context.signal }\n )) as {\n output?: readonly {\n type?: string;\n content?: readonly { type?: string; text?: string; annotations?: readonly UrlCitation[] }[];\n }[];\n usage?: { input_tokens?: number; output_tokens?: number };\n };\n\n if (!Array.isArray(response.output)) {\n throw new TaskFailedError(\"OpenAiWebSearchProvider: response carried no output array.\");\n }\n\n const results: SearchResult[] = [];\n const answerParts: string[] = [];\n const seen = new Set<string>();\n\n for (const item of response.output) {\n if (item.type !== \"message\") continue;\n for (const part of item.content ?? []) {\n if (typeof part.text === \"string\") answerParts.push(part.text);\n for (const annotation of part.annotations ?? []) {\n if (annotation.type !== \"url_citation\" || annotation.url === undefined) continue;\n // One source is cited at every span it supports, so the annotation\n // list repeats it; results are a source list, not a citation list.\n if (seen.has(annotation.url)) continue;\n seen.add(annotation.url);\n results.push({\n title: annotation.title ?? annotation.url,\n url: annotation.url,\n snippet: undefined,\n content: undefined,\n publishedDate: undefined,\n score: undefined,\n favicon: undefined,\n });\n }\n }\n }\n\n return {\n // The Responses API takes no result limit of its own — a grounded turn\n // can cite fifteen sources for a caller who asked for three — so the\n // bound is applied here rather than dropped.\n results: limitResults(results, request.maxResults),\n answer:\n request.includeAnswer === true && answerParts.length > 0 ? answerParts.join(\"\") : undefined,\n query: request.query,\n usage: {\n inputTokens: response.usage?.input_tokens,\n outputTokens: response.usage?.output_tokens,\n },\n };\n }\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": "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",
|
|
9
|
+
"debugId": "F0A7BFD02699B47064756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workglow/openai",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -16,15 +16,16 @@
|
|
|
16
16
|
"homepage": "https://workglow.dev",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
19
|
-
"watch-code": "bun build --watch --no-clear-screen --sourcemap=external --packages=external --root ./src --outdir ./dist ./src/ai.ts ./src/ai-runtime.ts",
|
|
19
|
+
"watch-code": "bun build --watch --no-clear-screen --sourcemap=external --packages=external --root ./src --outdir ./dist ./src/ai.ts ./src/ai-runtime.ts ./src/web-search.ts",
|
|
20
20
|
"watch-browser": "bun build --watch --no-clear-screen --target=browser --sourcemap=external --packages=external --outdir ./dist ./src/ai.browser.ts ./src/ai-runtime.browser.ts",
|
|
21
21
|
"watch-types": "tsc --watch --preserveWatchOutput",
|
|
22
22
|
"build-package": "concurrently -c 'auto' -n 'code,browser,types' 'bun run build-code' 'bun run build-browser' 'bun run build-types'",
|
|
23
23
|
"build-js": "concurrently -m 12 --timings -c 'auto' -n 'code,browser' 'bun run build-code' 'bun run build-browser'",
|
|
24
24
|
"build-clean": "rm -fr dist/* tsconfig.tsbuildinfo",
|
|
25
|
-
"build-code": "bun build --sourcemap=external --packages=external --root ./src --outdir ./dist ./src/ai.ts ./src/ai-runtime.ts",
|
|
25
|
+
"build-code": "bun build --sourcemap=external --packages=external --root ./src --outdir ./dist ./src/ai.ts ./src/ai-runtime.ts ./src/web-search.ts",
|
|
26
26
|
"build-browser": "bun build --target=browser --sourcemap=external --packages=external --outdir ./dist ./src/ai.browser.ts ./src/ai-runtime.browser.ts",
|
|
27
|
-
"build-types": "rm -f tsconfig.tsbuildinfo && tsc"
|
|
27
|
+
"build-types": "rm -f tsconfig.tsbuildinfo && tsc",
|
|
28
|
+
"test": "vitest run --config ../../vitest.config.ts --project openai"
|
|
28
29
|
},
|
|
29
30
|
"exports": {
|
|
30
31
|
"./ai": {
|
|
@@ -42,6 +43,10 @@
|
|
|
42
43
|
},
|
|
43
44
|
"types": "./dist/ai-runtime.d.ts",
|
|
44
45
|
"import": "./dist/ai-runtime.js"
|
|
46
|
+
},
|
|
47
|
+
"./web-search": {
|
|
48
|
+
"types": "./dist/web-search.d.ts",
|
|
49
|
+
"import": "./dist/web-search.js"
|
|
45
50
|
}
|
|
46
51
|
},
|
|
47
52
|
"dependencies": {
|
|
@@ -50,11 +55,12 @@
|
|
|
50
55
|
"js-tiktoken": "^1.0.21"
|
|
51
56
|
},
|
|
52
57
|
"peerDependencies": {
|
|
53
|
-
"@workglow/ai": "0.
|
|
54
|
-
"@workglow/job-queue": "0.
|
|
55
|
-
"@workglow/storage": "0.
|
|
56
|
-
"@workglow/task-graph": "0.
|
|
57
|
-
"@workglow/util": "0.
|
|
58
|
+
"@workglow/ai": "0.5.0",
|
|
59
|
+
"@workglow/job-queue": "0.5.0",
|
|
60
|
+
"@workglow/storage": "0.5.0",
|
|
61
|
+
"@workglow/task-graph": "0.5.0",
|
|
62
|
+
"@workglow/util": "0.5.0",
|
|
63
|
+
"@workglow/web-search": "0.5.0"
|
|
58
64
|
},
|
|
59
65
|
"peerDependenciesMeta": {
|
|
60
66
|
"@workglow/ai": {
|
|
@@ -71,14 +77,18 @@
|
|
|
71
77
|
},
|
|
72
78
|
"@workglow/util": {
|
|
73
79
|
"optional": false
|
|
80
|
+
},
|
|
81
|
+
"@workglow/web-search": {
|
|
82
|
+
"optional": true
|
|
74
83
|
}
|
|
75
84
|
},
|
|
76
85
|
"devDependencies": {
|
|
77
|
-
"@workglow/ai": "0.
|
|
78
|
-
"@workglow/job-queue": "0.
|
|
79
|
-
"@workglow/storage": "0.
|
|
80
|
-
"@workglow/task-graph": "0.
|
|
81
|
-
"@workglow/util": "0.
|
|
86
|
+
"@workglow/ai": "0.5.0",
|
|
87
|
+
"@workglow/job-queue": "0.5.0",
|
|
88
|
+
"@workglow/storage": "0.5.0",
|
|
89
|
+
"@workglow/task-graph": "0.5.0",
|
|
90
|
+
"@workglow/util": "0.5.0",
|
|
91
|
+
"@workglow/web-search": "0.5.0"
|
|
82
92
|
},
|
|
83
93
|
"files": [
|
|
84
94
|
"dist",
|