(*, index: object = 0)
| 586 | |
| 587 | |
| 588 | def stream_events(*, index: object = 0) -> list[dict[str, Any]]: |
| 589 | start: dict[str, Any] = { |
| 590 | **MESSAGE, |
| 591 | "content": [], |
| 592 | "stop_reason": None, |
| 593 | "usage": {**MESSAGE["usage"], "output_tokens": 0}, |
| 594 | } |
| 595 | return [ |
| 596 | {"type": "message_start", "message": start}, |
| 597 | {"type": "content_block_start", "index": index, "content_block": {"type": "text", "text": ""}}, |
| 598 | {"type": "content_block_delta", "index": index, "delta": {"type": "text_delta", "text": "Hi there"}}, |
| 599 | {"type": "content_block_stop", "index": index}, |
| 600 | {"type": "message_delta", "delta": {"stop_reason": "end_turn"}, "usage": {"output_tokens": 5}}, |
| 601 | {"type": "message_stop"}, |
| 602 | ] |
| 603 | |
| 604 | |
| 605 | def stream_response(events: Sequence[dict[str, Any]] | None = None) -> httpx2.Response: |
no outgoing calls
no test coverage detected