MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / buildConfiguredProviderMap

Function buildConfiguredProviderMap

src/util/gradingProvider.ts:48–59  ·  view source on GitHub ↗
(providers: ApiProvider[])

Source from the content-addressed store, hash-verified

46// IDs are added first; labels only fill keys an ID has not already claimed,
47// so a label collision can never silently shadow another provider's ID.
48export function buildConfiguredProviderMap(providers: ApiProvider[]): Record<string, ApiProvider> {
49 const providerMap: Record<string, ApiProvider> = Object.create(null);
50 for (const provider of providers) {
51 providerMap[provider.id()] = provider;
52 }
53 for (const provider of providers) {
54 if (provider.label && !Object.hasOwn(providerMap, provider.label)) {
55 providerMap[provider.label] = provider;
56 }
57 }
58 return providerMap;
59}
60
61function getConfiguredProvider(
62 id: string,

Callers 3

evaluateWithSourceFunction · 0.90
buildRunEvalOptionsFunction · 0.90

Calls 2

idMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…