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

Function stream_error

examples/text_completions_streaming.py:43–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42
43def stream_error() -> None:
44 try:
45 client.completions.create(
46 prompt=f"{HUMAN_PROMPT} {question}{AI_PROMPT}",
47 model="claude-unknown-model",
48 stream=True,
49 max_tokens_to_sample=300,
50 )
51 except APIStatusError as err:
52 print(f"Caught API status error with response body: {err.response.text}")
53
54
55sync_stream()

Callers 1

Calls 1

createMethod · 0.45

Tested by

no test coverage detected