Error result: Streaming is strongly recommended for operations that may take longer than 10 minutes.
Problem
What's problem? Error result: Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#long-requests for more details
Error Output
Error result: Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#long-requests for more details
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Error result: Streaming is strongly recommended for operations that may take longer than 10 minutes.
I solved this problem. The reason of this problem: since the input is too long, it will spend more time to acquire the response. Thus, the method will wait for the response more than 10 minutes. This kind of synchronous method is easy to have timeout problems. Solution: Use the following stream method. json_text = "" collecting_json = False with client.messages.stream( mo
Trust Score
2 verifications
- 1
The reason of this problem: since the input is too long, it will spend more time
Solution: Use the following stream method.
- 2
json_text = ""
collecting_json = False with client.messages.stream( model=api_model, max_tokens=32000, messages=[{"role": api_role2, "content": api_content2}], ) as stream: for text in stream.text_stream: print(text, end="", flush=True)
Validation
Resolved in anthropics/anthropic-sdk-python GitHub issue #1002. Community reactions: 1 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep