Spaces:
Sleeping
Sleeping
File size: 995 Bytes
06671aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import type { StreamChatParams, StreamChatResult } from "../llm/types";
import { getInferenceAdapter } from "./registry";
import { resolveInferenceProvider } from "./resolveProvider";
import type { CompleteTextParams } from "./types";
export async function executeStreamChat(
params: StreamChatParams,
): Promise<StreamChatResult> {
const provider = resolveInferenceProvider({
model: params.model,
explicitRequestProvider: params.explicitRequestProvider,
featureId: params.featureId,
});
const adapter = getInferenceAdapter(provider);
return adapter.streamChat(params);
}
export async function executeCompleteText(
params: CompleteTextParams,
): Promise<string> {
const provider = resolveInferenceProvider({
model: params.model,
explicitRequestProvider: params.explicitRequestProvider,
featureId: params.featureId,
});
const adapter = getInferenceAdapter(provider);
return adapter.completeText(params);
}
|