(model: AzureModel)
| 174 | } |
| 175 | |
| 176 | const 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 | }; |
no outgoing calls
no test coverage detected