wso2 / api-manager

All issues, tasks, improvements and new features of WSO2 API Manager
Apache License 2.0
34 stars 8 forks source link

Error encountered when creating an API Product using MistralAI API #3316

Open ashera96 opened 3 weeks ago

ashera96 commented 3 weeks ago

Description

API product creation using MistralAI API logs a server error even though the UI shows success alerts. The following list of errors are listed under the Devportal tryout UI when attempting to invoke a resource of the created AI API based API product.

image

Steps to Reproduce

  1. Create, deploy and publish an AI API by following the doc [1].
  2. Try creating an API Product using the MistralAI API
  3. Product creation is successful as per the UI alerts. However, the following stacktrace is logged in the server.
[2024-10-29 12:23:29,069] ERROR - SynapseArtifactGenerator Error while creating Synapse configurations
org.wso2.carbon.apimgt.api.APIManagementException: 900754:Error while parsing OpenAPI definition::attribute components.schemas.ChatCompletionRequest.SystemMessage is not of type `schema`. attribute components.schemas.ChatCompletionResponse.ChatCompletionResponseBase is not of type `schema`. attribute components.schemas.DetailedJobOut.JobMetadataOut is not of type `schema`. attribute components.schemas.ChatCompletionRequest.UserMessage is not of type `schema`. attribute components.schemas.ChatCompletionResponse.ChatCompletionChoice is not of type `schema`. attribute components.schemas.DetailedJobOut.EventOut is not of type `schema`. attribute components.schemas.JobIn.GithubRepositoryIn is not of type `schema`. attribute components.schemas.EmbeddingResponse.ResponseBase is not of type `schema`. attribute components.schemas.HTTPValidationError.ValidationError is not of type `schema`. attribute components.schemas.ListFilesOut.FileSchema is not of type `schema`. attribute components.schemas.ChatCompletionRequest.ToolMessage is not of type `schema`. attribute components.schemas.ChatCompletionRequest.Tool is not of type `schema`. attribute components.schemas.JobsOut.JobOut is not of type `schema`. attribute components.schemas.ChatCompletionRequest.AssistantMessage is not of type `schema`. attribute components.schemas.CompletionChunk.CompletionResponseStreamChoice is not of type `schema`. attribute components.schemas.DetailedJobOut.GithubRepositoryOut is not of type `schema`. attribute components.schemas.DetailedJobOut.WandbIntegrationOut is not of type `schema`. attribute components.schemas.EmbeddingResponse.EmbeddingResponseData is not of type `schema`. attribute components.schemas.JobIn.TrainingFile is not of type `schema`. attribute components.schemas.ChatCompletionRequest.ToolChoice is not of type `schema`. attribute components.schemas.ResponseFormat.ResponseFormats is not of type `schema`. attribute components.schemas.JobIn.WandbIntegration is not of type `schema`. attribute components.schemas.DetailedJobOut.CheckpointOut is not of type `schema`. attribute paths.'/v1/fine_tuning/jobs'(post).responses.200.content.'application/json'.schema.#/components/schemas/JobOut is missing. attribute paths.'/v1/fine_tuning/jobs'(post).responses.200.content.'application/json'.schema.#/components/schemas/LegacyJobMetadataOut is missing
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.common.mappings.ImportUtils.retrieveValidatedSwaggerDefinitionFromArchive(ImportUtils.java:1831) ~[org.wso2.carbon.apimgt.rest.api.publisher.v1.common_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.common.SynapseArtifactGenerator.generateGatewayArtifact(SynapseArtifactGenerator.java:102) ~[?:?]
    at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.RuntimeArtifactGeneratorUtil.generateRuntimeArtifact_aroundBody0(RuntimeArtifactGeneratorUtil.java:61) ~[org.wso2.carbon.apimgt.impl_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.RuntimeArtifactGeneratorUtil.generateRuntimeArtifact(RuntimeArtifactGeneratorUtil.java:1) ~[org.wso2.carbon.apimgt.impl_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.internal.service.impl.RuntimeArtifactsApiServiceImpl.runtimeArtifactsGet(RuntimeArtifactsApiServiceImpl.java:61) ~[?:?]
    at org.wso2.carbon.apimgt.internal.service.RuntimeArtifactsApi.runtimeArtifactsGet(RuntimeArtifactsApi.java:47) ~[?:?]
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[?:?]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[?:?]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[?:?]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[?:?]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[?:?]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[?:?]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[?:?]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[?:?]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[?:?]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[?:?]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[?:?]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[?:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[?:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:529) ~[tomcat-servlet-api_9.0.94.wso2v1.jar:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[?:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:119) ~[org.wso2.carbon.identity.context.rewrite.valve_1.8.41.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.OrganizationContextRewriteValve.invoke(OrganizationContextRewriteValve.java:115) ~[org.wso2.carbon.identity.context.rewrite.valve_1.8.41.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.SameSiteCookieValve.invoke(SameSiteCookieValve.java:38) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:167) ~[org.wso2.carbon.identity.authz.valve_1.8.41.jar:?]
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:118) ~[org.wso2.carbon.identity.auth.valve_1.8.41.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:114) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:75) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:152) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:63) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:137) ~[org.wso2.carbon.tomcat.ext_4.9.27.jar:?]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:383) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:936) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat_9.0.94.wso2v1.jar:?]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat_9.0.94.wso2v1.jar:?]
    at java.lang.Thread.run(Thread.java:1583) ~[?:?]
[2024-10-29 12:23:29,070] ERROR - InMemoryAPIDeployer Error retrieving artifacts for API 9650751d-bfa5-4e45-9c71-ce80c3274178. Storage returned null
[2024-10-29 12:23:29,070] ERROR - InMemoryAPIDeployer Error deploying 9650751d-bfa5-4e45-9c71-ce80c3274178 in Gateway
org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException: Error retrieving artifacts for API 9650751d-bfa5-4e45-9c71-ce80c3274178. Storage returned null
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.retrieveArtifact_aroundBody4(InMemoryAPIDeployer.java:177) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.retrieveArtifact(InMemoryAPIDeployer.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI_aroundBody0(InMemoryAPIDeployer.java:98) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI(InMemoryAPIDeployer.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener$1.run_aroundBody0(GatewayJMSMessageListener.java:197) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener$1.run(GatewayJMSMessageListener.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
    at java.lang.Thread.run(Thread.java:1583) ~[?:?]
[2024-10-29 12:23:29,070] ERROR - InMemoryAPIDeployer Error deploying 9650751d-bfa5-4e45-9c71-ce80c3274178 in Gateway
org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException: Error deploying 9650751d-bfa5-4e45-9c71-ce80c3274178 in Gateway
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.retrieveArtifact_aroundBody4(InMemoryAPIDeployer.java:182) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.retrieveArtifact(InMemoryAPIDeployer.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI_aroundBody0(InMemoryAPIDeployer.java:98) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI(InMemoryAPIDeployer.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener$1.run_aroundBody0(GatewayJMSMessageListener.java:197) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener$1.run(GatewayJMSMessageListener.java:1) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
    at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException: Error retrieving artifacts for API 9650751d-bfa5-4e45-9c71-ce80c3274178. Storage returned null
    at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.retrieveArtifact_aroundBody4(InMemoryAPIDeployer.java:177) ~[org.wso2.carbon.apimgt.gateway_9.30.67.jar:?]
    ... 10 more
[2024-10-29 12:23:29,070] ERROR - GatewayJMSMessageListener Error in deploying artifacts for 9650751d-bfa5-4e45-9c71-ce80c3274178in the Gateway
  1. Try invoking the published API product by navigating to the Developer portal.

[1] https://apim.docs.wso2.com/en/4.4.0/design/create-api/create-ai-api/create-an-ai-api/

Affected Component

APIM

Version

4.4.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response