io.cequence.openaiscala.service.OpenAIStreamedServiceFactory.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openai-scala-client-stream_2.13 Show documentation
Show all versions of openai-scala-client-stream_2.13 Show documentation
Stream support for the OpenAI Scala client.
The newest version!
package io.cequence.openaiscala.service
import akka.stream.Materializer
import io.cequence.openaiscala.service.impl.OpenAICoreServiceStreamedExtraImpl
import io.cequence.wsclient.domain.WsRequestContext
import io.cequence.wsclient.service.ws.stream.PlayWSStreamClientEngine
import io.cequence.wsclient.service.{WSClientEngine, WSClientEngineStreamExtra}
import scala.concurrent.ExecutionContext
object OpenAIStreamedServiceFactory
extends OpenAIServiceFactoryHelper[OpenAIStreamedServiceExtra] {
override def customInstance(
coreUrl: String,
requestContext: WsRequestContext = WsRequestContext()
)(
implicit ec: ExecutionContext,
materializer: Materializer
): OpenAIStreamedServiceExtra =
new OpenAICoreStreamedServiceExtraClassImpl(coreUrl, requestContext)
private final class OpenAICoreStreamedServiceExtraClassImpl(
coreUrl: String,
requestContext: WsRequestContext
)(
implicit val ec: ExecutionContext,
val materializer: Materializer
) extends OpenAICoreServiceStreamedExtraImpl {
// Play WS engine
override protected val engine: WSClientEngine with WSClientEngineStreamExtra =
PlayWSStreamClientEngine(coreUrl, requestContext)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy