Created
November 20, 2023 13:32
-
-
Save neelabalan/572d11798e3fe87618a3b07dda8881bf to your computer and use it in GitHub Desktop.
Stitch the response (to be used with ollama)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def stitch_response(response: requests.Response) -> str: | |
if not response.status_code == 200: | |
return "" | |
actual_response = "" | |
for res_chunk in response.text.split("\n")[:-1]: | |
actual_response += json.loads(res_chunk)["response"] | |
return actual_response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment