Query TextSynth API for completion. Retry with back-off until they respond.
(**kwargs)
| 23 | |
| 24 | |
| 25 | def textsynth_completion(**kwargs): |
| 26 | """Query TextSynth API for completion. |
| 27 | Retry with back-off until they respond. |
| 28 | """ |
| 29 | backoff_time = 3 |
| 30 | while True: |
| 31 | try: |
| 32 | return _requests.post(**kwargs) |
| 33 | except _requests.exceptions.RequestException: |
| 34 | import traceback |
| 35 | |
| 36 | traceback.print_exc() |
| 37 | time.sleep(backoff_time) |
| 38 | backoff_time *= 1.5 |
| 39 | |
| 40 | |
| 41 | class TextSynthLM(BaseLM): |
no outgoing calls
no test coverage detected