AI / Apache Burr Interview questions
What is the purpose of the bind method on a Burr action?
.bind() lets you fix a value for one of an action’s extra parameters at construction time, similar to functools.partial but more explicit and readable:
@action(reads=["var_from_state"], writes=["var_to_update"]) def custom_action(state: State, increment_by: int) -> State: return state.update(var_to_update=state["var_from_state"] + increment_by) app = ApplicationBuilder().with_actions( custom_action=custom_action.bind(increment_by=2) )...
Once bound, that parameter is no longer treated as a runtime input the caller must supply. This is the natural home for things like a pre-configured API client or a fixed model name, while values that genuinely change per call (like user prompts) should stay unbound and be passed in via inputs.
More Related questions...