MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / getEndpointForModel

Function getEndpointForModel

app/src/server/utils/openai.ts:176–188  ·  view source on GitHub ↗
(model: AzureModel)

Source from the content-addressed store, hash-verified

174}
175
176const getEndpointForModel = (model: AzureModel) => {
177 // weight endpoints by rate limit
178 const i =
179 Math.random() * modelEndpoints[model].reduce((sum, endpoint) => sum + endpoint.rateLimit, 0);
180 let sum = 0;
181 for (const endpoint of modelEndpoints[model]) {
182 sum += endpoint.rateLimit;
183 if (i < sum) {
184 return endpoint;
185 }
186 }
187 throw new Error("No endpoint found");
188};

Callers 1

getAzureGpt4CompletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected