# from redis import Redis
# from redisvl.extensions.session_manager import StandardSessionManager
# from ..config import Config

# REDIS_URL= Config.REDIS_URL

# class RedisSession:
#     def __init__(self, name: str = "default_session"):
#         """
#         Initialize a chat session manager with Redis connection.

#         Args:
#             name (str): Name of the session (used as Redis index prefix).
#             redis_url (str): Redis connection string. 
#                              If None, will use ENV['REDIS_URL'] or default.
#         """

#         # Create session manager bound to this client
#         self.session = StandardSessionManager(name=name, redis_url=REDIS_URL)

#     def add_message(self, role: str, content: str):
#         """Add a single message to the session."""
#         self.session.add_message({"role": role, "content": content})

#     def add_messages(self, messages: list):
#         """Add multiple messages at once."""
#         self.session.add_messages(messages)

#     def store(self, prompt: str, response: str):
#         """Convenience method to store a prompt-response pair."""
#         self.session.store(prompt, response)

#     def get_recent(self, top_k: int = 5, as_text: bool = False):
#         """Retrieve the most recent messages."""
#         return self.session.get_recent(top_k=top_k, as_text=as_text)

#     def clear(self):
#         """Clear the session history."""
#         self.session.clear()

#     def delete(self):
#         """Delete session history and index from Redis."""
#         self.session.delete()

#     def drop_last(self):
#         """Drop the most recent message."""
#         self.session.drop()


# # # ----------------- Example Usage -----------------
# # if __name__ == "__main__":
# #     chat = ChatSession(name="tutor_chat")

# #     chat.add_message("system", "You are a helpful tutor.")
# #     chat.store("What is the capital of France?", "The capital is Paris.")
# #     chat.add_message("user", "Thanks!")

# #     print("Recent History:")
# #     print(chat.get_recent(top_k=5, as_text=True))
