📝 (model.py): import Message class from langflow.schema.message to fix the reference error
♻️ (utils.py): remove unnecessary whitespace to improve code readability
This commit is contained in:
parent
eabc363d7d
commit
44abbabb13
2 changed files with 3 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
|
|||
|
||||
from langflow.custom import Component
|
||||
from langflow.field_typing.prompt import Prompt
|
||||
from langflow.schema.message import Message
|
||||
|
||||
|
||||
class LCModelComponent(Component):
|
||||
|
|
@ -92,7 +93,7 @@ class LCModelComponent(Component):
|
|||
if system_message:
|
||||
messages.append(SystemMessage(content=system_message))
|
||||
if input_value:
|
||||
if isinstance(input_value, Prompt):
|
||||
if isinstance(input_value, Message):
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
if "prompt" in input_value:
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ def flatten_list(list_of_lists: list[Union[list, Any]]) -> list:
|
|||
def serialize_field(value):
|
||||
"""Unified serialization function for handling both BaseModel and Document types,
|
||||
including handling lists of these types."""
|
||||
|
||||
if isinstance(value, (list, tuple)):
|
||||
return [serialize_field(v) for v in value]
|
||||
elif isinstance(value, Document):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue