Compare commits

..

22 Commits

Author SHA1 Message Date
ton 6e5809fc9b Merge pull request 'v0.4.3-fix_markdown_response' (#7) from v0.4.3-fix_markdown_response into v0.4.3
Reviewed-on: #7
2026-07-10 10:47:18 +00:00
ton 2b7c0041e5 up version 2026-07-10 17:46:55 +07:00
ton 9ff0b48eec update 2026-07-10 17:45:58 +07:00
ton afeb4c7aef Merge pull request 'v0.4.2' (#6) from v0.4.2 into main
Reviewed-on: #6
2026-07-09 13:20:36 +00:00
ton 2942a89730 Merge pull request 'v0.4.2-limit_consecutive_same_tool_use' (#5) from v0.4.2-limit_consecutive_same_tool_use into v0.4.2
Reviewed-on: #5
2026-07-09 13:20:21 +00:00
ton 6a66f58e63 update 2026-07-09 20:19:41 +07:00
ton 1d0353d793 update 2026-07-09 20:14:04 +07:00
ton 0f6aa7c79f update 2026-07-09 19:45:04 +07:00
ton 0320fd321f Merge pull request 'v0.4.1' (#4) from v0.4.1 into main
Reviewed-on: #4
2026-07-09 01:01:53 +00:00
ton c29dccf597 up version 2026-07-09 08:01:08 +07:00
ton 70cf04b0db Merge pull request 'v0.4.1-fix_agent_not_respond' (#3) from v0.4.1-fix_agent_not_respond into v0.4.1
Reviewed-on: #3
2026-07-09 00:58:33 +00:00
ton 4d57f0146b update 2026-07-09 07:56:33 +07:00
ton d33aa14dc8 use md system prompt 2026-07-07 07:54:24 +07:00
ton 0ed3edd48a update 2026-07-06 06:10:12 +07:00
ton fb91b51573 update 2026-07-05 20:48:24 +07:00
ton 0bbd227920 update 2026-07-04 17:37:43 +07:00
ton 3487770f77 update 2026-07-04 15:42:00 +07:00
ton 7d27f9e567 update 2026-07-04 13:43:44 +07:00
ton 511b4d682d update 2026-07-04 13:42:33 +07:00
ton 5ba91d8acc update compat 2026-07-04 13:41:00 +07:00
ton 709f7e7115 Merge pull request 'v0.4.0' (#2) from v0.4.0 into main
Reviewed-on: #2
2026-07-04 06:34:08 +00:00
ton 3529384cdb Merge pull request 'v0.4.0-fix_appcontext' (#1) from v0.4.0-fix_appcontext into v0.4.0
Reviewed-on: #1
2026-07-04 06:33:31 +00:00
6 changed files with 343 additions and 851 deletions
+8 -55
View File
@@ -2,7 +2,7 @@
julia_version = "1.12.6" julia_version = "1.12.6"
manifest_format = "2.0" manifest_format = "2.0"
project_hash = "5b5e1c071ff66b72aeed7d8a4316829e2407ae1a" project_hash = "a2c996ffe370e277cbff80af974d2701698f1b6c"
[[deps.Accessors]] [[deps.Accessors]]
deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"] deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"]
@@ -38,12 +38,6 @@ version = "1.1.3"
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.2" version = "1.1.2"
[[deps.Arrow]]
deps = ["ArrowTypes", "BitIntegers", "CodecLz4", "CodecZstd", "ConcurrentUtilities", "DataAPI", "Dates", "EnumX", "Mmap", "PooledArrays", "SentinelArrays", "StringViews", "Tables", "TimeZones", "TranscodingStreams", "UUIDs"]
git-tree-sha1 = "4a69a3eadc1f7da78d950d1ef270c3a62c1f7e01"
uuid = "69666777-d1a9-59fb-9406-91d4454c9d45"
version = "2.8.1"
[[deps.ArrowTypes]] [[deps.ArrowTypes]]
deps = ["Sockets", "UUIDs"] deps = ["Sockets", "UUIDs"]
git-tree-sha1 = "404265cd8128a2515a81d5eae16de90fdef05101" git-tree-sha1 = "404265cd8128a2515a81d5eae16de90fdef05101"
@@ -58,12 +52,6 @@ version = "1.11.0"
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0" version = "1.11.0"
[[deps.BitIntegers]]
deps = ["Random"]
git-tree-sha1 = "091d591a060e43df1dd35faab3ca284925c48e46"
uuid = "c3b6d118-76ef-56ca-8cc7-ebb389d030a1"
version = "0.3.7"
[[deps.BufferedStreams]] [[deps.BufferedStreams]]
git-tree-sha1 = "6863c5b7fc997eadcabdbaf6c5f201dc30032643" git-tree-sha1 = "6863c5b7fc997eadcabdbaf6c5f201dc30032643"
uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d" uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
@@ -96,24 +84,12 @@ git-tree-sha1 = "40956acdbef3d8c7cc38cba42b56034af8f8581a"
uuid = "6c391c72-fb7b-5838-ba82-7cfb1bcfecbf" uuid = "6c391c72-fb7b-5838-ba82-7cfb1bcfecbf"
version = "0.3.4" version = "0.3.4"
[[deps.CodecLz4]]
deps = ["Lz4_jll", "TranscodingStreams"]
git-tree-sha1 = "d58afcd2833601636b48ee8cbeb2edcb086522c2"
uuid = "5ba52731-8f18-5e0d-9241-30f10d1ec561"
version = "0.4.6"
[[deps.CodecZlib]] [[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"] deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "962834c22b66e32aa10f7611c08c8ca4e20749a9" git-tree-sha1 = "962834c22b66e32aa10f7611c08c8ca4e20749a9"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193" uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.8" version = "0.7.8"
[[deps.CodecZstd]]
deps = ["TranscodingStreams", "Zstd_jll"]
git-tree-sha1 = "da54a6cd93c54950c15adf1d336cfd7d71f51a56"
uuid = "6b39b394-51ab-5f42-8807-6242bab2b4c2"
version = "0.8.7"
[[deps.CommonSolve]] [[deps.CommonSolve]]
git-tree-sha1 = "99ee296f88c12485402e37c2fd025f95ae097637" git-tree-sha1 = "99ee296f88c12485402e37c2fd025f95ae097637"
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
@@ -148,12 +124,6 @@ weakdeps = ["InverseFunctions"]
[deps.CompositionsBase.extensions] [deps.CompositionsBase.extensions]
CompositionsBaseInverseFunctionsExt = "InverseFunctions" CompositionsBaseInverseFunctionsExt = "InverseFunctions"
[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "21d088c496ea22914fe80906eb5bce65755e5ec8"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.5.1"
[[deps.ConstructionBase]] [[deps.ConstructionBase]]
git-tree-sha1 = "b4b092499347b18a015186eae3042f72267106cb" git-tree-sha1 = "b4b092499347b18a015186eae3042f72267106cb"
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
@@ -436,7 +406,9 @@ version = "1.21.3+0"
[[deps.LLMMCTS]] [[deps.LLMMCTS]]
deps = ["GeneralUtils", "JSON", "PrettyPrinting"] deps = ["GeneralUtils", "JSON", "PrettyPrinting"]
path = "../LLMMCTS" git-tree-sha1 = "3dff98131dfa79be8c9bd84fc51cb0ba1832c472"
repo-rev = "main"
repo-url = "https://git.yiem.cc/ton/LLMMCTS"
uuid = "d76c5a4d-449e-4835-8cc4-dd86ec44f241" uuid = "d76c5a4d-449e-4835-8cc4-dd86ec44f241"
version = "0.1.5" version = "0.1.5"
@@ -522,12 +494,6 @@ git-tree-sha1 = "3733419e9a71156b389f3e331672d2e95436783f"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "3.6.2" version = "3.6.2"
[[deps.Lz4_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "191686b1ac1ea9c89fc52e996ad15d1d241d1e33"
uuid = "5ced341a-0733-55b8-9ab6-a4889d929147"
version = "1.10.1+0"
[[deps.MacroTools]] [[deps.MacroTools]]
git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522" git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
@@ -794,11 +760,11 @@ version = "0.7.0"
[[deps.SQLLLM]] [[deps.SQLLLM]]
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "FileIO", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "PrettyPrinting", "Random", "Revise", "StatsBase", "Tables", "URIs", "UUIDs"] deps = ["CSV", "DataFrames", "DataStructures", "Dates", "FileIO", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "PrettyPrinting", "Random", "Revise", "StatsBase", "Tables", "URIs", "UUIDs"]
git-tree-sha1 = "997602ed56a285ac29d74c91bb57bc5faeadfad6" git-tree-sha1 = "2807a768907f59308d8d71ece599037b0a66b0a5"
repo-rev = "main" repo-rev = "main"
repo-url = "https://git.yiem.cc/ton/SQLLLM" repo-url = "https://git.yiem.cc/ton/SQLLLM"
uuid = "2ebc79c7-cc10-4a3a-9665-d2e1d61e63d3" uuid = "2ebc79c7-cc10-4a3a-9665-d2e1d61e63d3"
version = "0.2.5" version = "0.2.7"
[[deps.SQLStrings]] [[deps.SQLStrings]]
git-tree-sha1 = "55de0530689832b1d3d43491ee6b67bd54d3323c" git-tree-sha1 = "55de0530689832b1d3d43491ee6b67bd54d3323c"
@@ -902,11 +868,6 @@ git-tree-sha1 = "d05693d339e37d6ab134c5ab53c29fce5ee5d7d5"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e" uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.4.4" version = "0.4.4"
[[deps.StringViews]]
git-tree-sha1 = "f2dcb92855b31ad92fe8f079d4f75ac57c93e4b8"
uuid = "354b36f9-a18e-4713-926e-db85100087ba"
version = "1.3.7"
[[deps.StructTypes]] [[deps.StructTypes]]
deps = ["Dates", "UUIDs"] deps = ["Dates", "UUIDs"]
git-tree-sha1 = "159331b30e94d7b11379037feeb9b690950cace8" git-tree-sha1 = "159331b30e94d7b11379037feeb9b690950cace8"
@@ -1022,10 +983,10 @@ uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60"
version = "1.6.1" version = "1.6.1"
[[deps.YiemAgent]] [[deps.YiemAgent]]
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "SQLLLM", "Serialization", "URIs", "UUIDs", "msghandler"] deps = ["CSV", "DataFrames", "DataStructures", "Dates", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "Serialization", "URIs", "UUIDs"]
path = "." path = "."
uuid = "e012c34b-7f78-48e0-971c-7abb83b6f0a2" uuid = "e012c34b-7f78-48e0-971c-7abb83b6f0a2"
version = "0.4.0" version = "0.4.2"
[[deps.Zlib_jll]] [[deps.Zlib_jll]]
deps = ["Libdl"] deps = ["Libdl"]
@@ -1049,14 +1010,6 @@ git-tree-sha1 = "011b0a7331b41c25524b64dc42afc9683ee89026"
uuid = "a9144af2-ca23-56d9-984f-0d03f7b5ccf8" uuid = "a9144af2-ca23-56d9-984f-0d03f7b5ccf8"
version = "1.0.21+0" version = "1.0.21+0"
[[deps.msghandler]]
deps = ["Arrow", "Base64", "DataFrames", "Dates", "GeneralUtils", "HTTP", "JSON", "NATS", "PrettyPrinting", "Revise", "UUIDs"]
git-tree-sha1 = "db16f76f72bd4fa2a87e34ef47bb787204e1f888"
repo-rev = "main"
repo-url = "https://git.yiem.cc/ton/msghandler"
uuid = "f2724d33-f338-4a57-b9f8-1be882570d10"
version = "0.5.7"
[[deps.nghttp2_jll]] [[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"] deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
+3 -4
View File
@@ -1,6 +1,6 @@
name = "YiemAgent" name = "YiemAgent"
uuid = "e012c34b-7f78-48e0-971c-7abb83b6f0a2" uuid = "e012c34b-7f78-48e0-971c-7abb83b6f0a2"
version = "0.4.0" version = "0.4.3"
authors = ["narawat lamaiin <narawat@outlook.com>"] authors = ["narawat lamaiin <narawat@outlook.com>"]
[deps] [deps]
@@ -21,7 +21,6 @@ SQLLLM = "2ebc79c7-cc10-4a3a-9665-d2e1d61e63d3"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
msghandler = "f2724d33-f338-4a57-b9f8-1be882570d10"
[compat] [compat]
CSV = "0.10.15" CSV = "0.10.15"
@@ -29,6 +28,6 @@ DataFrames = "1.7.0"
GeneralUtils = "0.4.9" GeneralUtils = "0.4.9"
HTTP = "2.4.0" HTTP = "2.4.0"
JSON = "1.6.1" JSON = "1.6.1"
LLMMCTS = "0.1.5"
NATS = "0.1.0" NATS = "0.1.0"
SQLLLM = "0.2.5" SQLLLM = "0.2.7"
msghandler = "0.5.6"
+8 -88
View File
@@ -1,93 +1,13 @@
using DataStructures
function dictify2(x; keytype::Type=Any, sort_order::Union{Nothing, Vector}=nothing)
# Dict-like objects
if x isa AbstractDict
out = OrderedDict{keytype, Any}()
# 1. Process and normalize all keys from the input dictionary
processed_dict = OrderedDict{keytype, Any}()
for (k, v) in x
if keytype === String
newk = string(k)
elseif keytype === Symbol
newk = Symbol(string(k))
else
newk = k
end
processed_dict[newk] = dictify(v; keytype=keytype, sort_order=sort_order)
end
# 2. If a sort order is specified, apply it
if !isnothing(sort_order)
# Normalize the sort_order elements to match the requested keytype
normalized_order = map(sort_order) do tk
if keytype === String
return string(tk)
elseif keytype === Symbol
return Symbol(string(tk))
else
return tk
end
end
# First, insert keys that match the requested order
for target_key in normalized_order
if haskey(processed_dict, target_key)
out[target_key] = processed_dict[target_key]
end
end
# Then, append any remaining keys that weren't in the sort_order
for (k, v) in processed_dict
if !haskey(out, k)
out[k] = v
end
end
else
# If no sort order is given, just use the processed dict
out = processed_dict
end
return out
# Arrays / vectors: map elements recursively
elseif x isa AbstractArray
return [dictify(element; keytype=keytype, sort_order=sort_order) for element in x]
# Everything else: return as-is
else
return x
end
end
function dict_to_string_html2(d::AbstractDict; indent_level=1, indent_str=" ")
lines = String[]
padding = indent_str ^ indent_level
# Sort keys for predictable, clean output
for k in keys(d)
v = d[k]
if v isa AbstractDict
# Open tag, recurse for children, then close tag
push!(lines, "$padding<$k>")
ind_level = indent_level + 1
push!(lines, dict_to_string_html(v; indent_level=ind_level, indent_str=indent_str))
push!(lines, "$padding</$k>")
else
# Leaf node: put key and value on a single line
push!(lines, "$padding<$k>$v</$k>")
end
end
return join(lines, "\n")
end
d = Dict(
"hello"=> 555,
"world"=> Dict(
"name"=> "ton"
)
)
x = 55
@info "YiemAgent think() 1 " d x @__LINE__
+274 -609
View File
File diff suppressed because it is too large Load Diff
+11 -54
View File
@@ -1,10 +1,10 @@
module llmfunction module llmfunction
export virtualWineUserChatbox, jsoncorrection, checkwine, # recommendbox, export virtualWineUserChatbox, jsoncorrection, checkwine!, # recommendbox,
virtualWineUserRecommendbox, userChatbox, userRecommendbox, extractWineAttributes_1, virtualWineUserRecommendbox, userChatbox, userRecommendbox, extractWineAttributes_1,
extractWineAttributes_2, paraphrase extractWineAttributes_2, paraphrase
using HTTP, JSON, URIs, Random, PrettyPrinting, UUIDs, Dates, DataFrames using HTTP, JSON, URIs, Random, PrettyPrinting, UUIDs, Dates, DataFrames, DataStructures
using GeneralUtils, SQLLLM using GeneralUtils, SQLLLM
using ..type, ..util using ..type, ..util
@@ -269,7 +269,7 @@ end
# Arguments # Arguments
- `a::T1` - `a::T1`
one of ChatAgent's agent. one of ChatAgent's agent.
- `input::T2` - `thoughtdict::AbstractDict`
# Return # Return
A JSON string of available wine A JSON string of available wine
@@ -281,53 +281,14 @@ julia> input = "{\"food\": \"pizza\", \"occasion\": \"anniversary\"}"
julia> result = checkinventory(agent, input) julia> result = checkinventory(agent, input)
"{"wine 1": {\"Winery\": \"Pichon Baron\", \"wine name\": \"Pauillac (Grand Cru Classé)\", \"grape variety\": \"Cabernet Sauvignon\", \"year\": 2010, \"price\": \"125 USD\", \"stock ID\": \"ar-17\"}, }" "{"wine 1": {\"Winery\": \"Pichon Baron\", \"wine name\": \"Pauillac (Grand Cru Classé)\", \"grape variety\": \"Cabernet Sauvignon\", \"year\": 2010, \"price\": \"125 USD\", \"stock ID\": \"ar-17\"}, }"
``` ```
""" """
function checkwine(a::T1, input::T2; maxattempt::Int=3 function checkwine!(a::T, thoughtdict::AbstractDict
) where {T1<:agent, T2<:AbstractString} )::NamedTuple{(:thoughtdict, :result_raw), Tuple{OrderedDict, Any}} where {T<:agent}
println("\ncheckinventory order: $input ", @__FILE__, ":", @__LINE__, " $(Dates.now())") println("\ncheckinventory order: $(thoughtdict["action_input"]) ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
wineattributes_1 = extractWineAttributes_1(a, input) wineattributes_1 = extractWineAttributes_1(a, thoughtdict["action_input"])
wineattributes_2 = extractWineAttributes_2(a, input) wineattributes_2 = extractWineAttributes_2(a, thoughtdict["action_input"])
# placeholder
# textresult = nothing
# rawresponse = nothing
# for i in 1:maxattempt
# #CHANGE if you want to add retailer name
# # _inventoryquery = "retailer name: $(a.retailername), $wineattributes_1, $wineattributes_2"
# _inventoryquery = "$wineattributes_1, $wineattributes_2"
# retrieve_attributes = ["winery", "wine_name", "wine_id", "vintage", "region", "country", "wine_type", "grape", "serving_temperature", "sweetness", "intensity", "tannin", "acidity", "tasting_notes", "price", "currency"]
# inventoryquery = "Retrieves $retrieve_attributes of wines that match the following criteria - {$_inventoryquery}"
# println("\ncheckinventory input: $inventoryquery ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
# # add suppport for similarSQLVectorDB
# textresult, result_raw = SQLLLM.query(
# inventoryquery,
# a.context.executeSQL,
# a.context.text2textInstructLLM;
# insertSQLVectorDB=a.context.insertSQLVectorDB,
# similarSQLVectorDB=a.context.similarSQLVectorDB,
# llmFormatName="qwen3")
# # check if all of retrieve_attributes appears in textresult
# isin = [occursin(x, textresult) for x in retrieve_attributes]
# # check if rawresponse type is DataFrame so that I can check for column
# if typeof(result_raw) == DataFrame &&
# !occursin("The resulting table has 0 row", textresult) &&
# !all(isin)
# errornote = "Not all of $retrieve_attributes appear in search result"
# println("\nERROR YiemAgent checkwine() $errornote ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
# continue
# else
# break
# end
# end
#CHANGE if you want to add retailer name
# _inventoryquery = "retailer name: $(a.retailername), $wineattributes_1, $wineattributes_2"
retrieve_attributes = ["winery", "wine_name", "wine_id", "vintage", "region", "country", "wine_type", "grape", "serving_temperature", "sweetness", "intensity", "tannin", "acidity", "tasting_notes", "price", "currency"] retrieve_attributes = ["winery", "wine_name", "wine_id", "vintage", "region", "country", "wine_type", "grape", "serving_temperature", "sweetness", "intensity", "tannin", "acidity", "tasting_notes", "price", "currency"]
_inventoryquery = "$wineattributes_1, $wineattributes_2" _inventoryquery = "$wineattributes_1, $wineattributes_2"
inventoryquery = "Retrieves $retrieve_attributes of wines that match the following criteria - {$_inventoryquery}" inventoryquery = "Retrieves $retrieve_attributes of wines that match the following criteria - {$_inventoryquery}"
@@ -340,15 +301,11 @@ function checkwine(a::T1, input::T2; maxattempt::Int=3
insertSQLVectorDB=a.context.insertSQLVectorDB, insertSQLVectorDB=a.context.insertSQLVectorDB,
similarSQLVectorDB=a.context.similarSQLVectorDB, similarSQLVectorDB=a.context.similarSQLVectorDB,
llmFormatName="qwen3") llmFormatName="qwen3")
# println("\n--- YiemAgent checkwine() ", @__FILE__, ":", @__LINE__, " $(Dates.now())") thoughtdict["action_result"] = textresult
# println(textresult)
# println(result_raw)
# println("---")
return (result_str=textresult, result_raw=result_raw, success=true, errormsg=nothing) return (thoughtdict=thoughtdict, result_raw=result_raw)
end end
""" """
# Arguments # Arguments
+39 -41
View File
@@ -223,10 +223,9 @@ function sommelier(
context, context,
llmFormatName llmFormatName
) )
systemmsg = systemmsg =
""" """
<store_policy> # store_policy
- Generally speaking, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory. - Generally speaking, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory.
- If you found wines in the store's database, they are in stock. - If you found wines in the store's database, they are in stock.
- You can only recommend wines that are currently in our inventory - You can only recommend wines that are currently in our inventory
@@ -238,8 +237,8 @@ function sommelier(
- Spicy foods should be paired only with light red wines. - Spicy foods should be paired only with light red wines.
- We do not sell organic, sustainable, gluten-free, and sulfite-free wine. Inform the user imediately if they are looking for these types of wines. Do not sell our wines as such. - We do not sell organic, sustainable, gluten-free, and sulfite-free wine. Inform the user imediately if they are looking for these types of wines. Do not sell our wines as such.
- Gift box, gift card, and custom messages are available. Inform the user to contact our sales team. - Gift box, gift card, and custom messages are available. Inform the user to contact our sales team.
</store_policy>
<store_guidelines> # store_guidelines
- Greeting the customer warmly by ask them how could you help. Do not ask any other questions during this greeting. - Greeting the customer warmly by ask them how could you help. Do not ask any other questions during this greeting.
- Customer may provide images for you to look up. - Customer may provide images for you to look up.
- Encourage the customer to explore different options and try new things. - Encourage the customer to explore different options and try new things.
@@ -247,47 +246,46 @@ function sommelier(
- Your store carries only wine. - Your store carries only wine.
- Vintage 0 means non-vintage. - Vintage 0 means non-vintage.
- Start searching the database as broadly as possible within the given information boundary to maximize the chances of finding. Avoid unnecessary parameters unless specified by the user. Refine the search subsequently. - Start searching the database as broadly as possible within the given information boundary to maximize the chances of finding. Avoid unnecessary parameters unless specified by the user. Refine the search subsequently.
</store_guidelines>
<situation> # situation
Your customer is coming into the store You are having conversation with a customer.
</situation>
<your role> # your role
Your name is $(newAgent.name). You are a helpful sommelier for website-based $(newAgent.retailername)'s wine store. You are working under your mentor supervision. Your name is $(newAgent.name). You are a helpful sommelier for website-based $(newAgent.retailername)'s wine store.
</your role>
<objective> # objective
1) Establish a connection with the customer by talking to them politely and showing your enthusiasm for their wine preferences. - Establish a connection with the customer by talking to them politely and showing your enthusiasm for their wine preferences.
2) Provide relevant information and guide them to select the best wines only from your store's inventory that align with their preferences. - Provide relevant information and guide them to select the best wines only from your store's inventory that align with their preferences.
</objective>
<your responsibility includes> # your responsibility includes
1) According to the store's policy and guidelines, make an informed decision about what you need to do to achieve the objective - According to the store's policy and guidelines, and make an informed decision about what available_actions you need to use to achieve the objective.
2) Keep the conversation with the customer going smoothly - Keep the conversation with the customer going smoothly
2) Obey your mentor's suggestions.
</your responsibility includes> # your responsibility does NOT includes
<your responsibility does NOT includes> - Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store.
1) Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store. - Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store.
2) Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store. - Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store.
3) Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store.
</your responsibility does NOT includes> # you should then respond to the user with interleaving plan, action_name, action_input
<you should then respond to the user with interleaving plan, action_name, action_input> 1) "plan", Based on the current situation, state a complete action plan to complete the task and rationale. Be specific.
1) plan: Based on the current situation, state a complete action plan to complete the task and rationale. Be specific. 2) "action_name", (Typically corresponds to the execution of the first step in your plan) Can be one of the available_actions name
2) action_name: (Typically corresponds to the execution of the first step in your plan) Can be one of the available_actions name 3) "action_input", The input to the action you are about to perform according to your plan.
3) action_input: The input to the action you are about to perform according to your plan.
After the action is executed you gets "action_result". It is the output from the action you selected. After the action is executed you gets "action_result". It is the output from the action you selected.
</you should then respond to the user with interleaving plan, action_name, action_input>
<you should only respond in JSON format as described below> # you should only respond in JSON format as described below (not Markdown format)
"plan": "...", "plan": "...",
"action_name": "...", "action_name": "...",
"action_input": "..." "action_input": "..."
</you should only respond in JSON format as described below>
<available_actions> # available actions
- CHAT_BOX which you can use to talk with the user. "CHAT_BOX", which you can use to talk with the user. The input is dialogue you want to chat with the user according to your plan.
- CHECK_WINE allows you to check information about wines you want in your inventory's database. The input is text that specify supported search criteria includeing: retailer_name, wine price, winery, name, vintage, region, country, type, grape varietal, tasting notes, occasion, food pairing, intensity, tannin, sweetness, and acidity. "CHECK_WINE", allows you to check information about wines you want in your inventory's database. The input is text that specify supported search criteria includeing: retailer_name, wine price, winery, name, vintage, region, country, type, grape varietal, tasting notes, occasion, food pairing, intensity, tannin, sweetness, and acidity.
Example query 1: "Dry, full-bodied red wine from 1) region: Burgundy, country: France or 2) region: Tuscany, country: Italy. Grape varietal: Merlot or Syrah. price 100 to 1000 USD." Example query 1: "Dry, full-bodied red wine from 1) region: Burgundy, country: France or 2) region: Tuscany, country: Italy. Grape varietal: Merlot or Syrah. price 100 to 1000 USD."
Example query 2: "Red or white wine, medium tannin, price under 700 USD" Example query 2: "Red or white wine, medium tannin, price under 700 USD"
Example query 3: "white wine, region: Tuscany or Bordeaux, country: Italy or France Example query 3: "white wine, region: Tuscany or Bordeaux, country: Italy or France
- PRESENT_WINE_GUIDELINE which you can use to check the store guidelines about how to present wines you have found to the user. The input is "nothing" keyword. The output is the guidelines that you can follow. "WINE_PRESENTATION_GUIDELINE", which you can use to check the store guidelines about how to present wines you have found to the user. The input is "nothing" keyword. The output is the guidelines that you can follow.
- END_CONVER_GUIDELINE which you can use to check the store guidelines about how to end the conversation with the user. The input is "nothing" keyword. The output is the guidelines that you can follow. "END_CONVER_GUIDELINE", which you can use to check the store guidelines about how to end the conversation with the user. The input is "nothing" keyword. The output is the guidelines that you can follow.
</available_actions>
""" """
system_msg = Dict( system_msg = Dict(