From 4bb6290f3c2c8d27f4dc15857048129407f7d2b7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 16:41:14 -0300 Subject: [PATCH] Update Record class in schema.py --- src/backend/langflow/schema.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/schema.py b/src/backend/langflow/schema.py index de1be7767..053caf3a3 100644 --- a/src/backend/langflow/schema.py +++ b/src/backend/langflow/schema.py @@ -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]: """