|
1 | 1 | # This file was auto-generated by Fern from our API Definition. |
2 | 2 |
|
| 3 | +from __future__ import annotations |
| 4 | + |
3 | 5 | import datetime as dt |
4 | 6 | import typing |
5 | 7 |
|
6 | 8 | from ....core.datetime_utils import serialize_datetime |
7 | 9 | from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 |
8 | 10 |
|
9 | 11 |
|
10 | | -class ChatMessage(pydantic_v1.BaseModel): |
| 12 | +class ChatMessage_Promptchatmessage(pydantic_v1.BaseModel): |
11 | 13 | role: str |
12 | 14 | content: str |
| 15 | + type: typing.Literal["promptchatmessage"] = "promptchatmessage" |
| 16 | + |
| 17 | + def json(self, **kwargs: typing.Any) -> str: |
| 18 | + kwargs_with_defaults: typing.Any = { |
| 19 | + "by_alias": True, |
| 20 | + "exclude_unset": True, |
| 21 | + **kwargs, |
| 22 | + } |
| 23 | + return super().json(**kwargs_with_defaults) |
| 24 | + |
| 25 | + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: |
| 26 | + kwargs_with_defaults_exclude_unset: typing.Any = { |
| 27 | + "by_alias": True, |
| 28 | + "exclude_unset": True, |
| 29 | + **kwargs, |
| 30 | + } |
| 31 | + kwargs_with_defaults_exclude_none: typing.Any = { |
| 32 | + "by_alias": True, |
| 33 | + "exclude_none": True, |
| 34 | + **kwargs, |
| 35 | + } |
| 36 | + |
| 37 | + return deep_union_pydantic_dicts( |
| 38 | + super().dict(**kwargs_with_defaults_exclude_unset), |
| 39 | + super().dict(**kwargs_with_defaults_exclude_none), |
| 40 | + ) |
| 41 | + |
| 42 | + class Config: |
| 43 | + frozen = True |
| 44 | + smart_union = True |
| 45 | + extra = pydantic_v1.Extra.allow |
| 46 | + json_encoders = {dt.datetime: serialize_datetime} |
| 47 | + |
| 48 | + |
| 49 | +class ChatMessage_Placeholder(pydantic_v1.BaseModel): |
| 50 | + name: str |
| 51 | + type: typing.Literal["placeholder"] = "placeholder" |
13 | 52 |
|
14 | 53 | def json(self, **kwargs: typing.Any) -> str: |
15 | 54 | kwargs_with_defaults: typing.Any = { |
@@ -41,3 +80,6 @@ class Config: |
41 | 80 | smart_union = True |
42 | 81 | extra = pydantic_v1.Extra.allow |
43 | 82 | json_encoders = {dt.datetime: serialize_datetime} |
| 83 | + |
| 84 | + |
| 85 | +ChatMessage = typing.Union[ChatMessage_Promptchatmessage, ChatMessage_Placeholder] |
0 commit comments