From f43107aa764acb59dbbaad5d5ac6fb53f3990057 Mon Sep 17 00:00:00 2001 From: Raju Komati Date: Wed, 26 Apr 2023 23:50:18 +0530 Subject: refactored you code added error handling and updated regex for parsing response --- you/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'you/README.md') diff --git a/you/README.md b/you/README.md index 69da131a..dbce37a5 100644 --- a/you/README.md +++ b/you/README.md @@ -5,9 +5,9 @@ import you # simple request with links and details response = you.Completion.create( - prompt = "hello world", - detailed = True, - includelinks = True,) + prompt="hello world", + detailed=True, + include_links=True, ) print(response) @@ -19,18 +19,18 @@ print(response) # } # } -#chatbot +# chatbot chat = [] while True: prompt = input("You: ") - + response = you.Completion.create( - prompt = prompt, - chat = chat) - + prompt=prompt, + chat=chat) + print("Bot:", response["response"]) - + chat.append({"question": prompt, "answer": response["response"]}) ``` \ No newline at end of file -- cgit v1.2.3