Skip to content
0

katanakit-js / IAiProviderStrategy

Interface: IAiProviderStrategy ​

Defined in: src/core/services/agent.service.ts:136

Estrategia de proveedor AI - Strategy Pattern.

Define el contrato que toda implementación de proveedor de completions debe cumplir. El AgentService delega la llamada HTTP en una estrategia concreta, permitiendo intercambiar proveedores (DashScope, OpenAI, self-hosted, mock en tests) sin tocar el bucle del agente.

Methods ​

requestCompletion() ​

ts
requestCompletion(
   config, 
   messages, 
   options
): Promise<ChatCompletionResponse>;

Defined in: src/core/services/agent.service.ts:146

Performs a single chat/completions request against the provider.

Parameters ​

ParameterTypeDescription
config{ apiKey: string; baseUrl: string; model: string; systemPrompt?: string; }Provider configuration (baseUrl, model, apiKey).
config.apiKeystring-
config.baseUrlstring-
config.modelstring-
config.systemPrompt?stringDefault system prompt.
messages{ content: string | null; name?: string; role: "system" | "user" | "assistant" | "tool"; tool_call_id?: string; tool_calls?: { function: { arguments: string; name: string; }; id: string; type: "function"; }[]; }[]Conversation messages.
optionsRequestOptionsSampling options, tools and abort signal.

Returns ​

Promise<ChatCompletionResponse>

The parsed provider response.

Throws ​

On non-2xx responses or transport failures.

Released under the MIT License.