From 13a87a812b15071074c94a650886ccb78db507da Mon Sep 17 00:00:00 2001 From: Jonas Braus Date: Wed, 11 Dec 2024 23:01:11 +0100 Subject: [PATCH] =?UTF-8?q?l=C3=BCl=C3=BCl=C3=BCl=C3=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib.py | 2 +- main.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib.py b/lib.py index 1dc6247..2ca388a 100644 --- a/lib.py +++ b/lib.py @@ -55,7 +55,7 @@ def prompt_embedding(prompt): ) cur = conn.cursor() - cur.execute(f"select id, doc_id, filepath, embedding <-> %s::vector as distance from dbtable order by distance limit 3;", (embedding["embedding"],)) + cur.execute(f"select id, filepath, embedding <-> %s::vector as distance from dbtable order by distance limit 3;", (embedding["embedding"],)) result = cur.fetchall() diff --git a/main.py b/main.py index 95f31b0..82a1da4 100644 --- a/main.py +++ b/main.py @@ -49,7 +49,6 @@ def create_embeddings(pContent): create_table_query = ''' create table if not exists dbtable ( id SERIAL PRIMARY KEY, - doc_id Serial NOT NULL, filepath TEXT NOT NULL, embedding VECTOR NOT NULL ); @@ -67,7 +66,7 @@ def create_embeddings(pContent): # print(merged_info) response = ollama.embeddings(model="mxbai-embed-large", prompt=merged_info) #embedding_list.append(response["embedding"]) - insert_data = f"insert into dbtable (filepath, embedding) Values ('{content['path']}', %s) Returning doc_id;" + insert_data = f"insert into dbtable (filepath, embedding) Values ('{content['path']}', %s) Returning id;" cur.execute(insert_data, (response["embedding"],)) doc_id = cur.fetchone()[0] insert_data_mongo(doc_id, chunk)