File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
openai-core/src/main/scala/io/cequence/openaiscala/service Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -246,14 +246,14 @@ This extension of the standard chat completion is currently supported by the fol
246246
247247** III. Using multiple services (🔥 new)**
248248
249- - Load distribution with ` OpenAIMultiServiceAdapter ` - _ rotation type _ aka "round robin"
249+ - Load distribution with ` OpenAIMultiServiceAdapter ` - _ round robin _ ( _ rotation _ ) type
250250
251251``` scala
252252 val service1 = OpenAIServiceFactory (" your-api-key1" )
253253 val service2 = OpenAIServiceFactory (" your-api-key2" )
254254 val service3 = OpenAIServiceFactory (" your-api-key3" )
255255
256- val service = OpenAIMultiServiceAdapter .ofRotationType (service1, service2, service3)
256+ val service = OpenAIMultiServiceAdapter .ofRoundRobinType (service1, service2, service3)
257257
258258 service.listModels.map { models =>
259259 models.foreach(println)
@@ -268,7 +268,7 @@ This extension of the standard chat completion is currently supported by the fol
268268 val service2 = OpenAIServiceFactory (" your-api-key2" )
269269 val service3 = OpenAIServiceFactory (" your-api-key3" )
270270
271- val service = OpenAIMultiServiceAdapter .ofRandomAccessType (service1, service2, service3)
271+ val service = OpenAIMultiServiceAdapter .ofRandomOrderType (service1, service2, service3)
272272
273273 service.listModels.map { models =>
274274 models.foreach(println)
Original file line number Diff line number Diff line change @@ -41,11 +41,17 @@ private class OpenAIMultiServiceRandomAccessAdapter(
4141 */
4242object OpenAIMultiServiceAdapter {
4343
44- // maybe calling it "round robin" would be better?
44+ @ Deprecated ( " Use ofRoundRobinType instead " )
4545 def ofRotationType (underlyings : OpenAIService * ): OpenAIService =
46- new OpenAIMultiServiceRotationAdapter (underlyings)
46+ ofRoundRobinType (underlyings:_* )
4747
48- // TODO: rename to ofRandomOrder
48+ @ Deprecated ( " Use ofRandomOrderType instead " )
4949 def ofRandomAccessType (underlyings : OpenAIService * ): OpenAIService =
50+ ofRandomOrderType(underlyings:_* )
51+
52+ def ofRoundRobinType (underlyings : OpenAIService * ): OpenAIService =
53+ new OpenAIMultiServiceRotationAdapter (underlyings)
54+
55+ def ofRandomOrderType (underlyings : OpenAIService * ): OpenAIService =
5056 new OpenAIMultiServiceRandomAccessAdapter (underlyings)
5157}
You can’t perform that action at this time.
0 commit comments