Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ chat_memory = None
|
|
| 20 |
query_memory = None
|
| 21 |
|
| 22 |
def initialize_components():
|
| 23 |
-
global llm, chat_memory, query_memory
|
| 24 |
load_dotenv()
|
| 25 |
|
| 26 |
OPENAI_API_KEY="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"
|
|
@@ -43,8 +43,21 @@ def initialize_components():
|
|
| 43 |
)
|
| 44 |
query_memory = SimpleMemory()
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# Initialize planning agent with both memories
|
| 47 |
-
planning_agent.initialize_planning_agent(llm, chat_memory, query_memory)
|
| 48 |
|
| 49 |
logger.info("Components initialized successfully")
|
| 50 |
|
|
|
|
| 20 |
query_memory = None
|
| 21 |
|
| 22 |
def initialize_components():
|
| 23 |
+
global llm, chat_memory, query_memory, clearml_callback
|
| 24 |
load_dotenv()
|
| 25 |
|
| 26 |
OPENAI_API_KEY="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"
|
|
|
|
| 43 |
)
|
| 44 |
query_memory = SimpleMemory()
|
| 45 |
|
| 46 |
+
# Setup and use the ClearML Callback
|
| 47 |
+
clearml_callback = ClearMLCallbackHandler(
|
| 48 |
+
task_type="inference",
|
| 49 |
+
project_name="langchain_callback_demo",
|
| 50 |
+
task_name="llm",
|
| 51 |
+
tags=["test"],
|
| 52 |
+
# Change the following parameters based on the amount of detail you want tracked
|
| 53 |
+
visualize=True,
|
| 54 |
+
complexity_metrics=True,
|
| 55 |
+
stream_logs=True,)
|
| 56 |
+
|
| 57 |
+
callbacks = [StdOutCallbackHandler(), clearml_callback]
|
| 58 |
+
|
| 59 |
# Initialize planning agent with both memories
|
| 60 |
+
planning_agent.initialize_planning_agent(llm, chat_memory, query_memory, callbacks)
|
| 61 |
|
| 62 |
logger.info("Components initialized successfully")
|
| 63 |
|