llamaindex
Version:
<p align="center"> <img height="100" width="100" alt="LlamaIndex logo" src="https://ts.llamaindex.ai/square.svg" /> </p> <h1 align="center">LlamaIndex.TS</h1> <h3 align="center"> Data framework for your LLM application. </h3>
20 lines (19 loc) • 513 B
JavaScript
import { Settings } from "../Settings.js";
import { LLMMultiSelector, LLMSingleSelector } from "./llmSelectors.js";
export const getSelectorFromContext = (isMulti = false)=>{
let selector = null;
const llm = Settings.llm;
if (isMulti) {
selector = new LLMMultiSelector({
llm
});
} else {
selector = new LLMSingleSelector({
llm
});
}
if (selector === null) {
throw new Error("Selector is null");
}
return selector;
};