Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behavior when passing ARRAY in payload #168

Open
Ben8t opened this issue Dec 5, 2024 · 0 comments
Open

Different behavior when passing ARRAY in payload #168

Ben8t opened this issue Dec 5, 2024 · 0 comments
Labels
area/backend Needs backend code changes bug Something isn't working

Comments

@Ben8t
Copy link
Member

Ben8t commented Dec 5, 2024

Describe the issue

Is it normal to have a different behavior between the following syntax?

    formData:
      parameters:
        an_array:
          - value1
          - value2
    formData:
      parameters:
        an_array: "{{ inputs.my_array }}" # inputs.my_array is of type ARRAY

Here is my flow for example, and I have two different API response depending of the choosen syntax

id: user_research_categorization_feedback
namespace: kestra

inputs:
  - id: user_message
    type: STRING


tasks:
  - id: http
    type: io.kestra.plugin.core.http.Request
    uri: https://api-inference.huggingface.co/models/facebook/bart-large-mnli
    method: POST
    contentType: application/json
    headers:
      Authorization: "Bearer {{ secret('HF_API_TOKEN') }}"
    formData:
      inputs: "{{ inputs.user_message }}"
      parameters:
        candidate_labels:
          - refund
          - new_feature
          - legal

  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ json(outputs.http.body).labels[0] }}" 

Here is the output - well formatted/expected : {"sequence":"refund","labels":["refund","legal","new_feature"],"scores":[0.8690019845962524,0.07823403179645538,0.05276406183838844]}

when using:

    formData:
      inputs: "{{ inputs.user_message }}"
      parameters:
        candidate_labels: "['refund', 'new_feature', 'legal']"

the output is different and mixed : {"sequence":"I need this new feature in product","labels":["\"new_feature\"","\"legal\"]","[\"refund\""],"scores":[0.836469829082489,0.11843764036893845,0.04509248584508896]}

Environment

  • Kestra Version: develop
@Ben8t Ben8t added bug Something isn't working area/plugin Plugin-related issue or feature request labels Dec 5, 2024
@Ben8t Ben8t added this to Issues Dec 5, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Dec 5, 2024
@Ben8t Ben8t added area/backend Needs backend code changes and removed area/plugin Plugin-related issue or feature request labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant