AppleBackend
Defined in: index.ts:121
Backend adapter for Apple MLX Framework.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AppleBackend(
config):AppleBackend
Defined in: index.ts:126
Parameters
Section titled “Parameters”config
Section titled “config”AppleConfig = {}
Returns
Section titled “Returns”AppleBackend
Properties
Section titled “Properties”metadata
Section titled “metadata”
readonlymetadata:AdapterMetadata
Defined in: index.ts:122
Adapter metadata for identification and capabilities.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”execute()
Section titled “execute()”execute(
request,_signal?):Promise<IRChatResponse>
Defined in: index.ts:181
Execute non-streaming chat completion request.
Parameters
Section titled “Parameters”request
Section titled “request”_signal?
Section titled “_signal?”AbortSignal
Returns
Section titled “Returns”Promise<IRChatResponse>
Implementation of
Section titled “Implementation of”executeStream()
Section titled “executeStream()”executeStream(
request,_signal?):IRChatStream
Defined in: index.ts:286
Execute streaming chat completion request using Apple Foundation Models streaming.
Parameters
Section titled “Parameters”request
Section titled “request”_signal?
Section titled “_signal?”AbortSignal
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”fromIR()
Section titled “fromIR()”fromIR(
request):object
Defined in: index.ts:419
Convert IR request to Apple Foundation Models format.
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”object
instructions?
Section titled “instructions?”
optionalinstructions:string
options
Section titled “options”options:
object
options.maximumResponseTokens?
Section titled “options.maximumResponseTokens?”
optionalmaximumResponseTokens:number
options.sampling?
Section titled “options.sampling?”
optionalsampling:"random"|"default"
options.temperature?
Section titled “options.temperature?”
optionaltemperature:number
prompt
Section titled “prompt”prompt:
string
Implementation of
Section titled “Implementation of”healthCheck()
Section titled “healthCheck()”healthCheck():
Promise<boolean>
Defined in: index.ts:491
Health check.
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”initialize()
Section titled “initialize()”initialize():
Promise<void>
Defined in: index.ts:156
Initialize the Apple Foundation Models. Must be called before execute().
Returns
Section titled “Returns”Promise<void>
toIR()
Section titled “toIR()”toIR(
response,originalRequest):IRChatResponse
Defined in: index.ts:470
Convert Apple Foundation Models response to IR format.
Parameters
Section titled “Parameters”response
Section titled “response”content
Section titled “content”string