Repository navigation
fix(server): t3_thread_launch refuses models the provider does not advertise #26625
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
base: main
Are you sure you want to change the base?
Changes from all commits
c388c92
82001a9
23e3e03
798adaf
4c79d31
6084b62
89b42be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -336,6 +336,23 @@ function capabilityModelOption(descriptor: ProviderOptionDescriptor): Orchestrat | |
| }; | ||
| } | ||
|
|
||
| /** Yields the model a slug or alias names; a provider that lists no models accepts any slug. */ | ||
| export const requireAdvertisedModel = (provider: ServerProvider, model: string) => { | ||
| const advertised = provider.models.find( | ||
| (candidate) => | ||
| candidate.slug === model || | ||
| candidate.aliases?.some((alias) => alias.toLowerCase() === model.toLowerCase()), | ||
| ); | ||
| return provider.models.length > 0 && advertised === undefined | ||
| ? Effect.fail( | ||
| failure( | ||
| "model_unavailable", | ||
| `Model ${model} is not advertised by provider ${provider.instanceId}.`, | ||
| ), | ||
| ) | ||
| : Effect.succeed(advertised); | ||
| }; | ||
|
|
||
| function providerConstraints( | ||
| provider: ServerProvider | undefined, | ||
| supportsOrchestrationV2: boolean, | ||
|
|
@@ -1343,21 +1360,15 @@ const make = Effect.gen(function* () { | |
| `Provider ${instanceId} has no model available for inheritance.`, | ||
| ); | ||
| } | ||
| if ( | ||
| requestedModel !== undefined && | ||
| provider.models.length > 0 && | ||
| !provider.models.some((candidate) => candidate.slug === requestedModel) | ||
| ) { | ||
| return yield* failure( | ||
| "model_unavailable", | ||
| `Model ${requestedModel} is not advertised by provider ${instanceId}.`, | ||
| ); | ||
| } | ||
| const slug = | ||
| requestedModel === undefined | ||
| ? model | ||
| : ((yield* requireAdvertisedModel(provider, requestedModel))?.slug ?? model); | ||
|
|
||
| const requestedOptions = input.target?.options; | ||
| if (requestedOptions !== undefined) { | ||
| const descriptors = provider.models.find((candidate) => candidate.slug === model) | ||
| ?.capabilities?.optionDescriptors; | ||
| const descriptors = provider.models.find((candidate) => candidate.slug === slug)?.capabilities | ||
| ?.optionDescriptors; | ||
| const invalid = invalidOptionSelections(requestedOptions, descriptors); | ||
| if (invalid.length > 0) { | ||
| return yield* failure( | ||
|
|
@@ -1368,7 +1379,8 @@ const make = Effect.gen(function* () { | |
| } | ||
|
|
||
| const inheritsOptions = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High When 🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||
| instanceId === inheritedSelection.instanceId && model === inheritedSelection.model; | ||
| instanceId === inheritedSelection.instanceId && | ||
| (model === inheritedSelection.model || slug === inheritedSelection.model); | ||
| let options = inheritsOptions ? inheritedSelection.options : undefined; | ||
| if (requestedOptions !== undefined) { | ||
| const selections = new Map( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.