MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / run_turn

Function run_turn

tests/lib/threads/test_async_beta_threads.py:1852–1861  ·  view source on GitHub ↗

Call `send()`, `parse()` or `stream()`, and read a stream to its end.

(
    thread: BetaAsyncMessageThread[Any], method: str, *messages: BetaMessageParam, **overrides: Any
)

Source from the content-addressed store, hash-verified

1850
1851
1852async def run_turn(
1853 thread: BetaAsyncMessageThread[Any], method: str, *messages: BetaMessageParam, **overrides: Any
1854) -> None:
1855 """Call `send()`, `parse()` or `stream()`, and read a stream to its end."""
1856 turn = getattr(thread, method)(*messages, **overrides)
1857 if method == "stream":
1858 async with turn as stream:
1859 await stream.until_done()
1860 else:
1861 await turn

Calls 1

until_doneMethod · 0.45

Tested by

no test coverage detected