UNPKG

@ai-sdk/svelte

Version:

[Svelte](https://svelte.dev/) UI components for the [AI SDK](https://ai-sdk.dev/docs):

30 lines 1.19 kB
import { type CompletionRequestOptions, type UseCompletionOptions } from 'ai'; export type CompletionOptions = Readonly<UseCompletionOptions>; export declare class Completion { #private; /** The current completion result */ get completion(): string; set completion(value: string); /** The error object of the API request */ get error(): Error | undefined; /** The current value of the input. Writable, so it can be bound to form inputs. */ input: string; /** * Flag that indicates whether an API request is in progress. */ get loading(): boolean; constructor(options?: CompletionOptions); /** * Abort the current request immediately, keep the generated tokens if any. */ stop: () => void; /** * Send a new prompt to the API endpoint and update the completion state. */ complete: (prompt: string, options?: CompletionRequestOptions) => Promise<string | null | undefined>; /** Form submission handler to automatically reset input and call the completion API */ handleSubmit: (event?: { preventDefault?: () => void; }) => Promise<void>; } //# sourceMappingURL=completion.svelte.d.ts.map