Documentation

Build LLM-powered agents
with production-ready TypeScript

DSPy for TypeScript. Working with LLMs is complex—they don't always do what you want. DSPy makes it easier to build amazing things with LLMs. Just define your inputs and outputs (signature) and an efficient prompt is auto-generated and used. Connect together various signatures to build complex systems and workflows using LLMs.

15+ LLM Providers
End-to-end Streaming
Auto Prompt Tuning

AxAIServiceImpl

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L457

Type Parameters

Type Parameter
TModel
TEmbedModel
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse

Methods

createChatReq()

createChatReq(req: Readonly<AxInternalChatRequest<TModel>>, config?: Readonly<AxAIServiceOptions>): 
  | [AxAPI, TChatRequest]
| Promise<[AxAPI, TChatRequest]>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L466

Parameters

ParameterType
reqReadonly<AxInternalChatRequest<TModel>>
config?Readonly<AxAIServiceOptions>

Returns

| [AxAPI, TChatRequest] | Promise<[AxAPI, TChatRequest]>


createChatResp()

createChatResp(resp: Readonly<TChatResponse>): AxChatResponse;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L471

Parameters

ParameterType
respReadonly<TChatResponse>

Returns

AxChatResponse


createChatStreamResp()?

optional createChatStreamResp(resp: Readonly<TChatResponseDelta>, state: object): AxChatResponse;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L473

Parameters

ParameterType
respReadonly<TChatResponseDelta>
stateobject

Returns

AxChatResponse


createEmbedReq()?

optional createEmbedReq(req: Readonly<AxInternalEmbedRequest<TEmbedModel>>): 
  | [AxAPI, TEmbedRequest]
| Promise<[AxAPI, TEmbedRequest]>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L478

Parameters

ParameterType
reqReadonly<AxInternalEmbedRequest<TEmbedModel>>

Returns

| [AxAPI, TEmbedRequest] | Promise<[AxAPI, TEmbedRequest]>


createEmbedResp()?

optional createEmbedResp(resp: Readonly<TEmbedResponse>): AxEmbedResponse;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L482

Parameters

ParameterType
respReadonly<TEmbedResponse>

Returns

AxEmbedResponse


getModelConfig()

getModelConfig(): AxModelConfig;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L484

Returns

AxModelConfig


getTokenUsage()

getTokenUsage(): undefined | AxTokenUsage;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L486

Returns

undefined | AxTokenUsage