@nuxthub/core
Version:
Build full-stack Nuxt applications on Cloudflare, with zero configuration.
32 lines (31 loc) • 1.08 kB
TypeScript
import type { Ai } from '@cloudflare/workers-types/experimental';
/**
* Access Workers AI
*
* @example ```ts
* const ai = hubAI()
* await ai.run('@cf/meta/llama-3.1-8b-instruct', {
* prompt: "What is the origin of the phrase 'Hello, World'"
* })
* ```
*
* @see https://hub.nuxt.com/docs/features/ai
*/
export declare function hubAI(): Omit<Ai, 'autorag' | 'gateway'>;
/**
* Access remote Workers AI.
*
* @param projectUrl The project URL (e.g. https://my-deployed-project.nuxt.dev)
* @param secretKey The secret key to authenticate to the remote endpoint
* @param headers The headers to send with the request to the remote endpoint
*
* @example ```ts
* const ai = proxyHubAI('https://my-deployed-project.nuxt.dev', 'my-secret-key')
* await ai.run('@cf/meta/llama-3.1-8b-instruct', {
* prompt: "What is the origin of the phrase 'Hello, World'"
* })
* ```
*
* @see https://developers.cloudflare.com/workers-ai/configuration/bindings/#methods
*/
export declare function proxyHubAI(projectUrl: string, secretKey?: string, headers?: HeadersInit): Ai;