Skip to content

AxBaseAI

Class: AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Extended by

Type Parameters

TChatRequest

TEmbedRequest

TChatResponse

TChatResponseDelta

TEmbedResponse

Implements

Constructors

new AxBaseAI()

new AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>(__namedParameters): AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Parameters

__namedParameters: Readonly<AxBaseAIArgs>

Returns

AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Defined in

src/ax/ai/base.ts:102

Properties

apiURL

protected apiURL: string

Defined in

src/ax/ai/base.ts:95


generateChatReq()?

optional generateChatReq: (req, config) => [API, TChatRequest]

Parameters

req: Readonly<AxInternalChatRequest>

config: Readonly<AxAIPromptConfig>

Returns

[API, TChatRequest]

Defined in

src/ax/ai/base.ts:69


generateChatResp()?

optional generateChatResp: (resp) => AxChatResponse

Parameters

resp: Readonly<TChatResponse>

Returns

AxChatResponse

Defined in

src/ax/ai/base.ts:76


generateChatStreamResp()?

optional generateChatStreamResp: (resp, state) => AxChatResponse

Parameters

resp: Readonly<TChatResponseDelta>

state: object

Returns

AxChatResponse

Defined in

src/ax/ai/base.ts:77


generateEmbedReq()?

optional generateEmbedReq: (req) => [API, TEmbedRequest]

Parameters

req: Readonly<AxInternalEmbedRequest>

Returns

[API, TEmbedRequest]

Defined in

src/ax/ai/base.ts:73


generateEmbedResp()?

optional generateEmbedResp: (resp) => AxEmbedResponse

Parameters

resp: Readonly<TEmbedResponse>

Returns

AxEmbedResponse

Defined in

src/ax/ai/base.ts:81


headers

protected headers: Record<string, string>

Defined in

src/ax/ai/base.ts:97


name

protected name: string

Defined in

src/ax/ai/base.ts:96


supportFor

protected supportFor: AxBaseAIFeatures | (model) => AxBaseAIFeatures

Defined in

src/ax/ai/base.ts:98

Methods

_chat()

_chat(model, chatReq, options?, span?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Parameters

model: string

chatReq: Readonly<AxChatRequest>

options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

span?: AxSpan

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in

src/ax/ai/base.ts:254


_embed()

_embed(embedModel, embedReq, options?, span?): Promise<AxEmbedResponse>

Parameters

embedModel: string

embedReq: Readonly<AxEmbedRequest>

options?: Readonly<AxAIServiceActionOptions>

span?: AxSpan

Returns

Promise<AxEmbedResponse>

Defined in

src/ax/ai/base.ts:400


chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Parameters

req: Readonly<AxChatRequest>

options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat

Defined in

src/ax/ai/base.ts:212


embed()

embed(req, options?): Promise<AxEmbedResponse>

Parameters

req: Readonly<AxEmbedRequest>

options?: Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed

Defined in

src/ax/ai/base.ts:367


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Returns

undefined | AxModelInfoWithProvider

Implementation of

AxAIService.getEmbedModelInfo

Defined in

src/ax/ai/base.ts:185


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Parameters

model?: string

Returns

AxBaseAIFeatures

Implementation of

AxAIService.getFeatures

Defined in

src/ax/ai/base.ts:202


getModelConfig()

getModelConfig(): AxModelConfig

Returns

AxModelConfig

Implementation of

AxAIService.getModelConfig

Defined in

src/ax/ai/base.ts:208


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo

Defined in

src/ax/ai/base.ts:178


getModelMap()

getModelMap(): undefined | AxAIModelMap

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap

Defined in

src/ax/ai/base.ts:194


getName()

getName(): string

Returns

string

Implementation of

AxAIService.getName

Defined in

src/ax/ai/base.ts:198


setAPIURL()

setAPIURL(apiURL): void

Parameters

apiURL: string

Returns

void

Defined in

src/ax/ai/base.ts:139


setHeaders()

setHeaders(headers): void

Parameters

headers: Record<string, string>

Returns

void

Defined in

src/ax/ai/base.ts:143


setName()

setName(name): void

Parameters

name: string

Returns

void

Defined in

src/ax/ai/base.ts:135


setOptions()

setOptions(options): void

Parameters

options: Readonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

Defined in

src/ax/ai/base.ts:147