add simple benchmark for init

This commit is contained in:
Chester Curme 2025-05-19 12:58:20 -04:00
parent 46c08d26c3
commit 0ba7d1f8d9

View File

@ -9,6 +9,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Type
from unittest import mock
import pytest
from pytest_benchmark.fixture import BenchmarkFixture
from langchain_core.language_models import BaseChatModel
from langchain_core.load import dumpd, load
from langchain_core.runnables import RunnableBinding
@ -850,3 +851,8 @@ class ChatModelUnitTests(ChatModelTests):
dumpd(model), valid_namespaces=model.get_lc_namespace()[:1]
).dict()
)
@pytest.mark.benchmark
def test_init_time(self, benchmark: BenchmarkFixture) -> None:
_ = benchmark(self.chat_model_class, **self.chat_model_params)