Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 302
feat(ai-openai): allow passing all open ai configuration options#245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@tanstack/ai-openai': minor | ||
| --- | ||
| allows additional configuration options when creating an openAI client | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| import { BaseSummarizeAdapter } from '@tanstack/ai/adapters' | ||
| import { getOpenAIApiKeyFromEnv } from '../utils' | ||
| import { getOpenAIApiKeyFromEnv } from '../utils/client' | ||
| import { OpenAITextAdapter } from './text' | ||
| import type { OPENAI_CHAT_MODELS } from '../model-meta' | ||
| import type { OpenAIChatModel } from '../model-meta' | ||
| import type { | ||
| StreamChunk, | ||
| SummarizationOptions, | ||
| SummarizationResult, | ||
| } from '@tanstack/ai' | ||
| import type { OpenAIClientConfig } from '../utils' | ||
| import type { OpenAIClientConfig } from '../utils/client' | ||
AlemTuzlak marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /** | ||
| * Configuration for OpenAI summarize adapter | ||
| @@ -24,17 +24,14 @@ export interface OpenAISummarizeProviderOptions { | ||
| maxTokens?: number | ||
| } | ||
| /** Model type for OpenAI summarization */ | ||
| export type OpenAISummarizeModel = (typeof OPENAI_CHAT_MODELS)[number] | ||
| /** | ||
| * OpenAI Summarize Adapter | ||
| * | ||
| * A thin wrapper around the text adapter that adds summarization-specific prompting. | ||
| * Delegates all API calls to the OpenAITextAdapter. | ||
| */ | ||
| export class OpenAISummarizeAdapter< | ||
| TModel extends OpenAISummarizeModel, | ||
| TModel extends OpenAIChatModel, | ||
| > extends BaseSummarizeAdapter<TModel, OpenAISummarizeProviderOptions> { | ||
| readonly kind = 'summarize' as const | ||
| readonly name = 'openai' as const | ||
| @@ -133,7 +130,7 @@ export class OpenAISummarizeAdapter< | ||
| * const adapter = createOpenaiSummarize('gpt-4o-mini', "sk-..."); | ||
| * ``` | ||
| */ | ||
| export function createOpenaiSummarize<TModel extends OpenAISummarizeModel>( | ||
| export function createOpenaiSummarize<TModel extends OpenAIChatModel>( | ||
| model: TModel, | ||
| apiKey: string, | ||
| config?: Omit<OpenAISummarizeConfig, 'apiKey'>, | ||
| @@ -165,7 +162,7 @@ export function createOpenaiSummarize<TModel extends OpenAISummarizeModel>( | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export function openaiSummarize<TModel extends OpenAISummarizeModel>( | ||
| export function openaiSummarize<TModel extends OpenAIChatModel>( | ||
| model: TModel, | ||
| config?: Omit<OpenAISummarizeConfig, 'apiKey'>, | ||
| ): OpenAISummarizeAdapter<TModel> { | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize “OpenAI” in the changeset text.
Minor copy edit for brand casing.
✏️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents