core[minor], community[patch], langchain[patch]: move BaseChatLoader to core (#19607)

Thank you for contributing to LangChain!

- [ ] **PR title**: "core: move BaseChatLoader and BaseToolkit from
community"


- [ ] **PR message**: move BaseChatLoader and BaseToolkit

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
Leonid Kuligin
2024-04-26 23:45:51 +02:00
committed by GitHub
parent d4befd0cfb
commit 893a924b90
44 changed files with 69 additions and 70 deletions

View File

@@ -0,0 +1,16 @@
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())