({
providerName,
modelName,
promptParams,
timeout,
maxRetries,
}: {
providerName: string;
modelName: string;
promptParams: BasePromptParams;
timeout: number;
maxRetries: number;
})
| 2 | import { BasePromptParams } from "../schema"; |
| 3 | |
| 4 | export default async function* streamHandler({ |
| 5 | providerName, |
| 6 | modelName, |
| 7 | promptParams, |
| 8 | timeout, |
| 9 | maxRetries, |
| 10 | }: { |
| 11 | providerName: string; |
| 12 | modelName: string; |
| 13 | promptParams: BasePromptParams; |
| 14 | timeout: number; |
| 15 | maxRetries: number; |
| 16 | }) { |
| 17 | const providerInstance = ProviderFactory.createProvider(providerName); |
| 18 | for await (const messageEvent of providerInstance.generateStream(modelName, promptParams, timeout, maxRetries)) { |
| 19 | yield messageEvent; |
| 20 | } |
| 21 | } |
no test coverage detected