ref: Remove some get_event_loop calls (#4366)

Remove some get_event_loop calls
This commit is contained in:
Christophe Bornet 2024-11-02 23:04:16 +01:00 • committed by GitHub
commit 35e2487acb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 33 additions and 62 deletions

View file

@ -2,19 +2,9 @@ from langchain_core.prompts.chat import ChatPromptTemplate
from langflow.schema.message import Message
async def test_message_async_prompt_serialization():
template = "Hello, {name}!"
message = await Message.from_template_and_variables(template, name="Langflow")
assert message.text == "Hello, Langflow!"
prompt = message.load_lc_prompt()
assert isinstance(prompt, ChatPromptTemplate)
assert prompt.messages[0].content == "Hello, Langflow!"
def test_message_prompt_serialization():
template = "Hello, {name}!"
message = Message.sync_from_template_and_variables(template, name="Langflow")
message = Message.from_template_and_variables(template, name="Langflow")
assert message.text == "Hello, Langflow!"
prompt = message.load_lc_prompt()