You can add this as a custom method on the SDK. Automatically though there should be a timeout on the API endpoints since Pinecone is a hosted service so they probably have a pretty standard timeout already set if the connection remains open too long.
Given that the service is hosted though your reads and upserts should be fairly quick. I have never had latency issues prior. However, if you want to run a timeout you can do this with a timeout for both python and JS.
Python:
r = requests.get("MYURL.com", timeout=10) # 10 seconds
Javascript:
const res = await fetch(url, { signal: AbortSignal.timeout(5000) }); // 5 second timeout
These are examples that would hit the URL endpoint directly, but you can do the same by forking the SDK and building your own or just wrapping the SDK method in a timeout and aborting if it goes over.