From 85a1961b640e552b3abebae2462a1b425cd87f4f Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Sat, 22 Apr 2023 14:08:19 +0100 Subject: sqlchat --- sqlchat/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 sqlchat/README.md (limited to 'sqlchat/README.md') diff --git a/sqlchat/README.md b/sqlchat/README.md new file mode 100644 index 00000000..89d38fae --- /dev/null +++ b/sqlchat/README.md @@ -0,0 +1,42 @@ +### Example: `sqlchat` (use like openai pypi package) + +```python +# Import sqlchat +import sqlchat + +# sqlchat.Completion.create +# sqlchat.StreamCompletion.create + +[...] + +``` + +#### Example Chatbot +```python +messages = [] + +while True: + user = input('you: ') + + sqlchat_cmpl = sqlchat.Completion.create( + prompt = user, + messages = messages + ) + + print('gpt:', sqlchat_cmpl.completion.choices[0].text) + + messages.extend([ + {'role': 'user', 'content': user }, + {'role': 'assistant', 'content': sqlchat_cmpl.completion.choices[0].text} + ]) +``` + +#### Streaming Response: + +```python +for response in sqlchat.StreamCompletion.create( + prompt = 'write python code to reverse a string', + messages = []): + + print(response.completion.choices[0].text) +``` -- cgit v1.2.3