Update Record class in schema.py
This commit is contained in:
parent
87f3330ab5
commit
4bb6290f3c
1 changed files with 19 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from langchain_core.documents import Document
|
||||
from pydantic import BaseModel
|
||||
|
|
@ -38,6 +38,24 @@ class Record(BaseModel):
|
|||
"""
|
||||
return Document(page_content=self.text, metadata=self.data)
|
||||
|
||||
def __call__(self, *args: Any, **kwds: Any) -> Any:
|
||||
"""
|
||||
Returns the text of the record.
|
||||
|
||||
Returns:
|
||||
Any: The text of the record.
|
||||
"""
|
||||
return self.text
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""
|
||||
Returns the text of the record.
|
||||
|
||||
Returns:
|
||||
str: The text of the record.
|
||||
"""
|
||||
return self.text
|
||||
|
||||
|
||||
def docs_to_records(documents: list[Document]) -> list[Record]:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue