Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/ui-utils

Package Overview
Dependencies
Maintainers
0
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/ui-utils - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

13

./dist/index.js

@@ -463,5 +463,5 @@ "use strict";

// src/call-chat-api.ts
var getOriginalFetch = () => fetch;
async function callChatApi({
api,
messages,
body,

@@ -477,6 +477,7 @@ streamMode = "stream-data",

onToolCall,
generateId: generateId2
generateId: generateId2,
fetch: fetch2 = getOriginalFetch()
}) {
var _a, _b;
const response = await fetch(api, {
const response = await fetch2(api, {
method: "POST",

@@ -561,2 +562,3 @@ body: JSON.stringify(body),

// src/call-completion-api.ts
var getOriginalFetch2 = () => fetch;
async function callCompletionApi({

@@ -576,3 +578,4 @@ api,

onError,
onData
onData,
fetch: fetch2 = getOriginalFetch2()
}) {

@@ -585,3 +588,3 @@ try {

setCompletion("");
const res = await fetch(api, {
const res = await fetch2(api, {
method: "POST",

@@ -588,0 +591,0 @@ body: JSON.stringify({

@@ -76,2 +76,7 @@ export { generateId } from '@ai-sdk/provider-utils';

onError?: (error: Error) => void;
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
};

@@ -393,2 +398,7 @@

streamMode?: 'stream-data' | 'text';
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
};

@@ -452,2 +462,7 @@ type UseCompletionOptions = {

streamMode?: 'stream-data' | 'text';
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
};

@@ -472,17 +487,22 @@ type JSONValue = null | string | number | boolean | {

};
/**
* Fetch function type (standardizes the version of fetch used).
*/
type FetchFunction = typeof fetch;
declare function callChatApi({ api, messages, body, streamMode, credentials, headers, abortController, restoreMessagesOnFailure, onResponse, onUpdate, onFinish, onToolCall, generateId, }: {
declare const getOriginalFetch$1: () => typeof fetch;
declare function callChatApi({ api, body, streamMode, credentials, headers, abortController, restoreMessagesOnFailure, onResponse, onUpdate, onFinish, onToolCall, generateId, fetch, }: {
api: string;
messages: Omit<Message, 'id'>[];
body: Record<string, any>;
streamMode?: 'stream-data' | 'text';
credentials?: RequestCredentials;
headers?: HeadersInit;
abortController?: () => AbortController | null;
streamMode: 'stream-data' | 'text' | undefined;
credentials: RequestCredentials | undefined;
headers: HeadersInit | undefined;
abortController: (() => AbortController | null) | undefined;
restoreMessagesOnFailure: () => void;
onResponse?: (response: Response) => void | Promise<void>;
onResponse: ((response: Response) => void | Promise<void>) | undefined;
onUpdate: (merged: Message[], data: JSONValue[] | undefined) => void;
onFinish?: (message: Message) => void;
onToolCall?: UseChatOptions['onToolCall'];
onFinish: ((message: Message) => void) | undefined;
onToolCall: UseChatOptions['onToolCall'] | undefined;
generateId: IdGenerator;
fetch: ReturnType<typeof getOriginalFetch$1> | undefined;
}): Promise<{

@@ -501,9 +521,10 @@ messages: Message[];

declare function callCompletionApi({ api, prompt, credentials, headers, body, streamMode, setCompletion, setLoading, setError, setAbortController, onResponse, onFinish, onError, onData, }: {
declare const getOriginalFetch: () => typeof fetch;
declare function callCompletionApi({ api, prompt, credentials, headers, body, streamMode, setCompletion, setLoading, setError, setAbortController, onResponse, onFinish, onError, onData, fetch, }: {
api: string;
prompt: string;
credentials?: RequestCredentials;
headers?: HeadersInit;
credentials: RequestCredentials | undefined;
headers: HeadersInit | undefined;
body: Record<string, any>;
streamMode?: 'stream-data' | 'text';
streamMode: 'stream-data' | 'text' | undefined;
setCompletion: (completion: string) => void;

@@ -513,6 +534,7 @@ setLoading: (loading: boolean) => void;

setAbortController: (abortController: AbortController | null) => void;
onResponse?: (response: Response) => void | Promise<void>;
onFinish?: (prompt: string, completion: string) => void;
onError?: (error: Error) => void;
onData?: (data: JSONValue[]) => void;
onResponse: ((response: Response) => void | Promise<void>) | undefined;
onFinish: ((prompt: string, completion: string) => void) | undefined;
onError: ((error: Error) => void) | undefined;
onData: ((data: JSONValue[]) => void) | undefined;
fetch: ReturnType<typeof getOriginalFetch> | undefined;
}): Promise<string | null | undefined>;

@@ -691,2 +713,2 @@

export { type AssistantMessage, type AssistantStatus, type ChatRequest, type ChatRequestOptions, type CreateMessage, type DataMessage, type DeepPartial, type Function, type FunctionCall, type FunctionCallHandler, type IdGenerator, type JSONValue, type Message, type RequestOptions, type StreamPart, type StreamString, type Tool, type ToolCall, type ToolCallHandler, type ToolChoice, type ToolInvocation, type UseAssistantOptions, type UseChatOptions, type UseCompletionOptions, callChatApi, callCompletionApi, createChunkDecoder, formatStreamPart, isDeepEqualData, parseComplexResponse, parsePartialJson, parseStreamPart, processChatStream, readDataStream };
export { type AssistantMessage, type AssistantStatus, type ChatRequest, type ChatRequestOptions, type CreateMessage, type DataMessage, type DeepPartial, type FetchFunction, type Function, type FunctionCall, type FunctionCallHandler, type IdGenerator, type JSONValue, type Message, type RequestOptions, type StreamPart, type StreamString, type Tool, type ToolCall, type ToolCallHandler, type ToolChoice, type ToolInvocation, type UseAssistantOptions, type UseChatOptions, type UseCompletionOptions, callChatApi, callCompletionApi, createChunkDecoder, formatStreamPart, isDeepEqualData, parseComplexResponse, parsePartialJson, parseStreamPart, processChatStream, readDataStream };

@@ -463,5 +463,5 @@ "use strict";

// src/call-chat-api.ts
var getOriginalFetch = () => fetch;
async function callChatApi({
api,
messages,
body,

@@ -477,6 +477,7 @@ streamMode = "stream-data",

onToolCall,
generateId: generateId2
generateId: generateId2,
fetch: fetch2 = getOriginalFetch()
}) {
var _a, _b;
const response = await fetch(api, {
const response = await fetch2(api, {
method: "POST",

@@ -561,2 +562,3 @@ body: JSON.stringify(body),

// src/call-completion-api.ts
var getOriginalFetch2 = () => fetch;
async function callCompletionApi({

@@ -576,3 +578,4 @@ api,

onError,
onData
onData,
fetch: fetch2 = getOriginalFetch2()
}) {

@@ -585,3 +588,3 @@ try {

setCompletion("");
const res = await fetch(api, {
const res = await fetch2(api, {
method: "POST",

@@ -588,0 +591,0 @@ body: JSON.stringify({

{
"name": "@ai-sdk/ui-utils",
"version": "0.0.7",
"version": "0.0.8",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc