This commit is contained in:
narawat lamaiin
2025-07-14 19:33:12 +07:00
parent bad2ca35ed
commit 8a9c9606c7
3 changed files with 38 additions and 29 deletions
+16 -8
View File
@@ -1,6 +1,6 @@
module type
export agent, sommelier, companion, virtualcustomer
export agent, sommelier, companion, virtualcustomer, appcontext
using Dates, UUIDs, DataStructures, JSON3, NATS
using GeneralUtils
@@ -8,9 +8,17 @@ using GeneralUtils
# ---------------------------------------------- 100 --------------------------------------------- #
#[WORKING]
# struct appcontext
# connection::
# end
mutable struct appcontext
const connection::NATS.Connection
const text2textInstructLLMServiceSubject::String
getTextEmbedding::Function
text2textInstructLLM::Function
executeSQL::Function
similarSQLVectorDB::Function
insertSQLVectorDB::Function
similarSommelierDecision::Function
insertSommelierDecision::Function
end
abstract type agent end
@@ -27,7 +35,7 @@ mutable struct companion <: agent
end
function companion(
func::NamedTuple # NamedTuple of functions
context::appcontext # NamedTuple of functions
;
name::String= "Assistant",
id::String= GeneralUtils.uuid4snakecase(),
@@ -75,7 +83,7 @@ function companion(
maxHistoryMsg,
chathistory,
memory,
func,
context,
llmFormatName
)
@@ -165,7 +173,7 @@ mutable struct sommelier <: agent
end
function sommelier(
func, # NamedTuple of functions
context::appcontext, # NamedTuple of functions
;
name::String= "Assistant",
id::String= string(uuid4()),
@@ -216,7 +224,7 @@ function sommelier(
maxHistoryMsg,
chathistory,
memory,
func,
context,
llmFormatName
)