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
9 changes: 0 additions & 9 deletions langfuse/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@
IngestionEvent_ObservationCreate,
IngestionEvent_ObservationUpdate,
IngestionEvent_ScoreCreate,
IngestionEvent_SdkLog,
IngestionEvent_SpanCreate,
IngestionEvent_SpanUpdate,
IngestionEvent_TraceCreate,
Expand All @@ -319,8 +318,6 @@
OptionalObservationBody,
ScoreBody,
ScoreEvent,
SdkLogBody,
SdkLogEvent,
TraceBody,
TraceEvent,
UpdateEventBody,
Expand Down Expand Up @@ -669,7 +666,6 @@
"IngestionEvent_ObservationCreate": ".ingestion",
"IngestionEvent_ObservationUpdate": ".ingestion",
"IngestionEvent_ScoreCreate": ".ingestion",
"IngestionEvent_SdkLog": ".ingestion",
"IngestionEvent_SpanCreate": ".ingestion",
"IngestionEvent_SpanUpdate": ".ingestion",
"IngestionEvent_TraceCreate": ".ingestion",
Expand Down Expand Up @@ -820,8 +816,6 @@
"Score_Correction": ".commons",
"Score_Numeric": ".commons",
"Score_Text": ".commons",
"SdkLogBody": ".ingestion",
"SdkLogEvent": ".ingestion",
"ServiceProviderConfig": ".scim",
"ServiceUnavailableError": ".health",
"Session": ".commons",
Expand Down Expand Up @@ -1124,7 +1118,6 @@ def __dir__():
"IngestionEvent_ObservationCreate",
"IngestionEvent_ObservationUpdate",
"IngestionEvent_ScoreCreate",
"IngestionEvent_SdkLog",
"IngestionEvent_SpanCreate",
"IngestionEvent_SpanUpdate",
"IngestionEvent_TraceCreate",
Expand Down Expand Up @@ -1275,8 +1268,6 @@ def __dir__():
"Score_Correction",
"Score_Numeric",
"Score_Text",
"SdkLogBody",
"SdkLogEvent",
"ServiceProviderConfig",
"ServiceUnavailableError",
"Session",
Expand Down
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). 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.

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). 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.

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). 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.

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). 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.

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). 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
)
20 changes: 10 additions & 10 deletions langfuse/api/evaluation_commons/types/evaluation_rule_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EvaluationRuleFilter_Datetime(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -97,7 +97,7 @@ class EvaluationRuleFilter_String(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -160,7 +160,7 @@ class EvaluationRuleFilter_Number(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -223,7 +223,7 @@ class EvaluationRuleFilter_StringOptions(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -286,7 +286,7 @@ class EvaluationRuleFilter_CategoryOptions(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -350,7 +350,7 @@ class EvaluationRuleFilter_ArrayOptions(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -413,7 +413,7 @@ class EvaluationRuleFilter_StringObject(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Comment on lines +416 to 419

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) The updated docstring for EvaluationRuleFilter_StringObject (line 416) tells callers stringObject filters now support is set/is not set operators, but the operator field at line 456 is still typed EvaluationRuleStringFilterOperator, whose enum (evaluation_rule_string_filter_operator.py) only defines =, contains, does not contain, starts with, ends with. Constructing EvaluationRuleFilter_StringObject(operator="is set", ...) as the new docs instruct raises a pydantic ValidationError, and parsing any GET response for an evaluation rule whose metadata/stringObject filter already uses is set/is not set server-side will fail the same way, breaking that read call. …

Why this was flagged

…Fix: regenerate/extend EvaluationRuleStringFilterOperator (or add a dedicated operator enum for stringObject) to include is set and is not set so both constructing requests and parsing responses with these operators succeed.

Trigger: an SDK user follows the new docstring at evaluation_rule_filter.py:416 and builds EvaluationRuleFilter_StringObject(column='metadata', key='k', operator='is set', value=''), or the Langfuse API (per the same spec update) returns an evaluation rule whose filter already uses is set/is not set, reached via GET/list evaluation rule endpoints in evaluation_rules/client.py that deserialize into EvaluationRuleFilter. The operator field at line 456 is pydantic-typed as EvaluationRuleStringFilterOperator, a strict enum in evaluation_rule_string_filter_operator.py that this diff did not update and that lacks these two literals. Base branch had no such docstring promise, so no user attempted this operator; after merge, both request construction and response parsing for it raise pydantic ValidationError, and no fallback or try/except catches this in…

Verification: nit. The docstring at evaluation_rule_filter.py:416 (changed by this diff, from "stringObject: same operators as string" to "...is set, is not set (use is set / is not set for key presence...)") advertises operators that the operator field cannot accept. Line 456 types operator as EvaluationRuleStringFilterOperator; that enum in evaluation_rule_string_filter_operator.py (unchanged by…

Expand Down Expand Up @@ -477,7 +477,7 @@ class EvaluationRuleFilter_NumberObject(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -541,7 +541,7 @@ class EvaluationRuleFilter_Boolean(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down Expand Up @@ -604,7 +604,7 @@ class EvaluationRuleFilter_Null(UniversalBaseModel):
- `datetime`: `"="`, `">"`, `"<"`, `">="`, `"<="`
- `stringOptions`: `any of`, `none of`
- `arrayOptions`: `any of`, `none of`, `all of`
- `stringObject`: same operators as `string`
- `stringObject`: `"="`, `contains`, `does not contain`, `starts with`, `ends with`, `is set`, `is not set` (use `is set` / `is not set` for key presence; an empty value for `contains`, `starts with`, or `ends with` is treated as `is set`)
- `boolean`: `"="`, `"<>"`
- `null`: `is null`, `is not null`

Expand Down
20 changes: 16 additions & 4 deletions langfuse/api/experiments/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def list(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiments on or after this datetime.
Required. Retrieve only experiments with events on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -145,7 +148,10 @@ def list_items(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiment items started on or after this datetime.
Required. Retrieve only experiment items started on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -263,7 +269,10 @@ async def list(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiments on or after this datetime.
Required. Retrieve only experiments with events on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -368,7 +377,10 @@ async def list_items(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiment items started on or after this datetime.
Required. Retrieve only experiment items started on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down
20 changes: 16 additions & 4 deletions langfuse/api/experiments/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def list(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiments on or after this datetime.
Required. Retrieve only experiments with events on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -205,7 +208,10 @@ def list_items(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiment items started on or after this datetime.
Required. Retrieve only experiment items started on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -374,7 +380,10 @@ async def list(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiments on or after this datetime.
Required. Retrieve only experiments with events on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down Expand Up @@ -534,7 +543,10 @@ async def list_items(
Parameters
----------
from_start_time : dt.datetime
Retrieve only experiment items started on or after this datetime.
Required. Retrieve only experiment items started on or after this
datetime. A lower bound is required so the query stays fast on
large projects; pair it with `toStartTime` to select a specific
window.

fields : typing.Optional[str]
Comma-separated list of field groups to include. Available groups:
Expand Down
Loading
Loading