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>
27 lines (26 loc) • 652 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "BaseSelector", {
enumerable: true,
get: function() {
return BaseSelector;
}
});
const _prompts = require("@llamaindex/core/prompts");
function wrapChoice(choice) {
if (typeof choice === "string") {
return {
description: choice
};
} else {
return choice;
}
}
class BaseSelector extends _prompts.PromptMixin {
async select(choices, query) {
const metadata = choices.map((choice)=>wrapChoice(choice));
return await this._select(metadata, query);
}
}