Ironclad / rivet

The open-source visual AI programming environment and TypeScript library
https://rivet.ironcladapp.com
MIT License
2.55k stars 226 forks source link

[Bug]: Match node matches wrong #337

Open andris1 opened 5 months ago

andris1 commented 5 months ago

What happened?

I have an array of objects that looks like this:

{
  "fn_name": "{{fn_name}}",
  "values": {
    "fn_arguments": "{{fn_arguments}}", 
    "response_message": "{{response_message}}"
  }
}

fn_name can sometimes be null (which is what I suspect is causing issues)

I destructure it to get fn_name and values (so far so good) to pass to the match node as test and value inputs respectively.

Say fn_name is something like ['fn1', 'fn2', null, null] and the match node has fn1 and fn2 to match against. Match will match all 4 of them against fn1.

What was the expected functionality?

Expected fn1 to match against fn1, and null to match against unmatched.

Describe your environment

Windows, Rivet 1.7.7.

Relevant log output

No response

Relevant screenshots

No response

Code of Conduct

andris1 commented 5 months ago

Upon exploring it more, I'm even more confused.

image

In the above example, the result I expected was match to produce: val1, val2, unmatched/red herring.

andris1 commented 5 months ago

Ok, I understood that you can put the whole thing into a subgraph to run it n times and then coalesce.

So not a bug, issue can be closed. Not the behavior I expected though.

abrenneke commented 5 months ago

Yeah @andris1 match nodes (or any node that conditionally doesn't run some of its outputs) don't really work with Split mode turned on unfortunately. The status of which array indicies run for each port is lost right now. I'm going to reopen this since it's definitely something we should track.