Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Fixes some typos

Stefan Krawczyka7f5b38c82f6
diff --git a/burr/core/action.py b/burr/core/action.py
index 2477492f..194a3715 100644
--- a/burr/core/action.py
+++ b/burr/core/action.py
@@ -23,7 +23,7 @@ class Function(abc.ABC):
@abc.abstractmethod
def run(self, state: State, **run_kwargs) -> dict:
"""Runs the function on the given state and returns the result.
- The result is jsut a key/value dictionary.
+ The result is just a key/value dictionary.
:param state: State to run the function on
:param run_kwargs: Additional arguments to the function passed at runtime.
@@ -177,12 +177,12 @@ class Condition(Function):
# Compile the expression into a callable function
def condition_func(state: State) -> bool:
- __globals = state.get_all() # we can get all becuase externally we will subset
+ __globals = state.get_all() # we can get all because externally we will subset
return eval(compile(tree, "<string>", "eval"), {}, __globals)
return Condition(keys, condition_func, name=expr)
- def run(self, state: State, **kwargs) -> dict:
+ def run(self, state: State, **run_kwargs) -> dict:
return {Condition.KEY: self._resolver(state)}
@property
diff --git a/burr/core/application.py b/burr/core/application.py
index 3c879fc0..1787953d 100644
--- a/burr/core/application.py
+++ b/burr/core/application.py
@@ -768,7 +768,7 @@ class ApplicationBuilder:
"""Adds a lifecycle adapter to the application. This is a way to add hooks to the application so that
they are run at the appropriate times. You can use this to synchronize state out, log results, etc...
- :param adapter: Adapter to add
+ :param adapters: Adapter to add
:return: The application builder for future chaining.
"""
self.lifecycle_adapters.extend(adapters)
diff --git a/examples/multi-agent-collaboration/application.py b/examples/multi-agent-collaboration/application.py
index ec01b9c1..e48bfd37 100644
--- a/examples/multi-agent-collaboration/application.py
+++ b/examples/multi-agent-collaboration/application.py
@@ -156,9 +156,10 @@ def main():
)
.with_entrypoint("researcher")
.with_hooks(PrintStepHook())
+ .with_tracker("hamilton-multi-agent")
.build()
)
- app.run(until=["terminal"])
+ app.run(halt_after=["terminal"])
# return app
@@ -187,7 +188,7 @@ if __name__ == "__main__":
"system_message": "You should provide accurate data for the chart generator to use.",
"user_query": "Fetch the UK's GDP over the past 5 years,"
" then draw a line graph of it."
- " Once you code it up, finish.",
+ " Once you have written code for the graph, finish.",
},
)
import pprint
diff --git a/examples/multi-agent-collaboration/func_agent.py b/examples/multi-agent-collaboration/func_agent.py
index eb033f99..1a06a6df 100644
--- a/examples/multi-agent-collaboration/func_agent.py
+++ b/examples/multi-agent-collaboration/func_agent.py
@@ -208,11 +208,13 @@ def executed_tool_calls(
for tool_call in parsed_tool_calls:
tool_name = tool_call["function_name"]
tool_args = tool_call["function_args"]
+ tool_found = False
for tool in tools:
name = getattr(tool, "name", None)
if name is None:
name = tool.__name__
if name == tool_name:
+ tool_found = True
kwargs = json.loads(tool_args)
if hasattr(tool, "_run"):
result = tool._run(**kwargs)
@@ -229,6 +231,8 @@ def executed_tool_calls(
},
)
)
+ if not tool_found:
+ raise ValueError(f"Tool {tool_name} not found.")
# TODO: do we add a sentinel if no tool call was required.
return results
diff --git a/examples/multi-agent-collaboration/lcel_application.py b/examples/multi-agent-collaboration/lcel_application.py
index 53edfb72..91b5d1b5 100644
--- a/examples/multi-agent-collaboration/lcel_application.py
+++ b/examples/multi-agent-collaboration/lcel_application.py
@@ -180,7 +180,7 @@ def application():
app.visualize(
output_file_path="lcel-multi-agent", include_conditions=True, view=True, format="png"
)
- app.run(until=["terminal"])
+ app.run(halt_after=["terminal"])
if __name__ == "__main__":