import { getChatProvider } from './providers';
export const createChatAgent = (options) => {
    const provider = getChatProvider(options.providerId);
    const agent = provider.createAgent(options);
    if (agent instanceof Promise) {
        throw new Error(`Provider "${options.providerId}" returned a Promise-based agent which is not yet supported`);
    }
    if (!agent) {
        throw new Error(`Provider "${options.providerId}" returned an invalid agent instance`);
    }
    return agent;
};
