Skip to content

Commit 1450b40

Browse files
committed
Consistently use node: prefix in example apps
1 parent fc99390 commit 1450b40

File tree

8 files changed

+13
-17
lines changed

8 files changed

+13
-17
lines changed

examples/agent-patterns/routing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
StreamedRunResult,
77
} from '@openai/agents';
88
import readline from 'node:readline/promises';
9-
import { randomUUID } from 'crypto';
9+
import { randomUUID } from 'node:crypto';
1010

1111
const rl = readline.createInterface({
1212
input: process.stdin,

examples/basic/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import { Agent, run, tool } from '@openai/agents';
44
const getWeatherTool = tool({
55
name: 'get_weather',
66
description: 'Get the weather for a given city',
7-
parameters: z.object({
8-
demo: z.string(),
9-
}),
7+
parameters: z.object({ city: z.string() }),
108
execute: async (input) => {
11-
return `The weather in ${input.demo} is sunny`;
9+
return `The weather in ${input.city} is sunny`;
1210
},
1311
});
1412

examples/basic/local-image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import fs from 'fs';
2-
import path from 'path';
1+
import fs from 'node:fs';
2+
import path from 'node:path';
33
import { Agent, run } from '@openai/agents';
44

55
const bisonImagePath = path.join(__dirname, 'media/image_bison.jpg');

examples/customer-service/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from 'zod';
2-
import readline from 'readline';
2+
import readline from 'node:readline';
33
import { Agent, withTrace, tool, run, RunContext } from '@openai/agents';
44
import { RECOMMENDED_PROMPT_PREFIX } from '@openai/agents-core/extensions';
55

examples/docs/models/customProviders.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import {
22
ModelProvider,
33
Model,
44
ModelRequest,
5-
AgentOutputType,
65
ModelResponse,
76
ResponseStreamEvent,
8-
TextOutput,
97
} from '@openai/agents-core';
108

119
import { Agent, Runner } from '@openai/agents';

examples/docs/streaming/streamedHITL.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ while (stream.interruptions?.length) {
2020
);
2121
const state = stream.state;
2222
for (const interruption of stream.interruptions) {
23-
const ok = await confirm(
23+
const approved = confirm(
2424
`Agent ${interruption.agent.name} would like to use the tool ${interruption.rawItem.name} with "${interruption.rawItem.arguments}". Do you approve?`,
2525
);
26-
if (ok) {
26+
if (approved) {
2727
state.approve(interruption);
2828
} else {
2929
state.reject(interruption);

examples/research-bot/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ResearchManager } from './manager';
22

33
async function main() {
4-
const readline = await import('readline');
4+
const readline = await import('node:readline');
55
const rl = readline.createInterface({
66
input: process.stdin,
77
output: process.stdout,

examples/tools/image-generation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Agent, run, imageGenerationTool, withTrace } from '@openai/agents';
2-
import * as fs from 'fs';
3-
import * as os from 'os';
4-
import * as path from 'path';
5-
import { spawnSync } from 'child_process';
2+
import * as fs from 'node:fs';
3+
import * as os from 'node:os';
4+
import * as path from 'node:path';
5+
import { spawnSync } from 'node:child_process';
66

77
function openFile(filePath: string): void {
88
if (process.platform === 'darwin') {

0 commit comments

Comments
 (0)