kestra-io / plugin-gcp

Apache License 2.0
9 stars 10 forks source link

GCloud VertexAI Plugin broken with No JsonMapper implementation found #337

Closed shrutimantri closed 8 months ago

shrutimantri commented 8 months ago

Expected Behavior

GCloud Vertex AI plugin task ChatCompletion should run successfully with the example given on the task page.

Actual Behaviour

GCloud Vertex AI plugin task ChatCompletion fails with the error:

2024-03-17 22:36:01.993 • Using service account: smantri-kestra-20230317@empirical-realm-374307.iam.gserviceaccount.com
2024-03-17 22:36:02.181Calling Vertex.AI prediction API https://eu-west3-aiplatform.googleapis.com/v1/projects/empirical-realm-374307/locations/eu-west3/publishers/google/models/chat-bison:predict
2024-03-17 22:36:02.245No JsonMapper implementation found
2024-03-17 22:36:02.245java.lang.IllegalStateException: No JsonMapper implementation found
    at io.micronaut.json.JsonMapper.lambda$createDefault$2(JsonMapper.java:367)
    at java.base/java.util.Optional.orElseThrow(Unknown Source)
    at io.micronaut.json.JsonMapper.createDefault(JsonMapper.java:367)
    at io.micronaut.http.client.netty.DefaultHttpClient.createDefaultMediaTypeRegistry(DefaultHttpClient.java:1796)
    at io.micronaut.http.client.netty.DefaultHttpClient.<init>(DefaultHttpClient.java:431)
    at io.micronaut.http.client.netty.DefaultHttpClient.<init>(DefaultHttpClient.java:417)
    at io.micronaut.http.client.netty.NettyHttpClientFactory.createNettyClient(NettyHttpClientFactory.java:132)
    at io.micronaut.http.client.netty.NettyHttpClientFactory.createNettyClient(NettyHttpClientFactory.java:121)
    at io.micronaut.http.client.netty.NettyHttpClientFactory.createClient(NettyHttpClientFactory.java:60)
    at io.kestra.plugin.gcp.vertexai.AbstractGenerativeAi.client(AbstractGenerativeAi.java:105)
    at io.kestra.plugin.gcp.vertexai.AbstractGenerativeAi.call(AbstractGenerativeAi.java:65)
    at io.kestra.plugin.gcp.vertexai.ChatCompletion.run(ChatCompletion.java:77)
    at io.kestra.plugin.gcp.vertexai.ChatCompletion.run(ChatCompletion.java:26)
    at io.kestra.core.runners.Worker$WorkerThread.run(Worker.java:710)

Steps To Reproduce

  1. Execute the flow in the Example flow by providing proper parameters.
  2. The execution fails with an "No JsonMapper implementation found" error.

Environment Information

Example flow

id: gcloud-vertexai-chat-completion
namespace: dev
tasks:
  - id: "chat_completion"
    type: "io.kestra.plugin.gcp.vertexai.ChatCompletion"
    region: eu-west3
    projectId: "<project-id>"
    serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_JSON') }}"
    context: I love jokes that talk about sport
    messages:
      - author: user
        content: Please tell me a joke
shrutimantri commented 8 months ago

VertexAI TextCompletion task is also failing with the same error.

loicmathieu commented 8 months ago

Did you check with the latest plugin version? Because this has been fixed by plugin version 0.15.1.

loicmathieu commented 8 months ago

And be careful that the service for text or chat completion may not be available in all regions.