SupabaseVectorStore: Error thrown when calling similarity_search_by_vector_with_relevance_scores
Labels: name: area: vector store, name: auto:bug

### System Info

### Error

I am using **Supabase Vector Store**:

```python
embeddings = OpenAIEmbeddings()
vectorstore_public = SupabaseVectorStore(

        client=supabase_client,
        embedding=embeddings,
        table_name="documents",
        query_name="match_documents",
    )
```

And crawling pages from internet using the `WebResearchRetriever`

But, in `WebResearchRetriever._get_relevant_documents`

```python
# Search for relevant splits
        # TODO: make this async
        logger.info("Grabbing most relevant splits from urls...")
        docs = []
        for query in questions:
            docs.extend(self.vectorstore.similarity_search(query))
```

The `vectorstore.similarity_search` guides to an rpc call using the `SupabaseVectorStore`

```python
def similarity_search_by_vector_with_relevance_scores(
        self, query: List[float], k: int, filter: Optional[Dict[str, Any]] = None
    ) -> List[Tuple[Document, float]]:
        match_documents_params = self.match_args(query, k, filter)
        print("match_documents_params", match_documents_params)
        print("self.query_name", self.query_name)
        res = self._client.rpc(self.query_name, match_documents_params).execute() # here is where the error is thrown
        print("res", res)
        match_result = [
            (
                Document(
                    metadata=search.get("metadata", {}),  # type: ignore
                    page_content=search.get("content", ""),
                ),
                search.get("similarity", 0.0),
            )
            for search in res.data
            if search.get("content")
        ]

        return match_result
```

Error thrown:

```python
File "/lib/python3.10/site-packages/postgrest/_sync/request_builder.py", line 68, in execute
    raise APIError(r.json())

postgrest.exceptions.APIError: {'code': '42804', 'details': 'Returned type text does not match expected type bigint in column 1.', 'hint': None, 'message': 'structure of query does not match function result type'}
```

Complete Traceback

```python
Traceback (most recent call last):
  File "/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/lib/python3.10/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/app.py", line 143, in complete
    answer = completion(message)
  File "/methods/content_completion.py", line 15, in completion
    sources = web_explorer(blog_topic)
  File "/methods/web_explorer.py", line 93, in web_explorer
    result = retrieve_answer_and_sources(question, llm, web_retriever)
  File "/methods/web_explorer.py", line 80, in retrieve_answer_and_sources
    return qa_chain({"question": question}, return_only_outputs=True)
  File "/lib/python3.10/site-packages/langchain/chains/base.py", line 288, in __call__
    raise e
  File "/lib/python3.10/site-packages/langchain/chains/base.py", line 282, in __call__
    self._call(inputs, run_manager=run_manager)
  File "/lib/python3.10/site-packages/langchain/chains/qa_with_sources/base.py", line 151, in _call
    docs = self._get_docs(inputs, run_manager=_run_manager)
  File "/lib/python3.10/site-packages/langchain/chains/qa_with_sources/retrieval.py", line 50, in _get_docs
    docs = self.retriever.get_relevant_documents(
  File "/lib/python3.10/site-packages/langchain/schema/retriever.py", line 208, in get_relevant_documents
    raise e
  File "/lib/python3.10/site-packages/langchain/schema/retriever.py", line 201, in get_relevant_documents
    result = self._get_relevant_documents(
  File "/methods/retrievers.py", line 252, in _get_relevant_documents
    docs.extend(self.vectorstore.similarity_search(query))
  File "/lib/python3.10/site-packages/langchain/vectorstores/supabase.py", line 172, in similarity_search
    return self.similarity_search_by_vector(
  File "/lib/python3.10/site-packages/langchain/vectorstores/supabase.py", line 183, in similarity_search_by_vector
    result = self.similarity_search_by_vector_with_relevance_scores(
  File "/lib/python3.10/site-packages/langchain/vectorstores/supabase.py", line 217, in similarity_search_by_vector_with_relevance_scores
    res = self._client.rpc(self.query_name, match_documents_params).execute()
  File "/lib/python3.10/site-packages/postgrest/_sync/request_builder.py", line 68, in execute
    raise APIError(r.json())
postgrest.exceptions.APIError: {'code': '42804', 'details': 'Returned type text does not match expected type bigint in column 1.', 'hint': None, 'message': 'structure of query does not match function result type'}
```

requirements.txt to reproduce:
```
aiohttp==3.8.5
aiosignal==1.3.1
anyio==4.0.0
async-timeout==4.0.3
attrs==23.1.0
azure-core==1.29.3
backoff==2.2.1
bcrypt==4.0.1
beautifulsoup4==4.12.2
bleach==6.0.0
blinker==1.6.2
cachetools==5.3.1
certifi==2023.7.22
chardet==5.2.0
charset-normalizer==3.2.0
chroma-hnswlib==0.7.2
chromadb==0.4.8
click==8.1.7
click-log==0.4.0
colorama==0.4.6
coloredlogs==15.0.1
dataclasses-json==0.5.14
deprecation==2.1.0
dnspython==2.4.2
docutils==0.20.1
dotty-dict==1.3.1
emoji==2.8.0
exceptiongroup==1.1.3
fastapi==0.99.1
filetype==1.2.0
Flask==2.3.3
Flask-Cors==4.0.0
flatbuffers==23.5.26
frozenlist==1.4.0
gitdb==4.0.10
GitPython==3.1.32
google-api-core==2.11.1
google-api-python-client==2.97.0
google-auth==2.22.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.60.0
gotrue==1.0.4
h11==0.14.0
html-sanitizer==2.2.0
httpcore==0.16.3
httplib2==0.22.0
httptools==0.6.0
httpx==0.23.3
humanfriendly==10.0
idna==3.4
importlib-metadata==6.8.0
importlib-resources==6.0.1
invoke==1.7.3
itsdangerous==2.1.2
jaraco.classes==3.3.0
Jinja2==3.1.2
joblib==1.3.2
keyring==24.2.0
langchain==0.0.277
langsmith==0.0.30
lxml==4.9.3
Markdown==3.4.4
MarkupSafe==2.1.3
marshmallow==3.20.1
monotonic==1.6
more-itertools==10.1.0
mpmath==1.3.0
multidict==6.0.4
mypy-extensions==1.0.0
nltk==3.8.1
numexpr==2.8.5
numpy==1.25.2
onnxruntime==1.15.1
openai==0.27.10
outcome==1.2.0
overrides==7.4.0
packaging==23.1
pkginfo==1.9.6
postgrest==0.10.6
posthog==3.0.2
protobuf==4.24.2
pulsar-client==3.3.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pydantic==1.10.12
Pygments==2.16.1
pymongo==4.5.0
pyparsing==3.1.1
PyPika==0.48.9
PySocks==1.7.1
python-dateutil==2.8.2
python-dotenv==1.0.0
python-gitlab==3.15.0
python-magic==0.4.27
python-semantic-release==7.33.2
PyYAML==6.0.1
readme-renderer==41.0
realtime==1.0.0
regex==2023.8.8
requests==2.31.0
requests-toolbelt==1.0.0
rfc3986==1.5.0
rsa==4.9
selenium==4.11.2
semver==2.13.0
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.4.1
SQLAlchemy==2.0.20
starlette==0.27.0
storage3==0.5.3
StrEnum==0.4.15
supabase==1.0.3
supafunc==0.2.2
sympy==1.12
tabulate==0.9.0
tenacity==8.2.3
tiktoken==0.4.0
tokenizers==0.13.3
tomlkit==0.12.1
tqdm==4.66.1
trio==0.22.2
trio-websocket==0.10.3
twine==3.8.0
typing-inspect==0.9.0
typing_extensions==4.7.1
unstructured==0.10.10
uritemplate==4.1.1
urllib3==1.26.16
uvicorn==0.23.2
uvloop==0.17.0
waitress==2.1.2
watchfiles==0.20.0
webencodings==0.5.1
websockets==10.4
Werkzeug==2.3.7
wsproto==1.2.0
yarl==1.9.2
zipp==3.16.2
```

### Who can help?

@agola11  @hwchase17 

### Information

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

### Related Components

- [ ] LLMs/Chat Models
- [ ] 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

Code from this repo: https://github.com/langchain-ai/web-explorer/blob/main/web_explorer.py

But instead of faiss, use `SupabaseVectorStore` as above.

### Expected behavior

Is it coming from the config of my table on Supabase, as i get: `Returned type text does not match expected type bigint in column 1.` or wherever else ? 

<img width="1176" alt="Capture d’écran 2023-08-31 à 20 15 58" src="https://github.com/langchain-ai/langchain/assets/39488794/743d9cd9-fa30-474d-88ce-288e85c50e71">