Find answers from the community

Updated 3 months ago

`sqlalchemy.exc.ProgrammingError: (

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column data_vector_embeddings.text_search_tsv does not exist

I setup the vector index with LlamaIndex so whatever columns are supposed to be there shouldbe there in my PGVector Store.

Any idea how I'd fix this. It originated from this code:

Plain Text
from cerebro.cbcore.utils.vector_store import CerebroVectorStore
#from asyncio import run
from os import name

query = "Who does Paul Graham think of with the word schtick"
vector_store = CerebroVectorStore()
#if name == 'nt':
#    from asyncio import set_event_loop_policy, WindowsSelectorEventLoopPolicy
#    set_event_loop_policy(WindowsSelectorEventLoopPolicy()) # this fixed it

vector_store.hybrid_search(query)
n
L
4 comments
Relevant code/class info:

Plain Text
    def init_hybrid_engine(self, k: int=3) -> BaseQueryEngine:
        '''Initializes the hybrid engine for the vector store'''

        hybrid_query_engine = self.index.as_query_engine(
            vector_store_query_mode = 'hybrid'
            , sparse_top_k=k
        )

        self.hybrid_query_engine = hybrid_query_engine

        return hybrid_query_engine

    def hybrid_search(self, query: str) -> list[dict]:
        '''Performs a hybrid search on the vector store'''
        
        if hasattr(self, 'hybrid_query_engine') == False:
            self.init_hybrid_engine()

        results = self.hybrid_query_engine.query(query)
        
        return results


Comes from attached code.
I think you'll have to download it, discord isn't letting me upload it normally, the preview is wack
You need to enable hybrid search when you originally build the table

PGVectorStore(..., hybrid_search=True)
This builds a slightly different table schema with the needed columns and indexes
Add a reply
Sign up and join the conversation on Discord