|
7 | 7 | } from "@t3tools/contracts"; |
8 | 8 | import * as Option from "effect/Option"; |
9 | 9 | import { |
10 | | - getModelSelectionStringOptionValue, |
11 | 10 | getProviderOptionCurrentValue, |
12 | 11 | getProviderOptionDescriptors, |
13 | 12 | readCustomModelEntries, |
@@ -215,47 +214,19 @@ export function isClaudeCatalogUltracodeEffort(effort: string | null | undefined |
215 | 214 | return effort === "ultracode"; |
216 | 215 | } |
217 | 216 |
|
218 | | -export function resolveClaudeCatalogContextWindow( |
219 | | - catalog: ClaudeModelCatalog, |
220 | | - modelSelection: ModelSelection | undefined, |
221 | | -): string | undefined { |
222 | | - const caps = getClaudeCatalogModelCapabilities(catalog, modelSelection?.model); |
223 | | - const raw = getModelSelectionStringOptionValue(modelSelection, "contextWindow"); |
224 | | - const descriptors = getProviderOptionDescriptors({ |
225 | | - caps, |
226 | | - ...(raw ? { selections: [{ id: "contextWindow", value: raw }] } : {}), |
227 | | - }); |
228 | | - const descriptor = descriptors.find((candidate) => candidate.id === "contextWindow"); |
229 | | - const value = getProviderOptionCurrentValue(descriptor); |
230 | | - return typeof value === "string" ? value : undefined; |
231 | | -} |
232 | | - |
233 | 217 | export function resolveClaudeCatalogApiModelId( |
234 | 218 | catalog: ClaudeModelCatalog, |
235 | 219 | modelSelection: ModelSelection, |
236 | 220 | ): string { |
237 | 221 | const entry = resolveClaudeCatalogModel(catalog, modelSelection.model); |
238 | 222 | const slug = entry?.model.slug ?? modelSelection.model; |
239 | | - const descriptors = getProviderOptionDescriptors({ |
240 | | - caps: entry?.model.capabilities ?? EMPTY_CAPABILITIES, |
241 | | - selections: modelSelection.options, |
242 | | - }); |
243 | | - for (const [optionId, suffixes] of Object.entries(entry?.runtime.modelSuffixes ?? {})) { |
244 | | - const value = getProviderOptionCurrentValue( |
245 | | - descriptors.find((descriptor) => descriptor.id === optionId), |
246 | | - ); |
247 | | - if (typeof value === "string" && suffixes[value]) return `${slug}${suffixes[value]}`; |
248 | | - } |
249 | | - return slug; |
| 223 | + return `${slug}${entry?.runtime.modelSuffix ?? ""}`; |
250 | 224 | } |
251 | 225 |
|
252 | 226 | export function resolveClaudeCatalogContextWindowTokens( |
253 | 227 | catalog: ClaudeModelCatalog, |
254 | 228 | modelSelection: ModelSelection | undefined, |
255 | 229 | ): number | undefined { |
256 | | - const entry = resolveClaudeCatalogModel(catalog, modelSelection?.model); |
257 | | - if (!entry) return undefined; |
258 | | - if (entry.runtime.fixedContextWindowTokens) return entry.runtime.fixedContextWindowTokens; |
259 | | - const contextWindow = resolveClaudeCatalogContextWindow(catalog, modelSelection); |
260 | | - return contextWindow ? entry.runtime.contextWindowTokens?.[contextWindow] : undefined; |
| 230 | + return resolveClaudeCatalogModel(catalog, modelSelection?.model)?.runtime |
| 231 | + .fixedContextWindowTokens; |
261 | 232 | } |
0 commit comments