Skip to content

Commit

Permalink
ensure callback manager is set on llms (#15598)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Aug 23, 2024
1 parent 35a86e5 commit cfb72ab
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions llama-index-core/llama_index/core/llms/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,9 @@ def wrap(f: Callable) -> Callable:
def wrapper_logic(_self: Any) -> Generator[CallbackManager, None, None]:
callback_manager = getattr(_self, "callback_manager", None)
if not isinstance(callback_manager, CallbackManager):
raise ValueError(
"Cannot use llm_completion_callback on an instance "
"without a callback_manager attribute."
)
_self.callback_manager = CallbackManager()

yield callback_manager
yield _self.callback_manager

def extract_prompt(*args: Any, **kwargs: Any) -> str:
if len(args) > 0:
Expand Down

0 comments on commit cfb72ab

Please sign in to comment.