From 3acf46964bf2628d41341d2cd77e6ed468292325 Mon Sep 17 00:00:00 2001 From: narawat Date: Wed, 15 Jul 2026 14:25:04 +0700 Subject: [PATCH 1/2] update --- src/llmfunction.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llmfunction.jl b/src/llmfunction.jl index 9a2dad4..f9f7adf 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -530,7 +530,8 @@ function generatesql(a::T, searchterm::String, related_tables = a.context.find_related_tables_for_user_question(searchterm) table_schema = "" for table in related_tables - table_schema_df = GeneralUtils.get_db_table_schema(a.context.pg_conn_str, table) + _table_schema_df = GeneralUtils.get_db_table_schema(a.context.pg_conn_str, table) + table_schema_df = _table_schema_df[:, [:column_name, :data_type, :constraint_type]] table_schema_str = sprint(show, table_schema_df) * "\n" table_schema = table_schema * table_schema_str end From 686b9b2e92ac50cd543e476d0bd8a73c3479b4e7 Mon Sep 17 00:00:00 2001 From: narawat Date: Wed, 15 Jul 2026 18:47:18 +0700 Subject: [PATCH 2/2] update --- Manifest.toml | 10 +++++----- Project.toml | 2 +- etc.jl | 41 ++++++++++++++++++++++++++++------------- src/interface.jl | 13 ------------- src/llmfunction.jl | 9 ++++----- src/type.jl | 2 +- 6 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index f400337..8bc7203 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.12.6" manifest_format = "2.0" -project_hash = "76bd6c852fad3452022f32202b19c4689be8e912" +project_hash = "a5128932115e2d3aa9658af105ac712db061d523" [[deps.Accessors]] deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"] @@ -290,11 +290,11 @@ version = "1.1.0" [[deps.GeneralUtils]] deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "Graphs", "HTTP", "JSON", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "SHA", "StringDistances", "UUIDs"] -git-tree-sha1 = "aa695d21f155567524e7329fb7b96d8a9d0eba86" +git-tree-sha1 = "a75a088ee8e5faf10f554ca00748e0e6ca58d1ca" repo-rev = "main" repo-url = "https://git.yiem.cc/ton/GeneralUtils" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" -version = "0.5.0" +version = "0.5.1" [[deps.Graphs]] deps = ["ArnoldiMethod", "DataStructures", "Inflate", "LinearAlgebra", "Random", "SimpleTraits", "SparseArrays", "Statistics"] @@ -1047,10 +1047,10 @@ uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60" version = "1.6.1" [[deps.YiemAgent]] -deps = ["CSV", "DataFrames", "DataStructures", "Dates", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "Serialization", "URIs", "UUIDs"] +deps = ["CSV", "DataFrames", "DataStructures", "Dates", "HTTP", "JSON", "LLMMCTS", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "SQLLLM", "Serialization", "URIs", "UUIDs"] path = "." uuid = "e012c34b-7f78-48e0-971c-7abb83b6f0a2" -version = "0.5.0" +version = "0.6.4" [[deps.Zlib_jll]] deps = ["Libdl"] diff --git a/Project.toml b/Project.toml index 7bd54a4..ccb543e 100644 --- a/Project.toml +++ b/Project.toml @@ -25,7 +25,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] CSV = "0.10.15" DataFrames = "1.7.0" -GeneralUtils = "0.5.0" +GeneralUtils = "0.5.1" HTTP = "2.4.0" JSON = "1.6.1" LLMMCTS = "0.1.5" diff --git a/etc.jl b/etc.jl index c904b6d..4b46fd2 100644 --- a/etc.jl +++ b/etc.jl @@ -1,13 +1,28 @@ - - - -d = Dict( - "hello"=> 555, - "world"=> Dict( - "name"=> "ton" - ) -) - -x = 55 - -@info "YiemAgent think() 1 " d x @__LINE__ \ No newline at end of file +""" +CREATE TABLE "public"."wine" ( + "wine_id" uuid DEFAULT gen_random_uuid() NOT NULL, + "seo_name" character varying(128) NOT NULL, + "wine_name" character varying(128) NOT NULL, + "winery" character varying(128) NOT NULL, + "vintage" integer NOT NULL, + "region" character varying(128) NOT NULL, + "country" character varying(128) NOT NULL, + "wine_type" character varying(128) NOT NULL, + "grape" character varying(128) NOT NULL, + "serving_temperature" character varying(128) NOT NULL, + "intensity" integer NULL, + "sweetness" integer NULL, + "tannin" integer NULL, + "acidity" integer NULL, + "fizziness" integer NULL, + "tasting_notes" text NULL, + "image_url" jsonb NULL, + "manufacturer_sku" text NULL, + "note" text NULL, + "other_attributes" jsonb NULL, + "created_time" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NULL, + "updated_time" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NULL, + "description" text NULL, + PRIMARY KEY (wine_id) +); +""" \ No newline at end of file diff --git a/src/interface.jl b/src/interface.jl index a11cf0e..6754183 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -154,19 +154,6 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 println("\nERROR YiemAgent decisionMaker() failed to parse response: $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())") continue end - - # fall back to normal text because LLM default to natural chat when it didn't use action_call - else - try - responsedict = OrderedDict( - "plan"=> "I will talk to the user", - "action_name"=> "CHAT_BOX", - "action_input"=> response[2:end-1] # remove { } at the front and back that added by clean_json_response - ) - catch e - println("\nERROR YiemAgent decisionMaker(). $e --(not qualify response)-> $response", @__FILE__, ":", @__LINE__, " $(Dates.now())\n") - continue - end end # check whether all answer's key points are in responsedict diff --git a/src/llmfunction.jl b/src/llmfunction.jl index f9f7adf..116e764 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -530,9 +530,8 @@ function generatesql(a::T, searchterm::String, related_tables = a.context.find_related_tables_for_user_question(searchterm) table_schema = "" for table in related_tables - _table_schema_df = GeneralUtils.get_db_table_schema(a.context.pg_conn_str, table) - table_schema_df = _table_schema_df[:, [:column_name, :data_type, :constraint_type]] - table_schema_str = sprint(show, table_schema_df) * "\n" + _table_schema_str = GeneralUtils.get_db_table_schema_simple(a.context.pg_conn_str, table) + table_schema_str = sprint(show, _table_schema_str) * "\n" table_schema = table_schema * table_schema_str end @@ -756,11 +755,11 @@ function extractWineAttributes_1(a::T1, input::T2; maxattempt=10 "wine_name": "Saumur Blanc", "winery": "Domaine du Collier", "vintage": "2019", - "region": "Saumur", + "region": "N/A", "country": "France", "wine_type": "white", "grape_varietal": "Merlot", - "tasting_notes": "plum", + "tasting_notes": "N/A", "wine_price_min": "N/A", "wine_price_max": "N/A", "occasion": "N/A", diff --git a/src/type.jl b/src/type.jl index f97f99c..f654302 100644 --- a/src/type.jl +++ b/src/type.jl @@ -306,7 +306,7 @@ function sommelier( end -mutable struct virtualcustomer <: agent +mutable f virtualcustomer <: agent name::String # agent name id::String # agent id systemmsg::String # system message