This commit is contained in:
2026-08-02 17:58:57 +07:00
parent 1cb9ca106b
commit d2081333f6
4 changed files with 1404 additions and 39 deletions
+1400
View File
File diff suppressed because it is too large Load Diff
View File
+1 -38
View File
@@ -1,52 +1,15 @@
module interface module interface
export addNewMessage, conversation, decisionMaker, reflector, generatechat, export prompt
generalconversation, detectWineryName, generateSituationReport
using JSON, DataStructures, Dates, UUIDs, HTTP, Random, PrettyPrinting, Serialization, using JSON, DataStructures, Dates, UUIDs, HTTP, Random, PrettyPrinting, Serialization,
DataFrames, Serde DataFrames, Serde
using GeneralUtils using GeneralUtils
using ..type, ..util, ..llmfunction using ..type, ..util, ..llmfunction
# ------------------------------------------------------------------------------------------------ #
# pythoncall setting #
# ------------------------------------------------------------------------------------------------ #
# Ref: https://github.com/JuliaPy/PythonCall.jl/issues/252
# by setting the following variables, PythonCall.jl will use:
# 1. system's python and packages installed by system (via apt install)
# or 2. conda python and packages installed by conda
# if these setting are not set (comment out), PythonCall will use its own python and packages that
# installed by CondaPkg.jl (from env_preparation.jl)
# ENV["JULIA_CONDAPKG_BACKEND"] = "Null" # set condapkg backend = none
# systemPython = split(read(`which python`, String), "\n")[1] # system's python path
# ENV["JULIA_PYTHONCALL_EXE"] = systemPython # find python location with $> which python ex. raw"/root/conda/bin/python"
# using PythonCall
# const py_agents = PythonCall.pynew()
# const py_llms = PythonCall.pynew()
# function __init__()
# # PythonCall.pycopy!(py_cv2, pyimport("cv2"))
# # equivalent to from urllib.request import urlopen in python
# PythonCall.pycopy!(py_agents, pyimport("langchain.agents"))
# PythonCall.pycopy!(py_llms, pyimport("langchain.llms"))
# end
# ---------------------------------------------- 100 --------------------------------------------- # # ---------------------------------------------- 100 --------------------------------------------- #
macro executeStringFunction(functionStr, args...)
# Parse the function string into an expression
func_expr = Meta.parse(functionStr)
# Create a new function with the parsed expression
function_to_call = eval(Expr(:function,
Expr(:call, func_expr, args...), func_expr.args[2:end]...))
# Call the newly created function with the provided arguments
function_to_call(args...)
end
""" Think and choose action """ Think and choose action
+3 -1
View File
@@ -166,7 +166,9 @@ end
# Agent struct # Agent struct
# ============================================================================ # ============================================================================
mutable struct yiemAgent # High-level agent wrapper abstract type agent end
mutable struct yiemAgent <: agent # High-level agent wrapper
_state::agentState # Current state (prompt, model, messages, tools, etc.) _state::agentState # Current state (prompt, model, messages, tools, etc.)
input_ch::Channel # user sends prompt message to agent. input_ch::Channel # user sends prompt message to agent.