docs: Add docstrings for CassandraChatMessageHistory class and package namespace function. (#24222)

- Modified docstring for CassandraChatMessageHistory in
libs/community/langchain_community/chat_message_history/cassandra.py.

- Added docstring for _package_namespace function in
docs/api_reference/create_api_rst.py

---------

Co-authored-by: ashvin <ashvin.anilkumar@qburst.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: ccurme <chester.curme@gmail.com>
This commit is contained in:
Ashvin 2024-08-23 21:19:41 +05:30 committed by GitHub
parent 8788a34bfa
commit 2cd77a53a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -471,6 +471,14 @@ def _build_rst_file(package_name: str = "langchain") -> None:
def _package_namespace(package_name: str) -> str:
"""Returns the package name used.
Args:
package_name: Can be either "langchain" or "core" or "experimental".
Returns:
modified package_name: Can be either "langchain" or "langchain_{package_name}"
"""
return (
package_name
if package_name == "langchain"

View File

@ -31,6 +31,8 @@ def _rows_to_messages(rows: Iterable[RowType]) -> List[BaseMessage]:
class CassandraChatMessageHistory(BaseChatMessageHistory):
"""Chat message history that is backed by Cassandra."""
def __init__(
self,
session_id: str,
@ -41,7 +43,8 @@ class CassandraChatMessageHistory(BaseChatMessageHistory):
*,
setup_mode: SetupMode = SetupMode.SYNC,
) -> None:
"""Chat message history that stores history in Cassandra.
"""
Initialize a new instance of CassandraChatMessageHistory.
Args:
session_id: arbitrary key that is used to store the messages