Sign In

@ai-sdk/react

Package Overview
Dependencies
Maintainers
3
Versions
1142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/react - npm Package Compare versions

Comparing version
4.0.64
to
4.0.65
+4
-4
dist/index.d.ts

@@ -134,3 +134,3 @@ import { FlexibleSchema, FetchFunction, Resolvable, InferSchema } from '@ai-sdk/provider-utils';

type UseCompletionHelpers = {
type UseCompletionHelpers<BODY extends object = object> = {
/** The current completion result */

@@ -141,3 +141,3 @@ completion: string;

*/
complete: (prompt: string, options?: CompletionRequestOptions) => Promise<string | null | undefined>;
complete: (prompt: string, options?: CompletionRequestOptions<BODY>) => Promise<string | null | undefined>;
/** The error object of the API request */

@@ -180,3 +180,3 @@ error: undefined | Error;

};
declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamProtocol, fetch, onFinish, onError, throttle: throttleWait, experimental_throttle, }?: UseCompletionOptions & {
declare function useCompletion<BODY extends object = object>({ api, id, initialCompletion, initialInput, credentials, headers, body, streamProtocol, fetch, onFinish, onError, throttle: throttleWait, experimental_throttle, }?: UseCompletionOptions<NoInfer<BODY>> & {
/**

@@ -191,3 +191,3 @@ * Custom throttle wait in ms for the completion and data updates.

experimental_throttle?: number;
}): UseCompletionHelpers;
}): UseCompletionHelpers<BODY>;

@@ -194,0 +194,0 @@ type UseRealtimeOptions = Experimental_RealtimeSessionOptions;

{
"name": "@ai-sdk/react",
"version": "4.0.64",
"version": "4.0.65",
"type": "module",

@@ -32,5 +32,5 @@ "license": "Apache-2.0",

"@ai-sdk/mcp": "2.0.31",
"@ai-sdk/provider": "4.0.7",
"ai": "7.0.61",
"@ai-sdk/provider-utils": "5.0.27"
"@ai-sdk/provider-utils": "5.0.27",
"ai": "7.0.62",
"@ai-sdk/provider": "4.0.7"
},

@@ -37,0 +37,0 @@ "devDependencies": {

@@ -12,3 +12,3 @@ import {

export type UseCompletionHelpers = {
export type UseCompletionHelpers<BODY extends object = object> = {
/** The current completion result */

@@ -21,3 +21,3 @@ completion: string;

prompt: string,
options?: CompletionRequestOptions,
options?: CompletionRequestOptions<BODY>,
) => Promise<string | null | undefined>;

@@ -66,3 +66,3 @@ /** The error object of the API request */

export function useCompletion({
export function useCompletion<BODY extends object = object>({
api = '/api/completion',

@@ -81,3 +81,3 @@ id,

experimental_throttle,
}: UseCompletionOptions & {
}: UseCompletionOptions<NoInfer<BODY>> & {
/**

@@ -93,3 +93,3 @@ * Custom throttle wait in ms for the completion and data updates.

experimental_throttle?: number;
} = {}): UseCompletionHelpers {
} = {}): UseCompletionHelpers<BODY> {
const throttleWaitMs = throttleWait ?? experimental_throttle;

@@ -132,3 +132,3 @@ // Generate an unique id for the completion if not provided.

const triggerRequest = useCallback(
async (prompt: string, options?: CompletionRequestOptions) =>
async (prompt: string, options?: CompletionRequestOptions<BODY>) =>
callCompletionApi({

@@ -185,3 +185,3 @@ api,

const complete = useCallback<UseCompletionHelpers['complete']>(
const complete = useCallback<UseCompletionHelpers<BODY>['complete']>(
async (prompt, options) => {

@@ -188,0 +188,0 @@ return triggerRequest(prompt, options);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display