Skip to content

Commit f9bb39e

Browse files
authored
Merge pull request #6256 from G4brym/add-ai-gateway-flag-for-rpc
Add flag to route ai gateway methods via rpc
2 parents 1d99c25 + 2d9f3d6 commit f9bb39e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cloudflare/internal/ai-api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type AiSearchService = object;
1616
interface Fetcher {
1717
fetch: typeof fetch;
1818
aiSearch: () => AiSearchService;
19+
gateway: (gatewayId: string) => AiGateway;
1920
}
2021

2122
interface AiError {
@@ -418,7 +419,10 @@ export class Ai {
418419
return service.transform(files, options);
419420
}
420421

421-
gateway(gatewayId: string): AiGateway {
422+
gateway(gatewayId: string, options?: { beta?: boolean }): AiGateway {
423+
if (options?.beta === true) {
424+
return this.#fetcher.gateway(gatewayId);
425+
}
422426
return new AiGateway(this.#fetcher, gatewayId);
423427
}
424428

0 commit comments

Comments
 (0)