AxAI
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L135
Type Parameters
| Type Parameter | Default type |
|---|---|
TModelKey | string |
Implements
AxAIService<any,any,TModelKey>
Constructors
Constructor
new AxAI<TModelKey>(options: Readonly<AxAIArgs<TModelKey>>): AxAI<TModelKey>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L163
Deprecated
Use AxAI.create() or ai() function instead for better type safety.
This constructor will be removed in v15.0.0.
Migration timeline:
- v13.0.24+: Deprecation warnings (current)
- v14.0.0: Runtime console warnings
- v15.0.0: Complete removal
Example
// Instead of: new AxAI({ name: 'openai', apiKey: '...' })
// Use: AxAI.create({ name: 'openai', apiKey: '...' })
// Or: ai({ name: 'openai', apiKey: '...' })
Parameters
| Parameter | Type |
|---|---|
options | Readonly<AxAIArgs<TModelKey>> |
Returns
AxAI<TModelKey>
Methods
chat()
chat(req: Readonly<AxChatRequest<TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<
| AxChatResponse
| ReadableStream<AxChatResponse>>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L250
Parameters
| Parameter | Type |
|---|---|
req | Readonly<AxChatRequest<TModelKey>> |
options? | Readonly<AxAIServiceOptions> |
Returns
Promise<
| AxChatResponse
| ReadableStream<AxChatResponse>>
Implementation of
embed()
embed(req: Readonly<AxEmbedRequest<TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxEmbedResponse>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L257
Parameters
| Parameter | Type |
|---|---|
req | Readonly<AxEmbedRequest<TModelKey>> |
options? | Readonly<AxAIServiceOptions> |
Returns
Promise<AxEmbedResponse>
Implementation of
getFeatures()
getFeatures(model?: string): AxAIFeatures;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L226
Parameters
| Parameter | Type |
|---|---|
model? | string |
Returns
Implementation of
getId()
getId(): string;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L222
Returns
string
Implementation of
getLastUsedChatModel()
getLastUsedChatModel(): any;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L234
Returns
any
Implementation of
AxAIService.getLastUsedChatModel
getLastUsedEmbedModel()
getLastUsedEmbedModel(): any;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L238
Returns
any
Implementation of
AxAIService.getLastUsedEmbedModel
getLastUsedModelConfig()
getLastUsedModelConfig(): undefined | AxModelConfig;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L242
Returns
undefined | AxModelConfig
Implementation of
AxAIService.getLastUsedModelConfig
getLogger()
getLogger(): AxLoggerFunction;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L272
Returns
Implementation of
getMetrics()
getMetrics(): AxAIServiceMetrics;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L246
Returns
Implementation of
getModelList()
getModelList():
| undefined
| AxAIModelList<TModelKey>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L230
Returns
| undefined
| AxAIModelList<TModelKey>
Implementation of
getName()
getName(): string;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L218
Returns
string
Implementation of
getOptions()
getOptions(): Readonly<AxAIServiceOptions>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L268
Returns
Readonly<AxAIServiceOptions>
Implementation of
setOptions()
setOptions(options: Readonly<AxAIServiceOptions>): void;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L264
Parameters
| Parameter | Type |
|---|---|
options | Readonly<AxAIServiceOptions> |
Returns
void
Implementation of
create()
static create<T>(options: T): AxAI<InferTModelKey<T>>;
Defined in: https://github.com/ax-llm/ax/blob/d2df625e2c2fd70a090d6321c042579c2819f0d1/src/ax/ai/wrap.ts#L141
Type Parameters
| Type Parameter |
|---|
T extends AxAIArgs<any> |
Parameters
| Parameter | Type |
|---|---|
options | T |
Returns
AxAI<InferTModelKey<T>>