The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain[patch]: smith.evaluation.progress.ProgressBarCallback: Make output after progress bar ends configurable (#31583)
dennism-tulcolabs9de4f2220509
diff --git a/libs/langchain/langchain/smith/evaluation/progress.py b/libs/langchain/langchain/smith/evaluation/progress.pyindex af94ebb511..4c1d110166 100644--- a/libs/langchain/langchain/smith/evaluation/progress.py+++ b/libs/langchain/langchain/smith/evaluation/progress.py@@ -13,15 +13,19 @@ from langchain_core.outputs import LLMResultclass ProgressBarCallback(base_callbacks.BaseCallbackHandler):"""A simple progress bar for the console."""- def __init__(self, total: int, ncols: int = 50, **kwargs: Any):+ def __init__(+ self, total: int, ncols: int = 50, end_with: str = "\n", **kwargs: Any+ ):"""Initialize the progress bar.Args:total: int, the total number of items to be processed.ncols: int, the character width of the progress bar.+ end_with: str, last string to print after progress bar reaches end."""self.total = totalself.ncols = ncols+ self.end_with = end_withself.counter = 0self.lock = threading.Lock()self._print_bar()@@ -37,7 +41,8 @@ class ProgressBarCallback(base_callbacks.BaseCallbackHandler):progress = self.counter / self.totalarrow = "-" * int(round(progress * self.ncols) - 1) + ">"spaces = " " * (self.ncols - len(arrow))- print(f"\r[{arrow + spaces}] {self.counter}/{self.total}", end="") # noqa: T201+ end = "" if self.counter < self.total else self.end_with+ print(f"\r[{arrow + spaces}] {self.counter}/{self.total}", end=end) # noqa: T201def on_chain_error(self,