diff --git a/README.md b/README.md index 26f4c352..6b65cda2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Langfun is *simple and elegant*: * An intuitive programming model, graspable in 5 minutes; * Plug-and-play into any Python codebase, making an immediate difference; * Comprehensive LLMs under a unified API: Gemini, GPT, Claude, Llama3, and more. -* Designed for agile developement: offering intellisense, easy debugging, with minimal overhead; +* Designed for agile development: offering intellisense, easy debugging, with minimal overhead; ## Hello, Langfun diff --git a/langfun/core/agentic/action.py b/langfun/core/agentic/action.py index 80419275..0b52b076 100644 --- a/langfun/core/agentic/action.py +++ b/langfun/core/agentic/action.py @@ -780,10 +780,11 @@ def append(self, item: TracedItem) -> None: def remove(self, item: TracedItem) -> None: """Removes an item from the sequence.""" - index = self.items.index(item) - if index == -1: - raise ValueError(f'Item not found in execution trace: {item!r}') - + try: + index = self.items.index(item) + except ValueError as exc: + raise ValueError(f'Item not found in execution trace: {item!r}') from exc + with pg.notify_on_change(False): self.items.pop(index)