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

[BUG] File vector upsert (API) - how to attach overrideConfig #3320

Closed
bendadaniel opened this issue Oct 8, 2024 · 1 comment · Fixed by #3347
Closed

[BUG] File vector upsert (API) - how to attach overrideConfig #3320

bendadaniel opened this issue Oct 8, 2024 · 1 comment · Fixed by #3347
Labels
enhancement New feature or request in-work Issue in work

Comments

@bendadaniel
Copy link

Hello,

Describe the bug
I upsert file to Pinecone vector store via API. It works fine. Hovewer I also want to include overrideConfig to push some specific metadata to vector store. I cannot find a way how to do it. When document is upserted it always contains string "{{$vars.mediaId}}" as metadata value. Chatflow should be fine I think, because if I change Document loader setting - additional metadata to awMediaId:"{{$flow.chatId}}" it works and in Pinecone's metadata 'awMediaId' is real chat id in value.

Base js code: (it works fine)

let formData = new FormData();
  formData.append("files", base64ToBlob(fileBase64, 'application/pdf'), "document.pdf");
  formData.append("chatId", chatId);  
  const response = await fetch(
      `${apiHost}/api/v1/vector/upsert/${chatflowid}`,
      {
          method: "POST",
          body: formData
      }
  );
  const result = await response.json();

I tried to append overrideConfig like this but it doesnt work:

// 1
formData.append("overrideConfig", JSON.stringify(
  {
    "vars": {
      "mediaId": "media-id-123"
  }
}));

// 2
formData.append("overrideConfig[vars][mediaId]", "media-id-123");  

// 3
formData.append("mediaId", "media-id-123");

Document loader
Screenshot 2024-10-08 at 14 38 00

Pinecode result
Screenshot 2024-10-08 at 14 38 18

Test with variable $flow.chatId -- it works
Screenshot 2024-10-08 at 14 47 57
Screenshot 2024-10-08 at 14 46 31

Do you have please any idea how to solve my problem?

Thank you

@bendadaniel bendadaniel changed the title [BUG] File vector upsert - how to attach overrideConfig [BUG] File vector upsert (API) - how to attach overrideConfig Oct 8, 2024
@HenryHengZJ HenryHengZJ added enhancement New feature or request in-work Issue in work labels Oct 12, 2024
@HenryHengZJ
Copy link
Contributor

I think one workaround is to have metadata in the formBody

formData.append("metadata", JSON.stringify({ "mediaId": "media-id-123" }));

@HenryHengZJ HenryHengZJ linked a pull request Oct 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in-work Issue in work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants