withDeprecationPolicy
Auto-generated API reference for withDeprecationPolicy.
Function: withDeprecationPolicy()
withDeprecationPolicy<
F>(factory,options):F
Defined in: adapters/src/deprecation.ts:127
Wrap an AdapterFactory so that any model field on its requests is
checked against the deprecation policy at startup. Convenience for
adapters that don't want to plumb the check into their own code:
const adapter = withDeprecationPolicy(openai({ apiKey, model: 'gpt-3.5-turbo-0301' }), {
provider: 'openai',
onDeprecation: 'remap',
})For adapters with internal model state (most), prefer calling
resolveModel() inside the factory and substituting before the
first request β this wrapper is a fallback for opaque adapters.
#Type Parameters
#F
F extends AdapterFactory
#Parameters
#factory
F
#options
object & DeprecationPolicy
#Returns
F