Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions langfuse/api/comments/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ..commons.types.comment import Comment
Expand Down Expand Up @@ -36,6 +37,7 @@ def create(
object_id: str,
content: str,
author_user_id: typing.Optional[str] = OMIT,
object_start_time: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> CreateCommentResponse:
"""
Expand All @@ -58,6 +60,9 @@ def create(
author_user_id : typing.Optional[str]
The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.

object_start_time : typing.Optional[dt.datetime]
The start time of the referenced object (for observations, the observation's start time). When provided, Langfuse validates the reference more efficiently by narrowing the lookup to that time range.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -90,6 +95,7 @@ def create(
object_id=object_id,
content=content,
author_user_id=author_user_id,
object_start_time=object_start_time,
request_options=request_options,
)
return _response.data
Expand Down Expand Up @@ -221,6 +227,7 @@ async def create(
object_id: str,
content: str,
author_user_id: typing.Optional[str] = OMIT,
object_start_time: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> CreateCommentResponse:
"""
Expand All @@ -243,6 +250,9 @@ async def create(
author_user_id : typing.Optional[str]
The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.

object_start_time : typing.Optional[dt.datetime]
The start time of the referenced object (for observations, the observation's start time). When provided, Langfuse validates the reference more efficiently by narrowing the lookup to that time range.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -283,6 +293,7 @@ async def main() -> None:
object_id=object_id,
content=content,
author_user_id=author_user_id,
object_start_time=object_start_time,
request_options=request_options,
)
return _response.data
Expand Down
11 changes: 11 additions & 0 deletions langfuse/api/comments/raw_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing
from json.decoder import JSONDecodeError

Expand Down Expand Up @@ -34,6 +35,7 @@ def create(
object_id: str,
content: str,
author_user_id: typing.Optional[str] = OMIT,
object_start_time: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CreateCommentResponse]:
"""
Expand All @@ -56,6 +58,9 @@ def create(
author_user_id : typing.Optional[str]
The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.

object_start_time : typing.Optional[dt.datetime]
The start time of the referenced object (for observations, the observation's start time). When provided, Langfuse validates the reference more efficiently by narrowing the lookup to that time range.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -72,6 +77,7 @@ def create(
"objectId": object_id,
"content": content,
"authorUserId": author_user_id,
"objectStartTime": object_start_time,
},
request_options=request_options,
omit=OMIT,
Expand Down Expand Up @@ -398,6 +404,7 @@ async def create(
object_id: str,
content: str,
author_user_id: typing.Optional[str] = OMIT,
object_start_time: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CreateCommentResponse]:
"""
Expand All @@ -420,6 +427,9 @@ async def create(
author_user_id : typing.Optional[str]
The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.

object_start_time : typing.Optional[dt.datetime]
The start time of the referenced object (for observations, the observation's start time). When provided, Langfuse validates the reference more efficiently by narrowing the lookup to that time range.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -436,6 +446,7 @@ async def create(
"objectId": object_id,
"content": content,
"authorUserId": author_user_id,
"objectStartTime": object_start_time,
},
request_options=request_options,
omit=OMIT,
Expand Down
8 changes: 8 additions & 0 deletions langfuse/api/comments/types/create_comment_request.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
Expand Down Expand Up @@ -42,6 +43,13 @@ class CreateCommentRequest(UniversalBaseModel):
The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.
"""

object_start_time: typing_extensions.Annotated[
typing.Optional[dt.datetime], FieldMetadata(alias="objectStartTime")
] = pydantic.Field(default=None)
"""
The start time of the referenced object (for observations, the observation's start time). When provided, Langfuse validates the reference more efficiently by narrowing the lookup to that time range.
"""

model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
extra="allow", frozen=True
)
12 changes: 10 additions & 2 deletions langfuse/api/legacy/observations_v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get(
self,
observation_id: str,
*,
start_time: typing.Optional[dt.datetime] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> ObservationsViewSingle:
"""
Expand All @@ -45,6 +46,9 @@ def get(
observation_id : str
The unique langfuse identifier of an observation, can be an event, span or generation

start_time : typing.Optional[dt.datetime]
The start time of the observation (ISO 8601 with offset, e.g. 2024-01-01T00:00:00Z). When provided, the lookup is restricted to the observation's start day, which makes the request substantially faster. Omit it to look up the observation without a time bound.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -69,7 +73,7 @@ def get(
)
"""
_response = self._raw_client.get(
observation_id, request_options=request_options
observation_id, start_time=start_time, request_options=request_options
)
return _response.data

Expand Down Expand Up @@ -291,6 +295,7 @@ async def get(
self,
observation_id: str,
*,
start_time: typing.Optional[dt.datetime] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> ObservationsViewSingle:
"""
Expand All @@ -301,6 +306,9 @@ async def get(
observation_id : str
The unique langfuse identifier of an observation, can be an event, span or generation

start_time : typing.Optional[dt.datetime]
The start time of the observation (ISO 8601 with offset, e.g. 2024-01-01T00:00:00Z). When provided, the lookup is restricted to the observation's start day, which makes the request substantially faster. Omit it to look up the observation without a time bound.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -333,7 +341,7 @@ async def main() -> None:
asyncio.run(main())
"""
_response = await self._raw_client.get(
observation_id, request_options=request_options
observation_id, start_time=start_time, request_options=request_options
)
return _response.data

Expand Down
18 changes: 18 additions & 0 deletions langfuse/api/legacy/observations_v1/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get(
self,
observation_id: str,
*,
start_time: typing.Optional[dt.datetime] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ObservationsViewSingle]:
"""
Expand All @@ -44,6 +45,9 @@ def get(
observation_id : str
The unique langfuse identifier of an observation, can be an event, span or generation

start_time : typing.Optional[dt.datetime]
The start time of the observation (ISO 8601 with offset, e.g. 2024-01-01T00:00:00Z). When provided, the lookup is restricted to the observation's start day, which makes the request substantially faster. Omit it to look up the observation without a time bound.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -54,6 +58,11 @@ def get(
_response = self._client_wrapper.httpx_client.request(
f"api/public/observations/{jsonable_encoder(observation_id)}",
method="GET",
params={
"startTime": serialize_datetime(start_time)
if start_time is not None
else None,
},
request_options=request_options,
)
try:
Expand Down Expand Up @@ -411,6 +420,7 @@ async def get(
self,
observation_id: str,
*,
start_time: typing.Optional[dt.datetime] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ObservationsViewSingle]:
"""
Expand All @@ -421,6 +431,9 @@ async def get(
observation_id : str
The unique langfuse identifier of an observation, can be an event, span or generation

start_time : typing.Optional[dt.datetime]
The start time of the observation (ISO 8601 with offset, e.g. 2024-01-01T00:00:00Z). When provided, the lookup is restricted to the observation's start day, which makes the request substantially faster. Omit it to look up the observation without a time bound.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -431,6 +444,11 @@ async def get(
_response = await self._client_wrapper.httpx_client.request(
f"api/public/observations/{jsonable_encoder(observation_id)}",
method="GET",
params={
"startTime": serialize_datetime(start_time)
if start_time is not None
else None,
},
request_options=request_options,
)
try:
Expand Down