Spaces:
Sleeping
Sleeping
Update agent/planning_agent.py
Browse files- agent/planning_agent.py +4 -16
agent/planning_agent.py
CHANGED
|
@@ -25,26 +25,14 @@ chat_memory = None
|
|
| 25 |
query_memory = None
|
| 26 |
agent = None
|
| 27 |
|
| 28 |
-
def initialize_planning_agent(llm_instance, chat_memory_instance, query_memory_instance):
|
| 29 |
-
global llm, chat_memory, query_memory, agent
|
| 30 |
|
| 31 |
llm = llm_instance
|
| 32 |
chat_memory = chat_memory_instance
|
| 33 |
query_memory = query_memory_instance
|
| 34 |
-
|
| 35 |
-
# Setup and use the ClearML Callback
|
| 36 |
-
clearml_callback = ClearMLCallbackHandler(
|
| 37 |
-
task_type="inference",
|
| 38 |
-
project_name="langchain_callback_demo",
|
| 39 |
-
task_name="llm",
|
| 40 |
-
tags=["test"],
|
| 41 |
-
# Change the following parameters based on the amount of detail you want tracked
|
| 42 |
-
visualize=True,
|
| 43 |
-
complexity_metrics=True,
|
| 44 |
-
stream_logs=True,)
|
| 45 |
|
| 46 |
-
callbacks = [StdOutCallbackHandler(), clearml_callback]
|
| 47 |
-
|
| 48 |
# Initialize agents
|
| 49 |
router_agent.initialize_router_agent(llm, chat_memory)
|
| 50 |
product_review_agent.initialize_product_review_agent(llm, chat_memory)
|
|
@@ -119,7 +107,7 @@ def initialize_planning_agent(llm_instance, chat_memory_instance, query_memory_i
|
|
| 119 |
tools,
|
| 120 |
llm,
|
| 121 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 122 |
-
callbacks=
|
| 123 |
verbose=True,
|
| 124 |
memory=chat_memory,
|
| 125 |
system_message=system_prompt,
|
|
|
|
| 25 |
query_memory = None
|
| 26 |
agent = None
|
| 27 |
|
| 28 |
+
def initialize_planning_agent(llm_instance, chat_memory_instance, query_memory_instance, clearml_instance):
|
| 29 |
+
global llm, chat_memory, query_memory, agent, clearml_callback
|
| 30 |
|
| 31 |
llm = llm_instance
|
| 32 |
chat_memory = chat_memory_instance
|
| 33 |
query_memory = query_memory_instance
|
| 34 |
+
clearml_callback = clearml_instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
|
|
|
| 36 |
# Initialize agents
|
| 37 |
router_agent.initialize_router_agent(llm, chat_memory)
|
| 38 |
product_review_agent.initialize_product_review_agent(llm, chat_memory)
|
|
|
|
| 107 |
tools,
|
| 108 |
llm,
|
| 109 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 110 |
+
callbacks=clearml_callback,
|
| 111 |
verbose=True,
|
| 112 |
memory=chat_memory,
|
| 113 |
system_message=system_prompt,
|