Skip to main content

Function: createLlmService()

createLlmService(config): LlmService

Defined in: src/ai/llm-service.ts:115

Create an LlmService from the Praman configuration.

Parameters​

config​

Readonly<PramanConfig>

Validated Praman configuration (Readonly)

Returns​

LlmService

Remarks​

Reads config.ai.provider to select the provider. Throws AIError with code: 'ERR_AI_NOT_CONFIGURED' when config.ai is absent.

Provider packages are loaded lazily on first call to complete() or chat(). An AIError with code: 'ERR_AI_NOT_CONFIGURED' is also thrown if the package is not installed.

Throws​

AIError when config.ai is undefined

Example​

const llm = createLlmService(pramanConfig);
const result = await llm.complete('Generate test steps', StepsSchema);