Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
doc: docstring of get chat histroy method in chat bard
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed Jan 23, 2024
1 parent 02574f7 commit 391a8e3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bardapi/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,34 @@ def display_chat_history(self) -> None:
print(SEPARATOR_LINE)

def get_chat_history(self) -> list:
"""
Retrieve the chat history.
Usage:
chat = ChatBard()
chat.start()
history_list = chat.get_chat_history()
Returns:
list: A list of dictionaries containing chat history entries.
Each entry has two keys: 'User' and 'Chatbot'.
'User' contains the user input, and 'Chatbot' contains the chatbot's response.
Example:
chat = ChatBard()
chat.start()
history_list = chat.get_chat_history()
# Access individual chat history entries
for entry in history_list:
user_input = entry['User']
chatbot_response = entry['Chatbot']
print(f"User: {user_input}")
print(f"Chatbot: {chatbot_response}")
:return: List of chat history entries.
:rtype: list
"""
return self.chat_history

@staticmethod
Expand Down

0 comments on commit 391a8e3

Please sign in to comment.