SupabaseVectorStore as_retriever raises ValueError
Labels: name: area: embeddings, name: area: vector store, name: auto:bug

### System Info

langchain "^0.0.300"
Windows Subsystem for Linux
Python 3.11.5

Supabase Postgres PGVector

### Who can help?

@agola11

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [X] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

``The [documentation](https://python.langchain.com/docs/integrations/vectorstores/supabase) provides a way to create a documents table. I did some changes:
1. `id ` is Not Null
2. Table's name is "document" instead of "documents"

```sql
-- Enable the pgvector extension to work with embedding vectors
CREATE EXTENSION IF NOT EXISTS vector;

-- Create a table to store documents, a document is linked to a knowledge_base
CREATE TABLE IF NOT EXISTS document (
  id uuid not null PRIMARY KEY,
  content TEXT, -- corresponds to Document.pageContent
  metadata JSONB, -- corresponds to Document.metadata
  embedding VECTOR(1536) -- 1536 works for OpenAI embeddings, change if needed
);
```

I have some vectors in my DB. Now I'm trying to query them following the [documentation](https://python.langchain.com/docs/integrations/vectorstores/supabase) examples. Here is my script:

```python
import os
from dotenv import load_dotenv
from supabase import create_client, Client
from langchain.vectorstores import SupabaseVectorStore
from langchain.embeddings.openai import OpenAIEmbeddings

load_dotenv()

embeddings = OpenAIEmbeddings()
supabase_url: str = os.environ.get("SUPABASE_URL")
supabase_key: str = os.environ.get("SUPABASE_SERVICE_KEY")
openai_key: str = os.environ.get("OPENAI_API_KEY")
supabase: Client = create_client(supabase_url, supabase_key)


def similarity_search_with_score(query: str):
    vector_store = SupabaseVectorStore(embedding=embeddings, client=supabase, table_name="document", query_name="match_documents")
    matched_docs = vector_store.similarity_search_with_relevance_scores(query)
    print(matched_docs[0].page_content)

def mmr_search(query: str):
    vector_store = SupabaseVectorStore(embedding=embeddings, client=supabase, table_name="document", query_name="match_documents")
    retriever = vector_store.as_retriever(search_type="mmr")
    matched_docs = retriever.get_relevant_documents(query)
    print(matched_docs[0].page_content)

def main():
    query = "Que es Sader?"
    similarity_search_with_score(query)
    mmr_search(query)

main()
```

`vector_store.similarity_search_with_relevance_scores` works as expected. However `retriever.get_relevant_documents(query)` raises:

```
Exception has occurred: ValueError
Number of columns in X and Y must be the same. X has shape (1, 1536) and Y has shape (20, 0).
  File "/home/ahr/synapzia/service/service/retrieve.py", line 24, in mmr_search
    matched_docs = retriever.get_relevant_documents(query)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ahr/synapzia/service/service/retrieve.py", line 28, in main
    mmr_search("Que es Sader?")
  File "/home/ahr/synapzia/service/service/retrieve.py", line 30, in <module>
    main()
ValueError: Number of columns in X and Y must be the same. X has shape (1, 1536) and Y has shape (20, 0).
```

_Notes_:
1. `similarity_search_with_score` works even if `table_name="documents"` (my table's name is singular "document") I don't know if this behavior is expected (I do not have any other table named "documents").
2. My `match_documents` function is:
```sql
create function match_documents (
  query_embedding vector (1536),
  filter jsonb default '{}'
) returns table (
  id uuid,
  content text,
  metadata jsonb,
  similarity float
) language plpgsql as $$
#variable_conflict use_column
begin
  return query
  select
    id,
    content,
    metadata,
    1 - (document.embedding <=> query_embedding) as similarity
  from document
  where metadata @> filter
  order by document.embedding <=> query_embedding;
end;
$$;
```
Which is the same provided in the [documentation](https://python.langchain.com/docs/integrations/vectorstores/supabase). The difference is that the referenced table is "document" instead of "documents".


### Expected behavior

```python
vector_store = SupabaseVectorStore(embedding=embeddings, client=supabase, table_name="document", query_name="match_documents")
retriever = vector_store.as_retriever(search_type="mmr")
retriever.get_relevant_documents(query)
```

Assuming that the keys and other Supabase, OpenAi setup was done correctly.  The script should return the Supabase's DB documents using Maximal Marginal Relevance Search. Instead of raising ValueError.