feat(ai-openai): allow passing all open ai configuration options #245
Mergedruudandriessen(GitHub profile, opens in a new tab)merged 3 commits into
main fromrefs/pull/245/headmerged by AlemTuzlak View on GitHubruudandriessen(GitHub profile, opens in a new tab) changed the title
- @@ -0,0 +1,5 @@1+---2+'@tanstack/ai-openai': minor3+---4+5+allows additional configuration options when creating an openAI client@@ -1,7 +1,6 @@11 import OpenAI_SDK from 'openai'2+import type { ClientOptions } from 'openai';233-export interface OpenAIClientConfig {4- apiKey: string5- organization?: string6- baseURL?: string4+export interface OpenAIClientConfig extends ClientOptions {5+ apiKey: string;76 }
AlemTuzlak approved these changes
- @@ -1,10 +1,10 @@11 import { BaseSummarizeAdapter } from '@tanstack/ai/adapters'2-import { getOpenAIApiKeyFromEnv } from '../utils'2+import { getOpenAIApiKeyFromEnv } from '../utils/client'33 import { OpenAITextAdapter } from './text'4-import type { OPENAI_CHAT_MODELS } from '../model-meta'4+import type { OpenAIChatModel } from '../model-meta'55 import type {66 StreamChunk,77 SummarizationOptions,88 SummarizationResult,99 } from '@tanstack/ai'10-import type { OpenAIClientConfig } from '../utils'10+import type { OpenAIClientConfig } from '../utils/client'
AlemTuzlak approved these changes
AlemTuzlak merged this356df1a
AlemTuzlak closed this
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
Model name unions moved into
model-meta; OpenAI client config and helpers relocated toutils/client;utils/indexre-exports removed; adapters updated to import model types and client utilities from new locations; index exports extended to include new model and client types. No runtime behavior changes.Changes#
\.changeset/olive-wolves-love\.md@tanstack/ai-openaidocumenting expanded client configuration options.packages/typescript/ai-openai/src/utils/client.ts,packages/typescript/ai-openai/src/utils/index.tsOpenAIClientConfignow extendsClientOptionsfromopenai;createOpenAIClientforwards full config to the SDK.utils/index.tsno longer re-exports client and schema-converter symbols.packages/typescript/ai-openai/src/model-meta.ts,packages/typescript/ai-openai/src/index.tsOpenAIChatModel,OpenAIImageModel,OpenAIVideoModel,OpenAITTSModel,OpenAITranscriptionModel. Index now exports these andOpenAIClientConfigfrom./utils/client.packages/typescript/ai-openai/src/adapters/*.../adapters/image.ts,.../adapters/summarize.ts,.../adapters/text.ts,.../adapters/transcription.ts,.../adapters/tts.ts,.../adapters/video.ts../model-meta. Import paths updated to use../utils/clientforOpenAIClientConfig,createOpenAIClient, andgetOpenAIApiKeyFromEnv. Generic constraints updated (e.g., adapters now useOpenAIChatModel).Sequence Diagram(s)#
(omitted — changes are type/import refactors without new multi-component control flow)
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs#
model-metaand public exports (model name/type defs and index exports).model-meta/utils/client.Suggested reviewers#
Poem#
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share