Skip to content

Commit 457f985

Browse files
committed
init commit placeholder messages
1 parent 60d8499 commit 457f985

9 files changed

Lines changed: 172 additions & 11 deletions

File tree

langfuse/api/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
CategoricalScore,
2222
CategoricalScoreV1,
2323
ChatMessage,
24+
ChatMessage_Placeholder,
25+
ChatMessage_Promptchatmessage,
2426
ChatPrompt,
2527
Comment,
2628
CommentObjectType,
@@ -126,10 +128,12 @@
126128
PaginatedModels,
127129
PaginatedSessions,
128130
PatchMediaBody,
131+
PlaceholderMessage,
129132
Project,
130133
ProjectDeletionResponse,
131134
Projects,
132135
Prompt,
136+
PromptChatMessage,
133137
PromptMeta,
134138
PromptMetaListResponse,
135139
Prompt_Chat,
@@ -230,6 +234,8 @@
230234
"CategoricalScore",
231235
"CategoricalScoreV1",
232236
"ChatMessage",
237+
"ChatMessage_Placeholder",
238+
"ChatMessage_Promptchatmessage",
233239
"ChatPrompt",
234240
"Comment",
235241
"CommentObjectType",
@@ -335,10 +341,12 @@
335341
"PaginatedModels",
336342
"PaginatedSessions",
337343
"PatchMediaBody",
344+
"PlaceholderMessage",
338345
"Project",
339346
"ProjectDeletionResponse",
340347
"Projects",
341348
"Prompt",
349+
"PromptChatMessage",
342350
"PromptMeta",
343351
"PromptMetaListResponse",
344352
"Prompt_Chat",

langfuse/api/reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4290,7 +4290,7 @@ Create a new version for the prompt with the given `name`
42904290
<dd>
42914291

42924292
```python
4293-
from langfuse import ChatMessage, CreatePromptRequest_Chat
4293+
from langfuse import ChatMessage_Promptchatmessage, CreatePromptRequest_Chat
42944294
from langfuse.client import FernLangfuse
42954295

42964296
client = FernLangfuse(
@@ -4305,11 +4305,11 @@ client.prompts.create(
43054305
request=CreatePromptRequest_Chat(
43064306
name="name",
43074307
prompt=[
4308-
ChatMessage(
4308+
ChatMessage_Promptchatmessage(
43094309
role="role",
43104310
content="content",
43114311
),
4312-
ChatMessage(
4312+
ChatMessage_Promptchatmessage(
43134313
role="role",
43144314
content="content",
43154315
),

langfuse/api/resources/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,17 @@
173173
from .prompts import (
174174
BasePrompt,
175175
ChatMessage,
176+
ChatMessage_Placeholder,
177+
ChatMessage_Promptchatmessage,
176178
ChatPrompt,
177179
CreateChatPromptRequest,
178180
CreatePromptRequest,
179181
CreatePromptRequest_Chat,
180182
CreatePromptRequest_Text,
181183
CreateTextPromptRequest,
184+
PlaceholderMessage,
182185
Prompt,
186+
PromptChatMessage,
183187
PromptMeta,
184188
PromptMetaListResponse,
185189
Prompt_Chat,
@@ -242,6 +246,8 @@
242246
"CategoricalScore",
243247
"CategoricalScoreV1",
244248
"ChatMessage",
249+
"ChatMessage_Placeholder",
250+
"ChatMessage_Promptchatmessage",
245251
"ChatPrompt",
246252
"Comment",
247253
"CommentObjectType",
@@ -347,10 +353,12 @@
347353
"PaginatedModels",
348354
"PaginatedSessions",
349355
"PatchMediaBody",
356+
"PlaceholderMessage",
350357
"Project",
351358
"ProjectDeletionResponse",
352359
"Projects",
353360
"Prompt",
361+
"PromptChatMessage",
354362
"PromptMeta",
355363
"PromptMetaListResponse",
356364
"Prompt_Chat",

langfuse/api/resources/prompts/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
from .types import (
44
BasePrompt,
55
ChatMessage,
6+
ChatMessage_Placeholder,
7+
ChatMessage_Promptchatmessage,
68
ChatPrompt,
79
CreateChatPromptRequest,
810
CreatePromptRequest,
911
CreatePromptRequest_Chat,
1012
CreatePromptRequest_Text,
1113
CreateTextPromptRequest,
14+
PlaceholderMessage,
1215
Prompt,
16+
PromptChatMessage,
1317
PromptMeta,
1418
PromptMetaListResponse,
1519
Prompt_Chat,
@@ -20,13 +24,17 @@
2024
__all__ = [
2125
"BasePrompt",
2226
"ChatMessage",
27+
"ChatMessage_Placeholder",
28+
"ChatMessage_Promptchatmessage",
2329
"ChatPrompt",
2430
"CreateChatPromptRequest",
2531
"CreatePromptRequest",
2632
"CreatePromptRequest_Chat",
2733
"CreatePromptRequest_Text",
2834
"CreateTextPromptRequest",
35+
"PlaceholderMessage",
2936
"Prompt",
37+
"PromptChatMessage",
3038
"PromptMeta",
3139
"PromptMetaListResponse",
3240
"Prompt_Chat",

langfuse/api/resources/prompts/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def create(
228228
229229
Examples
230230
--------
231-
from langfuse import ChatMessage, CreatePromptRequest_Chat
231+
from langfuse import ChatMessage_Promptchatmessage, CreatePromptRequest_Chat
232232
from langfuse.client import FernLangfuse
233233
234234
client = FernLangfuse(
@@ -243,11 +243,11 @@ def create(
243243
request=CreatePromptRequest_Chat(
244244
name="name",
245245
prompt=[
246-
ChatMessage(
246+
ChatMessage_Promptchatmessage(
247247
role="role",
248248
content="content",
249249
),
250-
ChatMessage(
250+
ChatMessage_Promptchatmessage(
251251
role="role",
252252
content="content",
253253
),
@@ -512,7 +512,7 @@ async def create(
512512
--------
513513
import asyncio
514514
515-
from langfuse import ChatMessage, CreatePromptRequest_Chat
515+
from langfuse import ChatMessage_Promptchatmessage, CreatePromptRequest_Chat
516516
from langfuse.client import AsyncFernLangfuse
517517
518518
client = AsyncFernLangfuse(
@@ -530,11 +530,11 @@ async def main() -> None:
530530
request=CreatePromptRequest_Chat(
531531
name="name",
532532
prompt=[
533-
ChatMessage(
533+
ChatMessage_Promptchatmessage(
534534
role="role",
535535
content="content",
536536
),
537-
ChatMessage(
537+
ChatMessage_Promptchatmessage(
538538
role="role",
539539
content="content",
540540
),

langfuse/api/resources/prompts/types/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# This file was auto-generated by Fern from our API Definition.
22

33
from .base_prompt import BasePrompt
4-
from .chat_message import ChatMessage
4+
from .chat_message import (
5+
ChatMessage,
6+
ChatMessage_Placeholder,
7+
ChatMessage_Promptchatmessage,
8+
)
59
from .chat_prompt import ChatPrompt
610
from .create_chat_prompt_request import CreateChatPromptRequest
711
from .create_prompt_request import (
@@ -10,21 +14,27 @@
1014
CreatePromptRequest_Text,
1115
)
1216
from .create_text_prompt_request import CreateTextPromptRequest
17+
from .placeholder_message import PlaceholderMessage
1318
from .prompt import Prompt, Prompt_Chat, Prompt_Text
19+
from .prompt_chat_message import PromptChatMessage
1420
from .prompt_meta import PromptMeta
1521
from .prompt_meta_list_response import PromptMetaListResponse
1622
from .text_prompt import TextPrompt
1723

1824
__all__ = [
1925
"BasePrompt",
2026
"ChatMessage",
27+
"ChatMessage_Placeholder",
28+
"ChatMessage_Promptchatmessage",
2129
"ChatPrompt",
2230
"CreateChatPromptRequest",
2331
"CreatePromptRequest",
2432
"CreatePromptRequest_Chat",
2533
"CreatePromptRequest_Text",
2634
"CreateTextPromptRequest",
35+
"PlaceholderMessage",
2736
"Prompt",
37+
"PromptChatMessage",
2838
"PromptMeta",
2939
"PromptMetaListResponse",
3040
"Prompt_Chat",

langfuse/api/resources/prompts/types/chat_message.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,54 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3+
from __future__ import annotations
4+
35
import datetime as dt
46
import typing
57

68
from ....core.datetime_utils import serialize_datetime
79
from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
810

911

10-
class ChatMessage(pydantic_v1.BaseModel):
12+
class ChatMessage_Promptchatmessage(pydantic_v1.BaseModel):
1113
role: str
1214
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"
1352

1453
def json(self, **kwargs: typing.Any) -> str:
1554
kwargs_with_defaults: typing.Any = {
@@ -41,3 +80,6 @@ class Config:
4180
smart_union = True
4281
extra = pydantic_v1.Extra.allow
4382
json_encoders = {dt.datetime: serialize_datetime}
83+
84+
85+
ChatMessage = typing.Union[ChatMessage_Promptchatmessage, ChatMessage_Placeholder]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import datetime as dt
4+
import typing
5+
6+
from ....core.datetime_utils import serialize_datetime
7+
from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8+
9+
10+
class PlaceholderMessage(pydantic_v1.BaseModel):
11+
name: str
12+
13+
def json(self, **kwargs: typing.Any) -> str:
14+
kwargs_with_defaults: typing.Any = {
15+
"by_alias": True,
16+
"exclude_unset": True,
17+
**kwargs,
18+
}
19+
return super().json(**kwargs_with_defaults)
20+
21+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
22+
kwargs_with_defaults_exclude_unset: typing.Any = {
23+
"by_alias": True,
24+
"exclude_unset": True,
25+
**kwargs,
26+
}
27+
kwargs_with_defaults_exclude_none: typing.Any = {
28+
"by_alias": True,
29+
"exclude_none": True,
30+
**kwargs,
31+
}
32+
33+
return deep_union_pydantic_dicts(
34+
super().dict(**kwargs_with_defaults_exclude_unset),
35+
super().dict(**kwargs_with_defaults_exclude_none),
36+
)
37+
38+
class Config:
39+
frozen = True
40+
smart_union = True
41+
extra = pydantic_v1.Extra.allow
42+
json_encoders = {dt.datetime: serialize_datetime}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import datetime as dt
4+
import typing
5+
6+
from ....core.datetime_utils import serialize_datetime
7+
from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8+
9+
10+
class PromptChatMessage(pydantic_v1.BaseModel):
11+
role: str
12+
content: str
13+
14+
def json(self, **kwargs: typing.Any) -> str:
15+
kwargs_with_defaults: typing.Any = {
16+
"by_alias": True,
17+
"exclude_unset": True,
18+
**kwargs,
19+
}
20+
return super().json(**kwargs_with_defaults)
21+
22+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
23+
kwargs_with_defaults_exclude_unset: typing.Any = {
24+
"by_alias": True,
25+
"exclude_unset": True,
26+
**kwargs,
27+
}
28+
kwargs_with_defaults_exclude_none: typing.Any = {
29+
"by_alias": True,
30+
"exclude_none": True,
31+
**kwargs,
32+
}
33+
34+
return deep_union_pydantic_dicts(
35+
super().dict(**kwargs_with_defaults_exclude_unset),
36+
super().dict(**kwargs_with_defaults_exclude_none),
37+
)
38+
39+
class Config:
40+
frozen = True
41+
smart_union = True
42+
extra = pydantic_v1.Extra.allow
43+
json_encoders = {dt.datetime: serialize_datetime}

0 commit comments

Comments
 (0)