Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .changeset/twelve-moons-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@ai-sdk/openai-compatible": patch
"@ai-sdk/amazon-bedrock": patch
"@ai-sdk/open-responses": patch
"@ai-sdk/provider-utils": patch
"@ai-sdk/google-vertex": patch
"@ai-sdk/moonshotai": patch
"@ai-sdk/togetherai": patch
"@ai-sdk/anthropic": patch
"@ai-sdk/deepinfra": patch
"@ai-sdk/fireworks": patch
"@ai-sdk/cerebras": patch
"@ai-sdk/devtools": patch
"@ai-sdk/alibaba": patch
"@ai-sdk/baseten": patch
"@ai-sdk/codemod": patch
"@ai-sdk/gateway": patch
"@ai-sdk/cohere": patch
"@ai-sdk/google": patch
"@ai-sdk/openai": patch
"@ai-sdk/vercel": patch
"@ai-sdk/react": patch
"@ai-sdk/groq": patch
"@ai-sdk/luma": patch
"@ai-sdk/otel": patch
"@ai-sdk/fal": patch
"@ai-sdk/mcp": patch
"@ai-sdk/xai": patch
"ai": patch
---

chore: fix unused vars not being flagged by our lint tooling
8 changes: 7 additions & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"rules": {
"no-redeclare": "off"
}
},
{
"files": ["examples/**", "**/*.test.ts"],
"rules": {
"no-unused-vars": "off"
}
}
],
"rules": {
Expand Down Expand Up @@ -64,7 +70,7 @@
"no-unneeded-ternary": "off",
"no-unsafe-finally": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"no-unused-vars": "error",
"no-use-before-define": "off",
"no-useless-catch": "off",
"no-useless-concat": "off",
Expand Down
10 changes: 3 additions & 7 deletions packages/ai/src/generate-object/generate-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ import { standardizePrompt } from '../prompt/standardize-prompt';
import { wrapGatewayError } from '../prompt/wrap-gateway-error';
import { getGlobalTelemetryIntegration } from '../telemetry/get-global-telemetry-integration';
import { TelemetrySettings } from '../telemetry/telemetry-settings';
import {
CallWarning,
FinishReason,
LanguageModel,
} from '../types/language-model';
import { LanguageModel } from '../types/language-model';
import { LanguageModelRequestMetadata } from '../types/language-model-request-metadata';
import { LanguageModelResponseMetadata } from '../types/language-model-response-metadata';
import { ProviderMetadata } from '../types/provider-metadata';
import { asLanguageModelUsage, LanguageModelUsage } from '../types/usage';

import { asLanguageModelUsage } from '../types/usage';
import { DownloadFunction } from '../util/download/download-function';
import { notify } from '../util/notify';
import type { Listener } from '../util/notify';
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/generate-object/output-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const arrayOutputStrategy = <ELEMENT>(
// possible future optimization: use arrays directly when model supports grammar-guided generation
jsonSchema: async () => {
// remove $schema from schema.jsonSchema:
const { $schema, ...itemSchema } = await schema.jsonSchema;
const { $schema: _$schema, ...itemSchema } = await schema.jsonSchema;

return {
$schema: 'http://json-schema.org/draft-07/schema#',
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/generate-text/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export const array = <ELEMENT>({
// JSON schema that describes an array of elements:
responseFormat: resolve(elementSchema.jsonSchema).then(jsonSchema => {
// remove $schema from schema.jsonSchema:
const { $schema, ...itemSchema } = jsonSchema;
const { $schema: _$schema, ...itemSchema } = jsonSchema;

return {
type: 'json' as const,
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/prompt/convert-to-language-model-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ async function downloadAssets(
if (typeof data === 'string') {
try {
data = new URL(data);
} catch (ignored) {}
} catch {}
}

return { mediaType, data };
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/prompt/data-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function convertToLanguageModelV4DataContent(
if (typeof content === 'string') {
try {
content = new URL(content);
} catch (error) {
} catch {
// ignored
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ export function convertDataContentToUint8Array(
export function convertUint8ArrayToText(uint8Array: Uint8Array): string {
try {
return new TextDecoder().decode(uint8Array);
} catch (error) {
} catch {
throw new Error('Error decoding Uint8Array to text');
}
}
2 changes: 1 addition & 1 deletion packages/ai/src/prompt/split-data-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function splitDataUrl(dataUrl: string): {
mediaType: header.split(';')[0].split(':')[1],
base64Content,
};
} catch (error) {
} catch {
return {
mediaType: undefined,
base64Content: undefined,
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/telemetry/get-global-telemetry-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function bindTelemetryIntegration(
}

export function getGlobalTelemetryIntegration<
TOOLS extends ToolSet = ToolSet,
OUTPUT extends Output = Output,
_TOOLS extends ToolSet = ToolSet,
_OUTPUT extends Output = Output,
>(): (args?: {
integrations?: TelemetryIntegration | Array<TelemetryIntegration>;
}) => TelemetryIntegration {
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/ui-message-stream/create-ui-message-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function createUIMessageStream<UI_MESSAGE extends UIMessage>({
function safeEnqueue(data: InferUIMessageChunk<UI_MESSAGE>) {
try {
controller.enqueue(data);
} catch (error) {
} catch {
// suppress errors when the stream has been closed
}
}
Expand Down Expand Up @@ -129,7 +129,7 @@ export function createUIMessageStream<UI_MESSAGE extends UIMessage>({
waitForStreams.finally(() => {
try {
controller.close();
} catch (error) {
} catch {
// suppress errors when the stream has been closed
}
});
Expand Down
1 change: 0 additions & 1 deletion packages/ai/src/ui/process-ui-message-stream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TypeValidationContext } from '@ai-sdk/provider';
import { FlexibleSchema, validateTypes } from '@ai-sdk/provider-utils';
import { UIMessageStreamError } from '../error/ui-message-stream-error';
import { ProviderMetadata } from '../types';
Expand Down
3 changes: 1 addition & 2 deletions packages/ai/src/ui/validate-ui-messages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { TypeValidationContext, TypeValidationError } from '@ai-sdk/provider';
import { TypeValidationError } from '@ai-sdk/provider';
import {
FlexibleSchema,
lazySchema,
StandardSchemaV1,
Tool,
validateTypes,
zodSchema,
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/util/data-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getTextFromDataUrl(dataUrl: string): string {

try {
return window.atob(base64Content);
} catch (error) {
} catch {
throw new Error(`Error decoding data URL`);
}
}
2 changes: 1 addition & 1 deletion packages/ai/src/util/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export async function notify<EVENT>(options: {
if (callback == null) continue;
try {
await callback(options.event);
} catch (_ignored) {}
} catch {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@ export function createBedrockAnthropic(
}`,

transformRequestBody: (args, betas) => {
const { model, stream, tool_choice, tools, ...rest } = args;
const {
model: _model,
stream: _stream,
tool_choice,
tools,
...rest
} = args;

const transformedToolChoice =
tool_choice != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@ export async function convertToBedrockChatMessages(
return { system, messages };
}

function isBedrockImageFormat(format: string): format is BedrockImageFormat {
return Object.values(BEDROCK_IMAGE_MIME_TYPES).includes(
format as BedrockImageFormat,
);
}

function getBedrockImageFormat(mimeType?: string): BedrockImageFormat {
if (!mimeType) {
throw new UnsupportedFunctionalityError({
Expand Down
10 changes: 0 additions & 10 deletions packages/anthropic/src/anthropic-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import {
createJsonResponseHandler,
FetchFunction,
lazySchema,
parseProviderOptions,
postFormDataToApi,
zodSchema,
} from '@ai-sdk/provider-utils';
import { z } from 'zod/v4';
import { anthropicFailedResponseHandler } from './anthropic-error';

const anthropicUploadFileProviderOptions = z.object({});

const anthropicUploadFileResponseSchema = lazySchema(() =>
zodSchema(
z.object({
Expand Down Expand Up @@ -52,14 +49,7 @@ export class AnthropicFiles implements FilesV4 {
data,
mediaType,
filename,
providerOptions,
}: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult> {
const anthropicOptions = await parseProviderOptions({
provider: 'anthropic',
providerOptions,
schema: zodSchema(anthropicUploadFileProviderOptions),
});

const fileBytes =
data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);

Expand Down
1 change: 1 addition & 0 deletions packages/codemod/src/bin/codemod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { transform } from '../lib/transform';
import { upgrade, upgradeV4, upgradeV5, upgradeV6 } from '../lib/upgrade';
import { TransformOptions } from '../lib/transform-options';

// eslint-disable-next-line no-unused-vars
const log = debug('codemod');
const error = debug('codemod:error');
debug.enable('codemod:*');
Expand Down
3 changes: 0 additions & 3 deletions packages/codemod/src/codemods/v4/replace-token-usage-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export default createTransformer((fileInfo, api, options, context) => {
EmbeddingTokenUsage: 'EmbeddingModelUsage',
};

// Set to keep track of already imported new names to avoid duplicates
const importedNewNames = new Set<string>();

// Replace imports at ImportDeclaration level
root
.find(j.ImportDeclaration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default createTransformer((fileInfo, api, options, context) => {
});

// Step 2b: Look for `for...of` loops on `steps`
const forOfPaths = root
root
.find(j.ForOfStatement)
.filter(path => {
const right = path.node.right;
Expand Down
4 changes: 2 additions & 2 deletions packages/codemod/src/lib/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function runCodemods(
bar.start(modCount, 0, { codemod: 'Starting...' });
const allErrors: TransformErrors = [];
let notImplementedAvailable = false;
for (const [index, codemod] of codemods.entries()) {
for (const [_index, codemod] of codemods.entries()) {
const { errors, notImplementedErrors } = transform(codemod, cwd, options, {
logStatus: false,
});
Expand Down Expand Up @@ -172,7 +172,7 @@ export function upgrade(options: TransformOptions) {
bar.start(modCount, 0, { codemod: 'Starting...' });
const allErrors: TransformErrors = [];
let notImplementedAvailable = false;
for (const [index, codemod] of bundle.entries()) {
for (const [_index, codemod] of bundle.entries()) {
const { errors, notImplementedErrors } = transform(codemod, cwd, options, {
logStatus: false,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/src/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function validateSyntax(code: string, extension: string): void {
};

// Override module resolution
host.resolveModuleNameLiterals = (moduleLiterals, containingFile) => {
host.resolveModuleNameLiterals = moduleLiterals => {
return moduleLiterals.map(moduleLiteral => ({
resolvedModule: {
resolvedFileName: `${moduleLiteral.text}.d.ts`,
Expand Down
2 changes: 0 additions & 2 deletions packages/devtools/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import type {
OnStepStartEvent,
OnStepFinishEvent,
OnChunkEvent,
OnFinishEvent,
ObjectOnStartEvent,
ObjectOnStepStartEvent,
ObjectOnStepFinishEvent,
ObjectOnFinishEvent,
TelemetryIntegration,
ToolSet,
} from 'ai';
Expand Down
11 changes: 0 additions & 11 deletions packages/devtools/src/viewer/client/components/step-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ export function StepCard({
const output = parseJson(step.output) as ParsedOutput | null;
const usage = parseJson(step.usage) as ParsedUsage | null;

const nextStep = steps[index + 1];
const nextInput = nextStep
? (parseJson(nextStep.input) as ParsedInput | null)
: null;
const toolResults: ContentPart[] =
nextInput?.prompt
?.filter((msg: PromptMessage) => msg.role === 'tool')
?.flatMap((msg: PromptMessage) =>
Array.isArray(msg.content) ? msg.content : [],
) ?? [];

const summary = getStepSummary(output, step.error);
const isFirstStep = index === 0;
const inputSummary = getStepInputSummary(input, isFirstStep);
Expand Down
2 changes: 1 addition & 1 deletion packages/fal/src/fal-image-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class FalImageModel implements ImageModelV4 {
fal: {
images: targetImages.map((image, index) => {
const {
url,
url: _url,
content_type: contentType,
file_name: fileName,
file_data: fileData,
Expand Down
1 change: 0 additions & 1 deletion packages/gateway/src/errors/create-gateway-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
InferSchema,
lazySchema,
safeValidateTypes,
validateTypes,
zodSchema,
} from '@ai-sdk/provider-utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class GatewayAuthenticationError extends GatewayError {
static createContextualError({
apiKeyProvided,
oidcTokenProvided,
message = 'Authentication failed',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep? why was this removed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually unused, it did nothing if passed

statusCode = 401,
cause,
generationId,
Expand Down
6 changes: 1 addition & 5 deletions packages/gateway/src/gateway-image-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ export class GatewayImageModel implements ImageModelV4 {
> {
const resolvedHeaders = await resolve(this.config.headers());
try {
const {
responseHeaders,
value: responseBody,
rawValue,
} = await postJsonToApi({
const { responseHeaders, value: responseBody } = await postJsonToApi({
url: this.getUrl(),
headers: combineHeaders(
resolvedHeaders,
Expand Down
1 change: 0 additions & 1 deletion packages/gateway/src/gateway-language-model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {
LanguageModelV4,
LanguageModelV4CallOptions,
SharedV4Warning,
LanguageModelV4FilePart,
LanguageModelV4StreamPart,
LanguageModelV4GenerateResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function createVertexAnthropic(
}`,
transformRequestBody: args => {
// Remove model from args and add anthropic version
const { model, ...rest } = args;
const { model: _model, ...rest } = args;
return {
...rest,
anthropic_version: 'vertex-2023-10-16',
Expand Down
Loading
Loading