paulpierre / RasaGPT

💬 RasaGPT is the first headless LLM chatbot platform built on top of Rasa and Langchain. Built w/ Rasa, FastAPI, Langchain, LlamaIndex, SQLModel, pgvector, ngrok, telegram
https://rasagpt.dev
MIT License
2.36k stars 227 forks source link

problem with building models in postgres #66

Open aolin118 opened 10 months ago

aolin118 commented 10 months ago

add text() to several query in models.py and I met below problems

💽 Building models in Postgres ..

wait-for-it.sh: waiting 60 seconds for db:5432 to be available (tcp) wait-for-it.sh: db:5432 is available after 0 seconds INFO:config:...Enabling pgvector and creating database tables ...Enabling pgvector and creating database tables Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context self.dialect.do_execute( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute cursor.execute(statement, parameters)

psycopg2.errors.InvalidParameterValue: dimensions for type vector cannot exceed 1024

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/app/api/models.py", line 665, in create_db() File "/app/api/models.py", line 588, in create_db enable_vector() File "/app/api/models.py", line 625, in enable_vector add_vector_distance_fn(session) File "/app/api/models.py", line 658, in add_vector_distance_fn session.exec(query) File "/usr/local/lib/python3.9/site-packages/sqlmodel/orm/session.py", line 68, in exec results = super().execute( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2308, in execute return self._execute_internal( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2199, in _execute_internal result = conn.execute( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1416, in execute return meth( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection return connection._execute_clauseelement( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement ret = self._execute_context( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context return self._exec_single_context( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context self._handle_dbapi_exception( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context self.dialect.do_execute( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DataError: (psycopg2.errors.InvalidParameterValue) dimensions for type vector cannot exceed 1024

[SQL: create or replace function match_node_euclidean ( query_embeddings vector(1536), match_threshold float, match_count int ) returns table ( uuid uuid, text varchar, similarity float ) language plpgsql as $$ begin return query select node.uuid, node.text, 1 - (node.embeddings <-> query_embeddings) as similarity from node where 1 - (node.embeddings <-> query_embeddings) > match_threshold order by similarity desc limit match_count; end; $$;] (Background on this error at: https://sqlalche.me/e/20/9h9h) make[1]: [models] Error 1 make: [install] Error 2