-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Standard ChatGPT
def logger(is_timed)Logger decorator
class Error(Exception)Base class for exceptions in this module.
class Chatbot()Chatbot class for ChatGPT
@logger(is_timed=True)
def ask(prompt, conversation_id=None, parent_id=None, timeout=360)Ask a question to the chatbot
Arguments:
-
prompt: String -
conversation_id: UUID -
parent_id: UUID -
gen_title: Boolean
@logger(is_timed=True)
def get_conversations(offset=0, limit=20)Get conversations
Arguments:
-
offset: Integer -
limit: Integer
@logger(is_timed=True)
def get_msg_history(convo_id, encoding=None)Get message history
Arguments:
-
id: UUID of conversation -
encoding: String
@logger(is_timed=True)
def gen_title(convo_id, message_id)Generate title for conversation
@logger(is_timed=True)
def change_title(convo_id, title)Change title of conversation
Arguments:
-
id: UUID of conversation -
title: String
@logger(is_timed=True)
def delete_conversation(convo_id)Delete conversation
Arguments:
-
id: UUID of conversation
@logger(is_timed=True)
def clear_conversations()Delete all conversations
@logger(is_timed=False)
def reset_chat() -> NoneReset the conversation ID and parent ID.
Returns:
None
@logger
def rollback_conversation(num=1) -> NoneRollback the conversation.
Arguments:
-
num: The number of messages to rollback
Returns:
None
class AsyncChatbot(Chatbot)Async Chatbot class for ChatGPT
async def ask(prompt, conversation_id=None, parent_id=None, timeout=360)Ask a question to the chatbot
async def get_conversations(offset=0, limit=20)Get conversations
Arguments:
-
offset: Integer -
limit: Integer
async def get_msg_history(convo_id, encoding="utf-8")Get message history
Arguments:
-
id: UUID of conversation
async def gen_title(convo_id, message_id)Generate title for conversation
async def change_title(convo_id, title)Change title of conversation
Arguments:
-
convo_id: UUID of conversation -
title: String
async def delete_conversation(convo_id)Delete conversation
Arguments:
-
convo_id: UUID of conversation
async def clear_conversations()Delete all conversations
@logger(is_timed=False)
def get_input(prompt)Multiline input function.
@logger(is_timed=False)
def configure()Looks for a config file in the following locations:
@logger(is_timed=False)
async def main(config: dict)Main function for the chatGPT program.