AI / Apache Burr Interview questions
What is the difference between the intermediate yields and the final yield in a streaming action?
The generator in a function-based streaming action always yields a 2-tuple, but what the second element means changes on the very last yield:
| Yield | Tuple shape | State effect |
| Intermediate | ({'response': delta}, None) | None — no state update happens |
| Final | ({'response': full_response}, state.append(response=full_response)) | Real update, merged into application state |
for chunk in response: delta = chunk.choices[0].delta.content buffer.append(delta) yield {'response': delta}, None # intermediate full_response = ''.join(buffer) yield {'response': full_response}, state.append(response=full_response) # final
Because Burr can’t know in advance which yield is the last one, it treats every generator as intermediate-until-exhausted; the class-based API makes this explicit by separating stream_run (produces the sequence) from update (commits the final result to state).
More Related questions...