@@ -103,148 +103,14 @@ private SortedMap<String, SortedMap<TaskType, MaxNodesPerGroupingStrategy>> crea
103103
104104 MaxNodesPerGroupingStrategy defaultStrategy = (numNodesInCluster ) -> DEFAULT_MAX_NODES_PER_GROUPING ;
105105
106- // Alibaba Cloud Search
107- TreeMap <TaskType , MaxNodesPerGroupingStrategy > alibabaCloudSearchConfigs = new TreeMap <>();
108- var alibabaCloudSearchService = serviceRegistry .getService (AlibabaCloudSearchService .NAME );
109- if (alibabaCloudSearchService .isPresent ()) {
110- var alibabaCloudSearchTaskTypes = alibabaCloudSearchService .get ().supportedTaskTypes ();
111- for (TaskType taskType : alibabaCloudSearchTaskTypes ) {
112- alibabaCloudSearchConfigs .put (taskType , defaultStrategy );
106+ for (var service : serviceRegistry .getServices ().values ()) {
107+ TreeMap <TaskType , MaxNodesPerGroupingStrategy > serviceConfigs = new TreeMap <>();
108+ var taskTypes = service .supportedTaskTypes ();
109+ for (TaskType taskType : taskTypes ) {
110+ serviceConfigs .put (taskType , defaultStrategy );
113111 }
112+ serviceNodeLocalRateLimitConfigs .put (service .name (), serviceConfigs );
114113 }
115- serviceNodeLocalRateLimitConfigs .put (AlibabaCloudSearchService .NAME , alibabaCloudSearchConfigs );
116-
117- // Amazon Bedrock
118- TreeMap <TaskType , MaxNodesPerGroupingStrategy > amazonBedrockConfigs = new TreeMap <>();
119- var amazonBedrockService = serviceRegistry .getService (AmazonBedrockService .NAME );
120- if (amazonBedrockService .isPresent ()) {
121- var amazonBedrockTaskTypes = amazonBedrockService .get ().supportedTaskTypes ();
122- for (TaskType taskType : amazonBedrockTaskTypes ) {
123- amazonBedrockConfigs .put (taskType , defaultStrategy );
124- }
125- }
126- serviceNodeLocalRateLimitConfigs .put (AmazonBedrockService .NAME , amazonBedrockConfigs );
127-
128- // Anthropic
129- TreeMap <TaskType , MaxNodesPerGroupingStrategy > anthropicConfigs = new TreeMap <>();
130- var anthropicService = serviceRegistry .getService (AnthropicService .NAME );
131- if (anthropicService .isPresent ()) {
132- var anthropicTaskTypes = anthropicService .get ().supportedTaskTypes ();
133- for (TaskType taskType : anthropicTaskTypes ) {
134- anthropicConfigs .put (taskType , defaultStrategy );
135- }
136- }
137- serviceNodeLocalRateLimitConfigs .put (AnthropicService .NAME , anthropicConfigs );
138-
139- // Azure AI Studio
140- TreeMap <TaskType , MaxNodesPerGroupingStrategy > azureAiStudioConfigs = new TreeMap <>();
141- var azureAiStudioService = serviceRegistry .getService (AzureAiStudioService .NAME );
142- if (azureAiStudioService .isPresent ()) {
143- var azureAiStudioTaskTypes = azureAiStudioService .get ().supportedTaskTypes ();
144- for (TaskType taskType : azureAiStudioTaskTypes ) {
145- azureAiStudioConfigs .put (taskType , defaultStrategy );
146- }
147- }
148- serviceNodeLocalRateLimitConfigs .put (AzureAiStudioService .NAME , azureAiStudioConfigs );
149-
150- // Cohere
151- TreeMap <TaskType , MaxNodesPerGroupingStrategy > cohereConfigs = new TreeMap <>();
152- var cohereService = serviceRegistry .getService (CohereService .NAME );
153- if (cohereService .isPresent ()) {
154- var cohereTaskTypes = cohereService .get ().supportedTaskTypes ();
155- for (TaskType taskType : cohereTaskTypes ) {
156- cohereConfigs .put (taskType , defaultStrategy );
157- }
158- }
159- serviceNodeLocalRateLimitConfigs .put (CohereService .NAME , cohereConfigs );
160-
161- // DeepSeek
162- TreeMap <TaskType , MaxNodesPerGroupingStrategy > deepSeekConfigs = new TreeMap <>();
163- var deepSeekService = serviceRegistry .getService (DeepSeekService .NAME );
164- if (deepSeekService .isPresent ()) {
165- var deepSeekTaskTypes = deepSeekService .get ().supportedTaskTypes ();
166- for (TaskType taskType : deepSeekTaskTypes ) {
167- deepSeekConfigs .put (taskType , defaultStrategy );
168- }
169- }
170- serviceNodeLocalRateLimitConfigs .put (DeepSeekService .NAME , deepSeekConfigs );
171-
172- // Elastic Inference Service (EIS)
173- TreeMap <TaskType , MaxNodesPerGroupingStrategy > elasticInferenceConfigs = new TreeMap <>();
174- var elasticInferenceService = serviceRegistry .getService (ElasticInferenceService .NAME );
175- if (elasticInferenceService .isPresent ()) {
176- var elasticInferenceTaskTypes = elasticInferenceService .get ().supportedTaskTypes ();
177- for (TaskType taskType : elasticInferenceTaskTypes ) {
178- elasticInferenceConfigs .put (taskType , defaultStrategy );
179- }
180- }
181- serviceNodeLocalRateLimitConfigs .put (ElasticInferenceService .NAME , elasticInferenceConfigs );
182-
183- // Google AI Studio
184- TreeMap <TaskType , MaxNodesPerGroupingStrategy > googleAiStudioConfigs = new TreeMap <>();
185- var googleAiStudioService = serviceRegistry .getService (GoogleAiStudioService .NAME );
186- if (googleAiStudioService .isPresent ()) {
187- var googleAiStudioTaskTypes = googleAiStudioService .get ().supportedTaskTypes ();
188- for (TaskType taskType : googleAiStudioTaskTypes ) {
189- googleAiStudioConfigs .put (taskType , defaultStrategy );
190- }
191- }
192- serviceNodeLocalRateLimitConfigs .put (GoogleAiStudioService .NAME , googleAiStudioConfigs );
193-
194- // Google Vertex AI
195- TreeMap <TaskType , MaxNodesPerGroupingStrategy > googleVertexAiConfigs = new TreeMap <>();
196- var googleVertexAiService = serviceRegistry .getService (GoogleVertexAiService .NAME );
197- if (googleVertexAiService .isPresent ()) {
198- var googleVertexAiTaskTypes = googleVertexAiService .get ().supportedTaskTypes ();
199- for (TaskType taskType : googleVertexAiTaskTypes ) {
200- googleVertexAiConfigs .put (taskType , defaultStrategy );
201- }
202- }
203- serviceNodeLocalRateLimitConfigs .put (GoogleVertexAiService .NAME , googleVertexAiConfigs );
204-
205- // HuggingFace
206- TreeMap <TaskType , MaxNodesPerGroupingStrategy > huggingFaceConfigs = new TreeMap <>();
207- var huggingFaceService = serviceRegistry .getService (HuggingFaceService .NAME );
208- if (huggingFaceService .isPresent ()) {
209- var huggingFaceTaskTypes = huggingFaceService .get ().supportedTaskTypes ();
210- for (TaskType taskType : huggingFaceTaskTypes ) {
211- huggingFaceConfigs .put (taskType , defaultStrategy );
212- }
213- }
214- serviceNodeLocalRateLimitConfigs .put (HuggingFaceService .NAME , huggingFaceConfigs );
215-
216- // IBM Watson X
217- TreeMap <TaskType , MaxNodesPerGroupingStrategy > ibmWatsonxConfigs = new TreeMap <>();
218- var ibmWatsonxService = serviceRegistry .getService (IbmWatsonxService .NAME );
219- if (ibmWatsonxService .isPresent ()) {
220- var ibmWatsonxTaskTypes = ibmWatsonxService .get ().supportedTaskTypes ();
221- for (TaskType taskType : ibmWatsonxTaskTypes ) {
222- ibmWatsonxConfigs .put (taskType , defaultStrategy );
223- }
224- }
225- serviceNodeLocalRateLimitConfigs .put (IbmWatsonxService .NAME , ibmWatsonxConfigs );
226-
227- // Jina AI
228- TreeMap <TaskType , MaxNodesPerGroupingStrategy > jinaAiConfigs = new TreeMap <>();
229- var jinaAiService = serviceRegistry .getService (JinaAIService .NAME );
230- if (jinaAiService .isPresent ()) {
231- var jinaAiTaskTypes = jinaAiService .get ().supportedTaskTypes ();
232- for (TaskType taskType : jinaAiTaskTypes ) {
233- jinaAiConfigs .put (taskType , defaultStrategy );
234- }
235- }
236- serviceNodeLocalRateLimitConfigs .put (JinaAIService .NAME , jinaAiConfigs );
237-
238- // Mistral
239- TreeMap <TaskType , MaxNodesPerGroupingStrategy > mistralConfigs = new TreeMap <>();
240- var mistralService = serviceRegistry .getService (MistralService .NAME );
241- if (mistralService .isPresent ()) {
242- var mistralTaskTypes = mistralService .get ().supportedTaskTypes ();
243- for (TaskType taskType : mistralTaskTypes ) {
244- mistralConfigs .put (taskType , defaultStrategy );
245- }
246- }
247- serviceNodeLocalRateLimitConfigs .put (MistralService .NAME , mistralConfigs );
248114
249115 return Collections .unmodifiableSortedMap (serviceNodeLocalRateLimitConfigs );
250116 }
0 commit comments