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:100

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

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:250


_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:397


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:208


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:364


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Returns

undefined | AxModelInfoWithProvider

Implementation of

AxAIService.getEmbedModelInfo

Defined in

src/ax/ai/base.ts:183


getFeatures()

getFeatures(): AxBaseAIFeatures

Returns

AxBaseAIFeatures

Implementation of

AxAIService.getFeatures

Defined in

src/ax/ai/base.ts:200


getModelConfig()

getModelConfig(): AxModelConfig

Returns

AxModelConfig

Implementation of

AxAIService.getModelConfig

Defined in

src/ax/ai/base.ts:204


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo

Defined in

src/ax/ai/base.ts:176


getModelMap()

getModelMap(): undefined | AxAIModelMap

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap

Defined in

src/ax/ai/base.ts:192


getName()

getName(): string

Returns

string

Implementation of

AxAIService.getName

Defined in

src/ax/ai/base.ts:196


setAPIURL()

setAPIURL(apiURL): void

Parameters

apiURL: string

Returns

void

Defined in

src/ax/ai/base.ts:137


setHeaders()

setHeaders(headers): void

Parameters

headers: Record<string, string>

Returns

void

Defined in

src/ax/ai/base.ts:141


setName()

setName(name): void

Parameters

name: string

Returns

void

Defined in

src/ax/ai/base.ts:133


setOptions()

setOptions(options): void

Parameters

options: Readonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

Defined in

src/ax/ai/base.ts:145