@volter/twin-standard 1.0.82 → 1.0.83
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { chatCases } from "./openai-compatible.js";
|
|
2
2
|
const CHAT = 'https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create';
|
|
3
3
|
const REALTIME = 'https://developers.openai.com/api/reference/resources/realtime/server-events';
|
|
4
|
+
const API = 'https://api.openai.com/v1';
|
|
4
5
|
async function client(c) {
|
|
5
6
|
const { default: OpenAI } = await import('openai');
|
|
6
|
-
return new OpenAI({ apiKey: c.env.OPENAI_API_KEY ?? '', baseURL:
|
|
7
|
+
return new OpenAI({ apiKey: c.env.OPENAI_API_KEY ?? '', baseURL: API, fetch: c.fetch, maxRetries: 0, timeout: 10_000 });
|
|
7
8
|
}
|
|
8
9
|
const TOOLS = [{ type: 'function', function: { name: 'lookup', parameters: { type: 'object', properties: {} } } }];
|
|
9
10
|
// a turn that calls the tool wherever one is offered, and one that answers in words
|
|
@@ -37,7 +38,7 @@ async function realtimeTurn(c, toolChoice) {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
export const cases = [
|
|
40
|
-
...chatCases({ key: 'OPENAI_API_KEY', base: (
|
|
41
|
+
...chatCases({ key: 'OPENAI_API_KEY', base: () => API, model: 'gpt-4o' }),
|
|
41
42
|
{
|
|
42
43
|
id: 'realtime-connects',
|
|
43
44
|
asks: 'a Realtime connection opens and its first event is session.created',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/twin-standard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.83",
|
|
4
4
|
"description": "The Protocol 3 standard for Volter twin packs: the criteria a pack is graded by, the grader, the gate a pack repository and the twin catalog run on every change and submission, and the spec derivation the grade checks against. Pin a version: every place a pack is judged judges by that standard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twin",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"yaml": "2.9.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@volter/world-core": "3.0.
|
|
78
|
+
"@volter/world-core": "3.0.91",
|
|
79
79
|
"@volter/world-runtime": "*",
|
|
80
80
|
"playwright": "^1.63.0"
|
|
81
81
|
},
|
package/src/clients/openai.ts
CHANGED
|
@@ -5,10 +5,11 @@ import { chatCases } from './openai-compatible.ts';
|
|
|
5
5
|
|
|
6
6
|
const CHAT = 'https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create';
|
|
7
7
|
const REALTIME = 'https://developers.openai.com/api/reference/resources/realtime/server-events';
|
|
8
|
+
const API = 'https://api.openai.com/v1';
|
|
8
9
|
|
|
9
10
|
async function client(c: ClientContext) {
|
|
10
11
|
const { default: OpenAI } = await import('openai');
|
|
11
|
-
return new OpenAI({ apiKey: c.env.OPENAI_API_KEY ?? '', baseURL:
|
|
12
|
+
return new OpenAI({ apiKey: c.env.OPENAI_API_KEY ?? '', baseURL: API, fetch: c.fetch, maxRetries: 0, timeout: 10_000 });
|
|
12
13
|
}
|
|
13
14
|
const TOOLS = [{ type: 'function' as const, function: { name: 'lookup', parameters: { type: 'object', properties: {} } } }];
|
|
14
15
|
// a turn that calls the tool wherever one is offered, and one that answers in words
|
|
@@ -40,7 +41,7 @@ async function realtimeTurn(c: ClientContext, toolChoice: 'auto' | 'none'): Prom
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export const cases: ClientCase[] = [
|
|
43
|
-
...chatCases({ key: 'OPENAI_API_KEY', base: (
|
|
44
|
+
...chatCases({ key: 'OPENAI_API_KEY', base: () => API, model: 'gpt-4o' }),
|
|
44
45
|
{
|
|
45
46
|
id: 'realtime-connects',
|
|
46
47
|
asks: 'a Realtime connection opens and its first event is session.created',
|