@ai-sdk/openai
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -317,2 +317,3 @@ "use strict"; | ||
if (!chunk.success) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: chunk.error }); | ||
@@ -322,2 +323,7 @@ return; | ||
const value = chunk.value; | ||
if ("error" in value) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: value.error }); | ||
return; | ||
} | ||
if (value.usage != null) { | ||
@@ -463,43 +469,46 @@ usage = { | ||
}); | ||
var openaiChatChunkSchema = import_zod2.z.object({ | ||
choices: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
delta: import_zod2.z.object({ | ||
role: import_zod2.z.enum(["assistant"]).optional(), | ||
content: import_zod2.z.string().nullable().optional(), | ||
tool_calls: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
index: import_zod2.z.number(), | ||
id: import_zod2.z.string().optional().nullable(), | ||
type: import_zod2.z.literal("function").optional(), | ||
function: import_zod2.z.object({ | ||
name: import_zod2.z.string().optional(), | ||
arguments: import_zod2.z.string().optional() | ||
var openaiChatChunkSchema = import_zod2.z.union([ | ||
import_zod2.z.object({ | ||
choices: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
delta: import_zod2.z.object({ | ||
role: import_zod2.z.enum(["assistant"]).optional(), | ||
content: import_zod2.z.string().nullable().optional(), | ||
tool_calls: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
index: import_zod2.z.number(), | ||
id: import_zod2.z.string().optional().nullable(), | ||
type: import_zod2.z.literal("function").optional(), | ||
function: import_zod2.z.object({ | ||
name: import_zod2.z.string().optional(), | ||
arguments: import_zod2.z.string().optional() | ||
}) | ||
}) | ||
}) | ||
).optional() | ||
}), | ||
logprobs: import_zod2.z.object({ | ||
content: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number(), | ||
top_logprobs: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number() | ||
}) | ||
) | ||
}) | ||
).nullable() | ||
}).nullable().optional(), | ||
finish_reason: import_zod2.z.string().nullable().optional(), | ||
index: import_zod2.z.number() | ||
}) | ||
), | ||
usage: import_zod2.z.object({ | ||
prompt_tokens: import_zod2.z.number(), | ||
completion_tokens: import_zod2.z.number() | ||
}).optional().nullable() | ||
}); | ||
).optional() | ||
}), | ||
logprobs: import_zod2.z.object({ | ||
content: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number(), | ||
top_logprobs: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number() | ||
}) | ||
) | ||
}) | ||
).nullable() | ||
}).nullable().optional(), | ||
finish_reason: import_zod2.z.string().nullable().optional(), | ||
index: import_zod2.z.number() | ||
}) | ||
), | ||
usage: import_zod2.z.object({ | ||
prompt_tokens: import_zod2.z.number(), | ||
completion_tokens: import_zod2.z.number() | ||
}).optional().nullable() | ||
}), | ||
openAIErrorDataSchema | ||
]); | ||
function prepareToolsAndToolChoice(mode) { | ||
@@ -787,2 +796,3 @@ var _a; | ||
if (!chunk.success) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: chunk.error }); | ||
@@ -792,2 +802,7 @@ return; | ||
const value = chunk.value; | ||
if ("error" in value) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: value.error }); | ||
return; | ||
} | ||
if (value.usage != null) { | ||
@@ -851,20 +866,23 @@ usage = { | ||
}); | ||
var openaiCompletionChunkSchema = import_zod3.z.object({ | ||
choices: import_zod3.z.array( | ||
import_zod3.z.object({ | ||
text: import_zod3.z.string(), | ||
finish_reason: import_zod3.z.enum(["stop", "length", "content_filter"]).optional().nullable(), | ||
index: import_zod3.z.number(), | ||
logprobs: import_zod3.z.object({ | ||
tokens: import_zod3.z.array(import_zod3.z.string()), | ||
token_logprobs: import_zod3.z.array(import_zod3.z.number()), | ||
top_logprobs: import_zod3.z.array(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())).nullable() | ||
}).nullable().optional() | ||
}) | ||
), | ||
usage: import_zod3.z.object({ | ||
prompt_tokens: import_zod3.z.number(), | ||
completion_tokens: import_zod3.z.number() | ||
}).optional().nullable() | ||
}); | ||
var openaiCompletionChunkSchema = import_zod3.z.union([ | ||
import_zod3.z.object({ | ||
choices: import_zod3.z.array( | ||
import_zod3.z.object({ | ||
text: import_zod3.z.string(), | ||
finish_reason: import_zod3.z.string().nullish(), | ||
index: import_zod3.z.number(), | ||
logprobs: import_zod3.z.object({ | ||
tokens: import_zod3.z.array(import_zod3.z.string()), | ||
token_logprobs: import_zod3.z.array(import_zod3.z.number()), | ||
top_logprobs: import_zod3.z.array(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())).nullable() | ||
}).nullable().optional() | ||
}) | ||
), | ||
usage: import_zod3.z.object({ | ||
prompt_tokens: import_zod3.z.number(), | ||
completion_tokens: import_zod3.z.number() | ||
}).optional().nullable() | ||
}), | ||
openAIErrorDataSchema | ||
]); | ||
@@ -871,0 +889,0 @@ // src/openai-facade.ts |
@@ -317,2 +317,3 @@ "use strict"; | ||
if (!chunk.success) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: chunk.error }); | ||
@@ -322,2 +323,7 @@ return; | ||
const value = chunk.value; | ||
if ("error" in value) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: value.error }); | ||
return; | ||
} | ||
if (value.usage != null) { | ||
@@ -463,43 +469,46 @@ usage = { | ||
}); | ||
var openaiChatChunkSchema = import_zod2.z.object({ | ||
choices: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
delta: import_zod2.z.object({ | ||
role: import_zod2.z.enum(["assistant"]).optional(), | ||
content: import_zod2.z.string().nullable().optional(), | ||
tool_calls: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
index: import_zod2.z.number(), | ||
id: import_zod2.z.string().optional().nullable(), | ||
type: import_zod2.z.literal("function").optional(), | ||
function: import_zod2.z.object({ | ||
name: import_zod2.z.string().optional(), | ||
arguments: import_zod2.z.string().optional() | ||
var openaiChatChunkSchema = import_zod2.z.union([ | ||
import_zod2.z.object({ | ||
choices: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
delta: import_zod2.z.object({ | ||
role: import_zod2.z.enum(["assistant"]).optional(), | ||
content: import_zod2.z.string().nullable().optional(), | ||
tool_calls: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
index: import_zod2.z.number(), | ||
id: import_zod2.z.string().optional().nullable(), | ||
type: import_zod2.z.literal("function").optional(), | ||
function: import_zod2.z.object({ | ||
name: import_zod2.z.string().optional(), | ||
arguments: import_zod2.z.string().optional() | ||
}) | ||
}) | ||
}) | ||
).optional() | ||
}), | ||
logprobs: import_zod2.z.object({ | ||
content: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number(), | ||
top_logprobs: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number() | ||
}) | ||
) | ||
}) | ||
).nullable() | ||
}).nullable().optional(), | ||
finish_reason: import_zod2.z.string().nullable().optional(), | ||
index: import_zod2.z.number() | ||
}) | ||
), | ||
usage: import_zod2.z.object({ | ||
prompt_tokens: import_zod2.z.number(), | ||
completion_tokens: import_zod2.z.number() | ||
}).optional().nullable() | ||
}); | ||
).optional() | ||
}), | ||
logprobs: import_zod2.z.object({ | ||
content: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number(), | ||
top_logprobs: import_zod2.z.array( | ||
import_zod2.z.object({ | ||
token: import_zod2.z.string(), | ||
logprob: import_zod2.z.number() | ||
}) | ||
) | ||
}) | ||
).nullable() | ||
}).nullable().optional(), | ||
finish_reason: import_zod2.z.string().nullable().optional(), | ||
index: import_zod2.z.number() | ||
}) | ||
), | ||
usage: import_zod2.z.object({ | ||
prompt_tokens: import_zod2.z.number(), | ||
completion_tokens: import_zod2.z.number() | ||
}).optional().nullable() | ||
}), | ||
openAIErrorDataSchema | ||
]); | ||
function prepareToolsAndToolChoice(mode) { | ||
@@ -787,2 +796,3 @@ var _a; | ||
if (!chunk.success) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: chunk.error }); | ||
@@ -792,2 +802,7 @@ return; | ||
const value = chunk.value; | ||
if ("error" in value) { | ||
finishReason = "error"; | ||
controller.enqueue({ type: "error", error: value.error }); | ||
return; | ||
} | ||
if (value.usage != null) { | ||
@@ -851,20 +866,23 @@ usage = { | ||
}); | ||
var openaiCompletionChunkSchema = import_zod3.z.object({ | ||
choices: import_zod3.z.array( | ||
import_zod3.z.object({ | ||
text: import_zod3.z.string(), | ||
finish_reason: import_zod3.z.enum(["stop", "length", "content_filter"]).optional().nullable(), | ||
index: import_zod3.z.number(), | ||
logprobs: import_zod3.z.object({ | ||
tokens: import_zod3.z.array(import_zod3.z.string()), | ||
token_logprobs: import_zod3.z.array(import_zod3.z.number()), | ||
top_logprobs: import_zod3.z.array(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())).nullable() | ||
}).nullable().optional() | ||
}) | ||
), | ||
usage: import_zod3.z.object({ | ||
prompt_tokens: import_zod3.z.number(), | ||
completion_tokens: import_zod3.z.number() | ||
}).optional().nullable() | ||
}); | ||
var openaiCompletionChunkSchema = import_zod3.z.union([ | ||
import_zod3.z.object({ | ||
choices: import_zod3.z.array( | ||
import_zod3.z.object({ | ||
text: import_zod3.z.string(), | ||
finish_reason: import_zod3.z.string().nullish(), | ||
index: import_zod3.z.number(), | ||
logprobs: import_zod3.z.object({ | ||
tokens: import_zod3.z.array(import_zod3.z.string()), | ||
token_logprobs: import_zod3.z.array(import_zod3.z.number()), | ||
top_logprobs: import_zod3.z.array(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())).nullable() | ||
}).nullable().optional() | ||
}) | ||
), | ||
usage: import_zod3.z.object({ | ||
prompt_tokens: import_zod3.z.number(), | ||
completion_tokens: import_zod3.z.number() | ||
}).optional().nullable() | ||
}), | ||
openAIErrorDataSchema | ||
]); | ||
@@ -871,0 +889,0 @@ // src/openai-facade.ts |
{ | ||
"name": "@ai-sdk/openai", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252770
3340