diff --git a/langfuse/api/comments/client.py b/langfuse/api/comments/client.py index 138c58b8f..f1f8036a3 100644 --- a/langfuse/api/comments/client.py +++ b/langfuse/api/comments/client.py @@ -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 @@ -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: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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 @@ -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: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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 diff --git a/langfuse/api/comments/raw_client.py b/langfuse/api/comments/raw_client.py index 811a7335c..276337be4 100644 --- a/langfuse/api/comments/raw_client.py +++ b/langfuse/api/comments/raw_client.py @@ -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 @@ -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]: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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, @@ -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]: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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, diff --git a/langfuse/api/comments/types/create_comment_request.py b/langfuse/api/comments/types/create_comment_request.py index 53a756ca9..0d92a905b 100644 --- a/langfuse/api/comments/types/create_comment_request.py +++ b/langfuse/api/comments/types/create_comment_request.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +import datetime as dt import typing import pydantic @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result. + """ + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( extra="allow", frozen=True ) diff --git a/langfuse/api/ingestion/client.py b/langfuse/api/ingestion/client.py index c6ea6d805..f021163f3 100644 --- a/langfuse/api/ingestion/client.py +++ b/langfuse/api/ingestion/client.py @@ -29,7 +29,7 @@ def with_raw_response(self) -> RawIngestionClient: return self._raw_client @typing_extensions.deprecated( - "On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` instead, see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.", + "On Langfuse Cloud, Langfuse v3 is deprecated and v4-only write mode begins on November 16, 2026. This endpoint is never shut down; it continues to accept score events. Trace and observation events fail only in v4-only write mode, not in dual or legacy mode. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` (for example with curl); see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; they reject trace and observation events only in v4-only write mode, not dual or legacy.", category=None, ) def batch( @@ -42,7 +42,7 @@ def batch( """ **Legacy endpoint for batch ingestion for Langfuse Observability.** - -> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://langfuse.com/integrations/native/opentelemetry + This endpoint is never shut down. Trace and observation events are rejected only in v4-only write mode (not dual or legacy); score events continue to be accepted. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send traces via the OpenTelemetry endpoint (`POST /api/public/otel/v1/traces`), for example with curl. Learn more: https://langfuse.com/integrations/native/opentelemetry Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. @@ -134,7 +134,7 @@ def with_raw_response(self) -> AsyncRawIngestionClient: return self._raw_client @typing_extensions.deprecated( - "On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` instead, see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.", + "On Langfuse Cloud, Langfuse v3 is deprecated and v4-only write mode begins on November 16, 2026. This endpoint is never shut down; it continues to accept score events. Trace and observation events fail only in v4-only write mode, not in dual or legacy mode. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` (for example with curl); see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; they reject trace and observation events only in v4-only write mode, not dual or legacy.", category=None, ) async def batch( @@ -147,7 +147,7 @@ async def batch( """ **Legacy endpoint for batch ingestion for Langfuse Observability.** - -> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://langfuse.com/integrations/native/opentelemetry + This endpoint is never shut down. Trace and observation events are rejected only in v4-only write mode (not dual or legacy); score events continue to be accepted. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send traces via the OpenTelemetry endpoint (`POST /api/public/otel/v1/traces`), for example with curl. Learn more: https://langfuse.com/integrations/native/opentelemetry Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. diff --git a/langfuse/api/ingestion/raw_client.py b/langfuse/api/ingestion/raw_client.py index 67d22c556..b572e2cb7 100644 --- a/langfuse/api/ingestion/raw_client.py +++ b/langfuse/api/ingestion/raw_client.py @@ -27,7 +27,7 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper @typing_extensions.deprecated( - "On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` instead, see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.", + "On Langfuse Cloud, Langfuse v3 is deprecated and v4-only write mode begins on November 16, 2026. This endpoint is never shut down; it continues to accept score events. Trace and observation events fail only in v4-only write mode, not in dual or legacy mode. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` (for example with curl); see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; they reject trace and observation events only in v4-only write mode, not dual or legacy.", category=None, ) def batch( @@ -40,7 +40,7 @@ def batch( """ **Legacy endpoint for batch ingestion for Langfuse Observability.** - -> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://langfuse.com/integrations/native/opentelemetry + This endpoint is never shut down. Trace and observation events are rejected only in v4-only write mode (not dual or legacy); score events continue to be accepted. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send traces via the OpenTelemetry endpoint (`POST /api/public/otel/v1/traces`), for example with curl. Learn more: https://langfuse.com/integrations/native/opentelemetry Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. @@ -167,7 +167,7 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper @typing_extensions.deprecated( - "On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` instead, see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.", + "On Langfuse Cloud, Langfuse v3 is deprecated and v4-only write mode begins on November 16, 2026. This endpoint is never shut down; it continues to accept score events. Trace and observation events fail only in v4-only write mode, not in dual or legacy mode. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` (for example with curl); see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; they reject trace and observation events only in v4-only write mode, not dual or legacy.", category=None, ) async def batch( @@ -180,7 +180,7 @@ async def batch( """ **Legacy endpoint for batch ingestion for Langfuse Observability.** - -> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://langfuse.com/integrations/native/opentelemetry + This endpoint is never shut down. Trace and observation events are rejected only in v4-only write mode (not dual or legacy); score events continue to be accepted. Always prefer upgrading to the current Python and JS SDKs. If you use custom auto-instrumentation, only then send traces via the OpenTelemetry endpoint (`POST /api/public/otel/v1/traces`), for example with curl. Learn more: https://langfuse.com/integrations/native/opentelemetry Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. diff --git a/langfuse/api/ingestion/types/ingestion_response.py b/langfuse/api/ingestion/types/ingestion_response.py index b9781fab5..063b9a773 100644 --- a/langfuse/api/ingestion/types/ingestion_response.py +++ b/langfuse/api/ingestion/types/ingestion_response.py @@ -3,7 +3,10 @@ import typing import pydantic +import typing_extensions +from ...commons.types.deprecation import Deprecation from ...core.pydantic_utilities import UniversalBaseModel +from ...core.serialization import FieldMetadata from .ingestion_error import IngestionError from .ingestion_success import IngestionSuccess @@ -11,6 +14,9 @@ class IngestionResponse(UniversalBaseModel): successes: typing.List[IngestionSuccess] errors: typing.List[IngestionError] + deprecation: typing_extensions.Annotated[ + typing.Optional[Deprecation], FieldMetadata(alias="_deprecation") + ] = None model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( extra="allow", frozen=True diff --git a/langfuse/api/legacy/observations_v1/client.py b/langfuse/api/legacy/observations_v1/client.py index 871191ee5..8696fcc5e 100644 --- a/langfuse/api/legacy/observations_v1/client.py +++ b/langfuse/api/legacy/observations_v1/client.py @@ -35,6 +35,7 @@ def get( self, observation_id: str, *, + start_time: typing.Optional[dt.datetime] = None, request_options: typing.Optional[RequestOptions] = None, ) -> ObservationsViewSingle: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to make the request substantially faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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 @@ -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: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to make the request substantially faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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 diff --git a/langfuse/api/legacy/observations_v1/raw_client.py b/langfuse/api/legacy/observations_v1/raw_client.py index 73343c130..691b105e2 100644 --- a/langfuse/api/legacy/observations_v1/raw_client.py +++ b/langfuse/api/legacy/observations_v1/raw_client.py @@ -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]: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to make the request substantially faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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: @@ -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]: """ @@ -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). Optional performance hint - when provided, Langfuse narrows the lookup to make the request substantially faster. It only affects speed - an incorrect or omitted value never changes the result. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -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: