lülülülü
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user