Skip to content

Commit c545e43

Browse files
authored
Add discriminator (api_type) to AnyLLMConfig to improve integration with Pydantic Settings (#5)
1 parent 629b8a8 commit c545e43

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

any_llm_client/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import functools
22
import typing
33

4+
import pydantic
5+
46
from any_llm_client.clients.mock import MockLLMClient, MockLLMConfig
57
from any_llm_client.clients.openai import OpenAIClient, OpenAIConfig
68
from any_llm_client.clients.yandexgpt import YandexGPTClient, YandexGPTConfig
79
from any_llm_client.core import LLMClient
810
from any_llm_client.retry import RequestRetryConfig
911

1012

11-
AnyLLMConfig = YandexGPTConfig | OpenAIConfig | MockLLMConfig
13+
AnyLLMConfig = typing.Annotated[YandexGPTConfig | OpenAIConfig | MockLLMConfig, pydantic.Discriminator("api_type")]
1214

1315

1416
if typing.TYPE_CHECKING:

0 commit comments

Comments
 (0)