|
|
@ -9,7 +9,6 @@ from time import time
|
|
|
|
from typing import TYPE_CHECKING, Any, DefaultDict, Dict, List, Optional, Union
|
|
|
|
from typing import TYPE_CHECKING, Any, DefaultDict, Dict, List, Optional, Union
|
|
|
|
|
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
import numpy as np
|
|
|
|
import pytz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from langchain.callbacks.base import BaseCallbackHandler
|
|
|
|
from langchain.callbacks.base import BaseCallbackHandler
|
|
|
|
from langchain.schema import AgentAction, AgentFinish, LLMResult
|
|
|
|
from langchain.schema import AgentAction, AgentFinish, LLMResult
|
|
|
@ -162,6 +161,12 @@ class ArthurCallbackHandler(BaseCallbackHandler):
|
|
|
|
|
|
|
|
|
|
|
|
def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:
|
|
|
|
def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:
|
|
|
|
"""On LLM end, send data to Arthur."""
|
|
|
|
"""On LLM end, send data to Arthur."""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
import pytz # type: ignore[import]
|
|
|
|
|
|
|
|
except ImportError as e:
|
|
|
|
|
|
|
|
raise ImportError(
|
|
|
|
|
|
|
|
"Could not import pytz. Please install it with 'pip install pytz'."
|
|
|
|
|
|
|
|
) from e
|
|
|
|
|
|
|
|
|
|
|
|
run_id = kwargs["run_id"]
|
|
|
|
run_id = kwargs["run_id"]
|
|
|
|
|
|
|
|
|
|
|
|