Skip to content

Commit fe60bb4

Browse files
committed
feat: update openai models to use ai wholesaling
1 parent d7fd3fa commit fe60bb4

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

apps/workers-bindings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"deploy": "wrangler deploy",
99
"deploy:staging": "wrangler deploy --env staging",
1010
"deploy:production": "wrangler deploy --env production",
11-
"eval:dev": "start-server-and-test --expect 404 eval:server http://localhost:8977 'vitest --testTimeout=60000 --config vitest.config.evals.ts --inspect=9229 --no-file-parallelism'",
11+
"eval:dev": "start-server-and-test --expect 404 eval:server http://localhost:8977 'vitest --testTimeout=60000 --config vitest.config.evals.ts'",
1212
"eval:server": "wrangler dev --var ENVIRONMENT:test --var DEV_DISABLE_OAUTH:true --var DEV_CLOUDFLARE_EMAIL:[email protected] --inspector-port 9230 --port 8977",
1313
"eval:ci": "start-server-and-test --expect 404 eval:server http://localhost:8977 'vitest run --testTimeout=60000 --config vitest.config.evals.ts'",
1414
"dev": "wrangler dev",

packages/eval-tools/src/runTask.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ export async function runTask(
5353
maxSteps: 10,
5454
})
5555

56-
// we need to consume the fill stream, so this is empty
57-
// eslint-disable-next-line no-empty
58-
// for await (const _ of res.fullStream) {
59-
// }
60-
6156
// convert into an LLM readable result so our factuality checker can validate tool calls
6257
let messagesWithTools = ''
6358
const toolCalls: ToolCallPart[] = []

packages/eval-tools/src/test-models.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@ type AiTextGenerationModels = Exclude<
2020
>
2121

2222
function getOpenAiModel(modelName: OpenAIChatModelId) {
23-
if (!env.OPENAI_API_KEY) {
24-
throw new Error('No API token set!')
23+
if (!env.CLOUDFLARE_ACCOUNT_ID || !env.AI_GATEWAY_ID || !env.AI_GATEWAY_TOKEN) {
24+
throw new Error('No AI gateway credentials set!')
2525
}
26+
27+
const aigateway = createAiGateway({
28+
accountId: env.CLOUDFLARE_ACCOUNT_ID,
29+
gateway: env.AI_GATEWAY_ID,
30+
apiKey: env.AI_GATEWAY_TOKEN,
31+
})
32+
2633
const ai = createOpenAI({
27-
apiKey: env.OPENAI_API_KEY,
34+
apiKey: '',
2835
})
2936

30-
const model = ai(modelName)
37+
const model = aigateway([ai(modelName)])
3138

3239
return { modelName, model, ai }
3340
}
3441

3542
function getAnthropicModel(modelName: AnthropicMessagesModelId) {
36-
if (!env.CLOUDFLARE_ACCOUNT_ID || !env.AI_GATEWAY_ID || !env.AI_GATEWAY_TOKEN) {
37-
throw new Error('No AI gateway credentials set!')
38-
}
39-
4043
const aigateway = createAiGateway({
4144
accountId: env.CLOUDFLARE_ACCOUNT_ID,
4245
gateway: env.AI_GATEWAY_ID,
@@ -90,6 +93,4 @@ export const eachModel = describe.each([
9093
//getWorkersAiModel("@cf/meta/llama-3.3-70b-instruct-fp8-fast")
9194
// Currently llama 4 is having issues with tool calling
9295
//getWorkersAiModel("@cf/meta/llama-4-scout-17b-16e-instruct")
93-
94-
// TODO: add Claude, Gemini, new OpenAI models via AI gateway
9596
])

0 commit comments

Comments
 (0)