AI / Apache Burr Interview questions
What is the difference between MapStates and MapActions in Burr’s parallelism API?
Both are higher-level parallelism helpers that expand into many sub-applications and then join the results, but they vary a different axis:
| Class | Varies | Typical use |
MapStates | Same action, many states, via .states() | One LLM, many prompts |
MapActions | Same state, many actions, via .actions() | Same prompt, many different LLMs |
class TestMultiplePrompts(MapStates): def action(self, state, inputs): return query_llm.with_name("query_llm") def states(self, state, context, inputs): for prompt in [...]: yield state.update(prompt=prompt) def reduce(self, state, states): return state.update(all_llm_outputs=[s["llm_output"] for s in states])
Both must implement .reads(), .writes(), and .reduce() in addition to their differing method (.states() vs .actions() plus its companion .state()/.action() for the fixed side).
More Related questions...