import { UseCompletionOptions, RequestOptions } from "./types"; export type UseCompletionHelpers = { /** The current completion result */ completion: string; /** * Send a new prompt to the API endpoint and update the completion state. */ complete: (prompt: string, options?: RequestOptions) => Promise; /** The error object of the API request */ error: undefined | Error; /** * Abort the current API request but keep the generated tokens. */ stop: () => void; /** * Update the `completion` state locally. */ setCompletion: (completion: string) => void; /** The current value of the input */ input: string; /** setState-powered method to update the input value */ setInput: React.Dispatch>; /** * An input/textarea-ready onChange handler to control the value of the input * @example * ```jsx * * ``` */ handleInputChange: (e: React.ChangeEvent | React.ChangeEvent) => void; /** * Form submission handler to automattically reset input and append a user message * @example * ```jsx *
* *
* ``` */ handleSubmit: (e: React.FormEvent) => void; /** Whether the API request is in progress */ isLoading: boolean; }; export declare function useCompletion({ api, id, initialCompletion, initialInput, headers, body, onResponse, onFinish, onError, }: UseCompletionOptions): UseCompletionHelpers;