Skip to content
Snippets Groups Projects
Commit 28105d35 authored by Yi Ding's avatar Yi Ding
Browse files

service context copy

parent f378170e
No related branches found
No related tags found
No related merge requests found
...@@ -31,3 +31,20 @@ export function serviceContextFromDefaults(options: ServiceContextOptions) { ...@@ -31,3 +31,20 @@ export function serviceContextFromDefaults(options: ServiceContextOptions) {
return serviceContext; return serviceContext;
} }
export function serviceContextFromServiceContext(
serviceContext: ServiceContext,
options: ServiceContextOptions
) {
const newServiceContext = { ...serviceContext };
if (options.llmPredictor) {
newServiceContext.llmPredictor = options.llmPredictor;
}
if (options.embedModel) {
newServiceContext.embedModel = options.embedModel;
}
if (options.nodeParser) {
newServiceContext.nodeParser = options.nodeParser;
}
return newServiceContext;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment