mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
17 lines
444 B
Python
17 lines
444 B
Python
|
from abc import ABC, abstractmethod
|
||
|
from typing import Iterator, List
|
||
|
|
||
|
from langchain_core.chat_sessions import ChatSession
|
||
|
|
||
|
|
||
|
class BaseChatLoader(ABC):
|
||
|
"""Base class for chat loaders."""
|
||
|
|
||
|
@abstractmethod
|
||
|
def lazy_load(self) -> Iterator[ChatSession]:
|
||
|
"""Lazy load the chat sessions."""
|
||
|
|
||
|
def load(self) -> List[ChatSession]:
|
||
|
"""Eagerly load the chat sessions into memory."""
|
||
|
return list(self.lazy_load())
|