Daniel Marques commited on
Commit
a455f54
1 Parent(s): c2c3b67

fix: add callback

Browse files
Files changed (1) hide show
  1. main.py +3 -0
main.py CHANGED
@@ -55,14 +55,17 @@ class MyCustomSyncHandler(BaseCallbackHandler):
55
  self.redisClient.publish(f'{kwargs["tags"][0]}', self.message)
56
 
57
  def on_llm_end(self, response: LLMResult, **kwargs: Any) -> Any:
 
58
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
59
 
60
  def on_llm_error(
61
  self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
62
  ) -> Any:
 
63
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
64
 
65
  def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> Any:
 
66
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
67
 
68
  handleCallback = MyCustomSyncHandler(redisClient)
 
55
  self.redisClient.publish(f'{kwargs["tags"][0]}', self.message)
56
 
57
  def on_llm_end(self, response: LLMResult, **kwargs: Any) -> Any:
58
+ print("on_llm_end end")
59
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
60
 
61
  def on_llm_error(
62
  self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
63
  ) -> Any:
64
+ print("on_llm_error end")
65
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
66
 
67
  def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> Any:
68
+ print("on_chain_end end")
69
  self.redisClient.publish(f'{kwargs["tags"][0]}', 'end')
70
 
71
  handleCallback = MyCustomSyncHandler(redisClient)