This commit is contained in:
narawat lamaiin
2024-12-09 20:29:28 +07:00
parent 159d1717a4
commit d4895a728d
27 changed files with 7742 additions and 4002 deletions

View File

@@ -1,88 +1,88 @@
using Revise
using LibPQ, JSON3, PrettyPrinting, UUIDs, DataFrames, DataStructures, Dates, MQTTClient, Random
using SQLLLM, GeneralUtils
function executeSQL(sql)
DBconnection = LibPQ.Connection("host=192.168.88.12 port=5433 dbname=SQLVectorDB user=yiemtechnologies@gmail.com password=yiem@Postgres_0.0")
result = LibPQ.execute(DBconnection, sql)
close(DBconnection)
return result
end
sql =
"""
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
"""
result = executeSQL(sql)
sql =
"""
INSERT INTO items (embedding) VALUES ('[[1,2,3], [1,2,3], [1,2,3]]'), ('[4,5,6]');
"""
result = executeSQL(sql)
sql =
"""
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 1;
"""
result = executeSQL(sql)
df = DataFrame(result)
config = copy(JSON3.read("config.json"))
msgMeta = GeneralUtils.generate_msgMeta(
config[:externalservice][:text2textinstruct][:mqtttopic];
msgPurpose= "embedding",
senderName= "yiemagent",
senderId= string(uuid4()),
receiverName= "text2textinstruct",
mqttBrokerAddress= "mqtt.yiem.cc",
mqttBrokerPort= 1883,
)
text = ["hello world"]
outgoingMsg = Dict(
:msgMeta=> msgMeta,
:payload=> Dict(
:text=> text,
:kwargs=> Dict(
:max_tokens=> 2048,
:stop=> ["<|eot_id|>"],
:temperature=> 0.2,
)
)
)
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)
using Revise
using LibPQ, JSON3, PrettyPrinting, UUIDs, DataFrames, DataStructures, Dates, MQTTClient, Random
using SQLLLM, GeneralUtils
function executeSQL(sql)
DBconnection = LibPQ.Connection("host=192.168.88.12 port=5433 dbname=SQLVectorDB user=yiemtechnologies@gmail.com password=yiem@Postgres_0.0")
result = LibPQ.execute(DBconnection, sql)
close(DBconnection)
return result
end
sql =
"""
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
"""
result = executeSQL(sql)
sql =
"""
INSERT INTO items (embedding) VALUES ('[[1,2,3], [1,2,3], [1,2,3]]'), ('[4,5,6]');
"""
result = executeSQL(sql)
sql =
"""
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 1;
"""
result = executeSQL(sql)
df = DataFrame(result)
config = copy(JSON3.read("config.json"))
msgMeta = GeneralUtils.generate_msgMeta(
config[:externalservice][:text2textinstruct][:mqtttopic];
msgPurpose= "embedding",
senderName= "yiemagent",
senderId= string(uuid4()),
receiverName= "text2textinstruct",
mqttBrokerAddress= "mqtt.yiem.cc",
mqttBrokerPort= 1883,
)
text = ["hello world"]
outgoingMsg = Dict(
:msgMeta=> msgMeta,
:payload=> Dict(
:text=> text,
:kwargs=> Dict(
:max_tokens=> 2048,
:stop=> ["<|eot_id|>"],
:temperature=> 0.2,
)
)
)
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg; timeout=120)