Skip to content

Commit 012f2a1

Browse files
committed
fix: resolve eslint and knip failures from full test suite
- Fix unnecessary type assertions in chat-completions-text and responses-text - Fix eslint import order in ai-groq client.ts - Fix unnecessary condition in ai-groq schema-converter combinator recursion - Fix array-type lint error in openai-base provider-options - Remove unused files in ai-grok (tools/index.ts, tool-converter.ts, function-tool.ts) - Remove unused exports (createOpenAIClient, generateId, validateTextProviderOptions, InternalTextProviderOptions)
1 parent 914b883 commit 012f2a1

File tree

10 files changed

+6
-57
lines changed

10 files changed

+6
-57
lines changed

packages/typescript/ai-grok/src/text/text-provider-options.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { FunctionTool } from '../tools/function-tool'
2-
31
/**
42
* Grok Text Provider Options
53
*
@@ -51,27 +49,7 @@ export interface GrokTextProviderOptions extends GrokBaseOptions {
5149
stop?: string | Array<string>
5250
}
5351

54-
/**
55-
* Internal options interface for validation
56-
* Used internally by the adapter
57-
*/
58-
export interface InternalTextProviderOptions extends GrokTextProviderOptions {
59-
model: string
60-
stream?: boolean
61-
tools?: Array<FunctionTool>
62-
}
63-
6452
/**
6553
* External provider options (what users pass in)
6654
*/
6755
export type ExternalTextProviderOptions = GrokTextProviderOptions
68-
69-
/**
70-
* Validates text provider options
71-
*/
72-
export function validateTextProviderOptions(
73-
_options: InternalTextProviderOptions,
74-
): void {
75-
// Basic validation can be added here if needed
76-
// For now, Grok API will handle validation
77-
}

packages/typescript/ai-grok/src/tools/function-tool.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/typescript/ai-grok/src/tools/index.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/typescript/ai-grok/src/tools/tool-converter.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/typescript/ai-groq/src/utils/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { generateId as _generateId, getApiKeyFromEnv } from '@tanstack/ai-utils'
12
import Groq_SDK from 'groq-sdk'
23
import type { ClientOptions } from 'groq-sdk'
3-
import { generateId as _generateId, getApiKeyFromEnv } from '@tanstack/ai-utils'
44

55
export interface GroqClientConfig extends ClientOptions {
66
apiKey: string

packages/typescript/ai-groq/src/utils/schema-converter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ function removeEmptyRequired(schema: Record<string, any>): Record<string, any> {
4040
for (const keyword of ['anyOf', 'oneOf', 'allOf'] as const) {
4141
if (Array.isArray(result[keyword])) {
4242
result[keyword] = result[keyword].map((entry: Record<string, any>) =>
43-
typeof entry === 'object' && entry !== null
44-
? removeEmptyRequired(entry)
45-
: entry,
43+
removeEmptyRequired(entry),
4644
)
4745
}
4846
}

packages/typescript/ai-openai/src/utils/client.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import OpenAI_SDK from 'openai'
2-
import { generateId as _generateId, getApiKeyFromEnv } from '@tanstack/ai-utils'
1+
import { getApiKeyFromEnv } from '@tanstack/ai-utils'
32
import type { OpenAICompatibleClientConfig } from '@tanstack/openai-base'
43
import type { ClientOptions } from 'openai'
54

65
export interface OpenAIClientConfig extends ClientOptions {
76
apiKey: string
87
}
98

10-
/**
11-
* Creates an OpenAI SDK client instance
12-
*/
13-
export function createOpenAIClient(config: OpenAIClientConfig): OpenAI_SDK {
14-
return new OpenAI_SDK(config)
15-
}
16-
179
/**
1810
* Gets OpenAI API key from environment variables
1911
* @throws Error if OPENAI_API_KEY is not found
@@ -22,13 +14,6 @@ export function getOpenAIApiKeyFromEnv(): string {
2214
return getApiKeyFromEnv('OPENAI_API_KEY')
2315
}
2416

25-
/**
26-
* Generates a unique ID with a prefix
27-
*/
28-
export function generateId(prefix: string): string {
29-
return _generateId(prefix)
30-
}
31-
3217
/**
3318
* Converts an OpenAIClientConfig to OpenAICompatibleClientConfig.
3419
* This bridges the type gap between the local config type (which extends

packages/typescript/openai-base/src/adapters/chat-completions-text.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,7 @@ export class OpenAICompatibleChatCompletionsTextAdapter<
459459
messages.push(this.convertMessage(message))
460460
}
461461

462-
const modelOptions = options.modelOptions as
463-
| Record<string, any>
464-
| undefined
462+
const modelOptions = options.modelOptions
465463

466464
return {
467465
model: options.model,

packages/typescript/openai-base/src/adapters/responses-text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ export class OpenAICompatibleResponsesTextAdapter<
700700
)
701701
: undefined
702702

703-
const modelOptions = options.modelOptions as Record<string, any> | undefined
703+
const modelOptions = options.modelOptions
704704

705705
return {
706706
model: options.model,

packages/typescript/openai-base/src/types/provider-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface OpenAICompatibleBaseOptions {
44
max_tokens?: number
55
frequency_penalty?: number
66
presence_penalty?: number
7-
stop?: string | string[]
7+
stop?: string | Array<string>
88
user?: string
99
}
1010

0 commit comments

Comments
 (0)