Issue with Postgre SQL query when converting embedding array to vector format

Describe the problem/error/question

I have generated vectors from fetched email content, its metadata, and attachments, and saved them inside a table.
table name - inbox_mails
email’s content and metadata vector - ‘email_embedding’ column
email’s content and attachments vector - ‘merged_embedding’ column

What is the error message (if any)?

I am trying to search for the content using the hybrid method using a simple workflow as shown below (according to ChatGPT’s suggestion), I am facing an issue when executing the SQL query after embedding the prompt using Ollama3.2. The error message is ‘invalid input syntax for type vector:’. I have used these two nodes to generate embedding (an array format output) and convert it into a vector format before saving it into pgvector column, and I have never faced this issue before. I need help to resolve this issue, if possible. Thank you very much for your support.
The objective is to use a Chat trigger node to generate a prompt to search specific content from the fetched email and attachments via a hybrid search method.
Can I convert this original issue into a RAG AI agent using ollama3.2 and pgvector store?

Please share your workflow



(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: self-hosted version 1.72.1
  • Database (default: SQLite): self-hosted PostgreSQL + pgvector
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Desktop
  • Operating system: MacOS (latest)

I don’t know exactly, but you may have to convert the string coming from n8n into a verctor. Maybe like this:
string_to_array($1, ‘,’)::vector

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