mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 14:18:52 +00:00
In ProgressBarCallback update the progress counter also when runs fin… (#11332)
This commit is contained in:
parent
06f39be1c2
commit
b0097f8908
@ -37,6 +37,17 @@ class ProgressBarCallback(base_callbacks.BaseCallbackHandler):
|
|||||||
spaces = " " * (self.ncols - len(arrow))
|
spaces = " " * (self.ncols - len(arrow))
|
||||||
print(f"\r[{arrow + spaces}] {self.counter}/{self.total}", end="")
|
print(f"\r[{arrow + spaces}] {self.counter}/{self.total}", end="")
|
||||||
|
|
||||||
|
def on_chain_error(
|
||||||
|
self,
|
||||||
|
error: BaseException,
|
||||||
|
*,
|
||||||
|
run_id: UUID,
|
||||||
|
parent_run_id: Optional[UUID] = None,
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> Any:
|
||||||
|
if parent_run_id is None:
|
||||||
|
self.increment()
|
||||||
|
|
||||||
def on_chain_end(
|
def on_chain_end(
|
||||||
self,
|
self,
|
||||||
outputs: Dict[str, Any],
|
outputs: Dict[str, Any],
|
||||||
@ -48,6 +59,17 @@ class ProgressBarCallback(base_callbacks.BaseCallbackHandler):
|
|||||||
if parent_run_id is None:
|
if parent_run_id is None:
|
||||||
self.increment()
|
self.increment()
|
||||||
|
|
||||||
|
def on_retriever_error(
|
||||||
|
self,
|
||||||
|
error: BaseException,
|
||||||
|
*,
|
||||||
|
run_id: UUID,
|
||||||
|
parent_run_id: Optional[UUID] = None,
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> Any:
|
||||||
|
if parent_run_id is None:
|
||||||
|
self.increment()
|
||||||
|
|
||||||
def on_retriever_end(
|
def on_retriever_end(
|
||||||
self,
|
self,
|
||||||
documents: Sequence[Document],
|
documents: Sequence[Document],
|
||||||
@ -59,6 +81,17 @@ class ProgressBarCallback(base_callbacks.BaseCallbackHandler):
|
|||||||
if parent_run_id is None:
|
if parent_run_id is None:
|
||||||
self.increment()
|
self.increment()
|
||||||
|
|
||||||
|
def on_llm_error(
|
||||||
|
self,
|
||||||
|
error: BaseException,
|
||||||
|
*,
|
||||||
|
run_id: UUID,
|
||||||
|
parent_run_id: Optional[UUID] = None,
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> Any:
|
||||||
|
if parent_run_id is None:
|
||||||
|
self.increment()
|
||||||
|
|
||||||
def on_llm_end(
|
def on_llm_end(
|
||||||
self,
|
self,
|
||||||
response: LLMResult,
|
response: LLMResult,
|
||||||
@ -70,6 +103,17 @@ class ProgressBarCallback(base_callbacks.BaseCallbackHandler):
|
|||||||
if parent_run_id is None:
|
if parent_run_id is None:
|
||||||
self.increment()
|
self.increment()
|
||||||
|
|
||||||
|
def on_tool_error(
|
||||||
|
self,
|
||||||
|
error: BaseException,
|
||||||
|
*,
|
||||||
|
run_id: UUID,
|
||||||
|
parent_run_id: Optional[UUID] = None,
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> Any:
|
||||||
|
if parent_run_id is None:
|
||||||
|
self.increment()
|
||||||
|
|
||||||
def on_tool_end(
|
def on_tool_end(
|
||||||
self,
|
self,
|
||||||
output: str,
|
output: str,
|
||||||
|
Loading…
Reference in New Issue
Block a user