Referenceing files and feeding it to OpenAI assistant

Please help to figure out issues with files

Workflow idea: It should create files from JSON data and feed it to OpenAI assistant.

  1. Get a batch of resumes (JSON) and split it into individual itemsSplit into individual items (resumes)
  2. Generate an individual file for every resume and save user_id
  3. Create an OpenAI assistant and feed it the generated files
  4. Process data
  5. Cleanup (delete files from OpenAI, from n8n and delete agent)

Issues :

  1. I can not extract user_id from previous node (node “extract_user_id”). Proposed notation of {{$node[‘SplitResumes’].json}} does not work.
    const user_id = $node[“SplitResumes”].json[“user_id”] gives error “Cannot find name ‘$node’.”
  2. Converting to files node always name file as “file.txt” despite of name that I provide with {{ $json.fileName }}
  3. I can not find out how to feed these files to AI. In Knowledge box it expects something like {{ [“file-NUvCYUWc4McZwTuiBQBRXh”] }} and does not accept file by mask or variable.

Please help.

P.S. n8n community, 1.84.3

If you need to work items from Split individually, you need to work with a single item context in mind. Which means in Code node you use mode Once per each item and referring an item by $json and binary part of item by $binary.

I recommend studying this resource (including sub-pages) Data | n8n Docs for a ton of insights that will make your life a lot easier.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.