polished
This commit is contained in:
parent
d4dea3bc0a
commit
51f4a8c9d0
@ -2,8 +2,8 @@ import lancedb
|
|||||||
import config, embedding
|
import config, embedding
|
||||||
db = lancedb.connect(config.memories_db_path)
|
db = lancedb.connect(config.memories_db_path)
|
||||||
table = db.open_table(config.memories_table)
|
table = db.open_table(config.memories_table)
|
||||||
question = "Email group Microsoft tidak muncul, apakah masuk spam?"
|
question = "cara mengecek spam di outlook"
|
||||||
query_vector = embedding.embed_text(question)
|
query_vector = embedding.embed_text(config.model_url, config.model_name, question)
|
||||||
results = (
|
results = (
|
||||||
table.search(query_vector, vector_column_name="vector_title")
|
table.search(query_vector, vector_column_name="vector_title")
|
||||||
.limit(3)
|
.limit(3)
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
|
requests
|
||||||
lancedb
|
lancedb
|
||||||
pyarrow
|
pyarrow
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import lancedb
|
import lancedb
|
||||||
import embedding
|
import config, embedding
|
||||||
db = lancedb.connect(config.memories_db_path)
|
db = lancedb.connect(config.memories_db_path)
|
||||||
table = db.open_table(config.memories_table)
|
table = db.open_table(config.memories_table)
|
||||||
docs = [
|
docs = [
|
||||||
@ -34,7 +34,7 @@ for doc in docs:
|
|||||||
"id" : doc["id" ],
|
"id" : doc["id" ],
|
||||||
"title" : doc["title" ],
|
"title" : doc["title" ],
|
||||||
"story" : doc["story" ],
|
"story" : doc["story" ],
|
||||||
"vector_title" : embedding.embed_text(doc["title"]),
|
"vector_title" : embedding.embed_text(config.model_url, config.model_name, doc["title"]),
|
||||||
}
|
}
|
||||||
table.add([row])
|
table.add([row])
|
||||||
print(f"Menambahkan record: {doc['title']}")
|
print(f"Menambahkan record: {doc['title']}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user