epam / ai-dial-core

The main component of AI DIAL, which provides unified API to different chat completion and embedding models, assistants, and applications
https://epam-rail.com
Apache License 2.0
56 stars 16 forks source link

Chat completion request with per request API key fails to model adapter #449

Closed astsiapanay closed 3 weeks ago

astsiapanay commented 4 weeks ago

Steps to reproduce:

  1. Chat calls app A
  2. Core assigns per request Api Key to the app A
  3. Core calls app A
  4. app A calls model M with interceptors through Core with the per request API key
  5. Core checks if model M has interceptors and tries to call the first one and fails with the error:
java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "<local3>" is null
    at com.epam.aidial.core.controller.DeploymentPostController.isValidDeploymentApi(DeploymentPostController.java:484)
    at com.epam.aidial.core.controller.DeploymentPostController.handleDeployment(DeploymentPostController.java:91)
    at com.epam.aidial.core.controller.DeploymentPostController.handleInterceptor(DeploymentPostController.java:165)
    at com.epam.aidial.core.controller.DeploymentPostController.lambda$handleDeployment$3(DeploymentPostController.java:132)
    at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:35)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
    at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:196)
    at io.vertx.core.impl.future.FutureBase.map(FutureBase.java:108)
    at com.epam.aidial.core.controller.DeploymentPostController.handleDeployment(DeploymentPostController.java:126)
    at com.epam.aidial.core.controller.DeploymentPostController.handle(DeploymentPostController.java:86)
    at com.epam.aidial.core.controller.ControllerSelector.lambda$selectPost$69cf69c3$1(ControllerSelector.java:220)
    at com.epam.aidial.core.Proxy.processAuthorizationResult(Proxy.java:219)
    at com.epam.aidial.core.Proxy.lambda$handleRequest$4(Proxy.java:194)
    at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:38)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
    at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
    at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
    at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
    at io.vertx.core.impl.future.SucceededFuture.addListener(SucceededFuture.java:88)
    at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:43)
    at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:262)
    at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:840)