make BaseEntityStore inherit from BaseModel (#5478)

# Make BaseEntityStore inherit from BaseModel

This enables initializing InMemoryEntityStore by optionally passing in a
value for the store field.

## Who can review?

It's a small change so I think any of the reviewers can review, but
tagging @dev2049 who seems most relevant since the change relates to
Memory.
This commit is contained in:
Aditi Viswanathan 2023-05-31 17:32:19 -07:00 committed by GitHub
parent 3bae595182
commit bc66b3fb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ from abc import ABC, abstractmethod
from itertools import islice from itertools import islice
from typing import Any, Dict, Iterable, List, Optional from typing import Any, Dict, Iterable, List, Optional
from pydantic import Field from pydantic import BaseModel, Field
from langchain.base_language import BaseLanguageModel from langchain.base_language import BaseLanguageModel
from langchain.chains.llm import LLMChain from langchain.chains.llm import LLMChain
@ -19,7 +19,7 @@ from langchain.schema import BaseMessage, get_buffer_string
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class BaseEntityStore(ABC): class BaseEntityStore(BaseModel, ABC):
@abstractmethod @abstractmethod
def get(self, key: str, default: Optional[str] = None) -> Optional[str]: def get(self, key: str, default: Optional[str] = None) -> Optional[str]:
"""Get entity value from store.""" """Get entity value from store."""