hellocomputer/test/test_prompts.py

16 lines
452 B
Python
Raw Normal View History

2024-07-17 09:04:08 +02:00
import pytest
from hellocomputer.models import Prompts
from langchain.prompts import PromptTemplate
@pytest.mark.asyncio
async def test_get_general_prompt():
general: str = await Prompts.general()
assert general.startswith("You're a helpful assistant")
@pytest.mark.asyncio
async def test_general_templated():
prompt = PromptTemplate.from_template(await Prompts.general())
assert "Do as I say" in prompt.format(query="Do as I say")