Delete Chat Using SDK
When to Delete a Chat Session?
There might be scenarios where you want to terminate a chat session within your application. Here are some examples:
- Ending a User Interaction: After a user has received a satisfactory response or the conversation has reached a natural conclusion, you can delete the chat to free up resources and maintain a clean chat history.
Utilizing delete_chat:
The delete_chat function allows you to gracefully terminate a chat session. Here's what you provide:
- chat_id (str): The unique identifier assigned to the chat session you want to delete. This ID is typically returned by the create_chat function when you initiate a chat.
Code Example:
import trorgenai
chat_to_delete_id = "chat_12345" # Replace with the actual chat ID
trorgenai.delete_chat(chat_to_delete_id)
This code snippet demonstrates deleting a chat session with the ID "chat_12345". Once deleted, the chat history and association with the LLM model are no longer accessible within your application.
Important Considerations:
-
Permanence: Deletion using delete_chat is permanent. The chat history, LLM responses, and any associations with the specific chat session are removed entirely.
-
Double-check the ID: Before deleting a chat, ensure you have the correct chat ID to avoid accidentally removing an important conversation.
By effectively utilizing delete_chat, you can manage your chat sessions within the LLM Application SDK, promoting efficient resource allocation and a clean chat history for your users.