fix: Add type checking import
This commit is contained in:
parent
83b859152f
commit
d8d20d7aa5
1 changed files with 5 additions and 4 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from typing import Annotated, Any, AsyncIterator, Iterator, Optional
|
from typing import TYPE_CHECKING, Annotated, Any, AsyncIterator, Iterator, Optional
|
||||||
|
|
||||||
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
|
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
|
||||||
from langchain_core.prompt_values import ImagePromptValue
|
from langchain_core.prompt_values import ImagePromptValue
|
||||||
from langchain_core.prompts.image import ImagePromptTemplate
|
from langchain_core.prompts.image import ImagePromptTemplate
|
||||||
|
from langflow.schema.image import Image, get_file_paths, is_image_file
|
||||||
from pydantic import BaseModel, BeforeValidator, ConfigDict, Field, field_serializer
|
from pydantic import BaseModel, BeforeValidator, ConfigDict, Field, field_serializer
|
||||||
|
|
||||||
from langflow.schema.image import Image, get_file_paths, is_image_file
|
if TYPE_CHECKING:
|
||||||
from langflow.schema.record import Record
|
from langflow.schema.record import Record
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,7 +69,7 @@ class Message(BaseModel):
|
||||||
return AIMessage(content=self.text)
|
return AIMessage(content=self.text)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_record(cls, record: Record) -> "Message":
|
def from_record(cls, record: "Record") -> "Message":
|
||||||
"""
|
"""
|
||||||
Converts a BaseMessage to a Record.
|
Converts a BaseMessage to a Record.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue