UNPKG

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>

17 lines (16 loc) 439 B
import { PromptMixin } from "@llamaindex/core/prompts"; function wrapChoice(choice) { if (typeof choice === "string") { return { description: choice }; } else { return choice; } } export class BaseSelector extends PromptMixin { async select(choices, query) { const metadata = choices.map((choice)=>wrapChoice(choice)); return await this._select(metadata, query); } }