mirror of
https://github.com/ggozad/oterm.git
synced 2026-10-23 07:31:26 +02:00
20 lines
583 B
Python
20 lines
583 B
Python
from datetime import datetime
|
|
|
|
import pytest
|
|
|
|
from oterm.ollamaclient import OllamaLLM
|
|
from oterm.tools.date_time import DateTimeTool, date_time
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_date_time(default_model):
|
|
llm = OllamaLLM(
|
|
model=default_model, tool_defs=[{"tool": DateTimeTool, "callable": date_time}]
|
|
)
|
|
res = ""
|
|
async for _, text in llm.stream(
|
|
"What is the time in 24h format? Use the date_time tool to answer this question."
|
|
):
|
|
res = text
|
|
time = datetime.time(datetime.now())
|
|
assert f"{time.hour:02}:{time.minute:02}" in res
|