langchain/tests/unit_tests/callbacks
Alec Flett 6cdd4b5edc
only add handlers if they are new (#7504)
When using callbacks, there are times when callbacks can be added
redundantly: for instance sometimes you might need to create an llm with
specific callbacks, but then also create and agent that uses a chain
that has those callbacks already set. This means that "callbacks" might
get passed down again to the llm at predict() time, resulting in
duplicate calls to the `on_llm_start` callback.

For the sake of simplicity, I made it so that langchain never adds an
exact handler/callbacks object in `add_handler`, thus avoiding the
duplicate handler issue.

Tagging @hwchase17 for callback review

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-07-12 03:48:29 -04:00
..
tracers Make Ref Example Threadsafe (#7383) 2023-07-07 21:50:42 -07:00
__init__.py
fake_callback_handler.py only add handlers if they are new (#7504) 2023-07-12 03:48:29 -04:00
test_callback_manager.py only add handlers if they are new (#7504) 2023-07-12 03:48:29 -04:00
test_openai_info.py
test_schemas.py Use Run object from SDK (#6067) 2023-06-13 07:14:11 -07:00
test_streamlit_callback.py StreamlitCallbackHandler (#6315) 2023-06-22 13:14:28 -07:00