createAIEngine()
const createAIEngine: (cfg) => AIEngine = AIEngine.createAIEngine;
Creates an AI Engine with the given configuration.
The AI Engine provides utilities for creating and running conversational workflows with large language models, specifically OpenAI GPT models.
Parameters
| Parameter | Type |
|---|---|
cfg | EngineConfig |
Returns
An AIEngine instance.
Example
const engine = createAIEngine({
logger: customLogger,
basePath: '/path/to/prompts'
});
const workflow = await engine.createWorkflow(
engine.createStep({
name: 'generate-response',
prompt: engine.loadFile('prompts/response.txt'),
execute: (response) => conversation.setProposedReply(response)
})
);
const reply = await workflow.run(conversation);