diff --git a/langfuse/api/__init__.py b/langfuse/api/__init__.py index 9ec280087..eda68d855 100644 --- a/langfuse/api/__init__.py +++ b/langfuse/api/__init__.py @@ -137,6 +137,7 @@ OpenAiResponseUsageSchema, OpenAiUsage, OptionalObservationBody, + Organization, OrganizationApiKey, OrganizationApiKeysResponse, OrganizationProject, @@ -392,6 +393,7 @@ "OpenAiResponseUsageSchema", "OpenAiUsage", "OptionalObservationBody", + "Organization", "OrganizationApiKey", "OrganizationApiKeysResponse", "OrganizationProject", diff --git a/langfuse/api/reference.md b/langfuse/api/reference.md index b84696be4..940e6d974 100644 --- a/langfuse/api/reference.md +++ b/langfuse/api/reference.md @@ -3191,6 +3191,8 @@ JSON string containing the query parameters with the following structure: Get metrics from the Langfuse project using a query object. +Consider using the [v2 metrics endpoint](/api-reference/metrics-v2/metrics) for better performance. + For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api). @@ -4007,7 +4009,9 @@ client.observations.get(
-Get a list of observations +Get a list of observations. + +Consider using the [v2 observations endpoint](/api-reference/observations-v2/getMany) for cursor-based pagination and field selection.
diff --git a/langfuse/api/resources/__init__.py b/langfuse/api/resources/__init__.py index 1095119a7..10c3c11fe 100644 --- a/langfuse/api/resources/__init__.py +++ b/langfuse/api/resources/__init__.py @@ -211,6 +211,7 @@ ApiKeyList, ApiKeyResponse, ApiKeySummary, + Organization, Project, ProjectDeletionResponse, Projects, @@ -412,6 +413,7 @@ "OpenAiResponseUsageSchema", "OpenAiUsage", "OptionalObservationBody", + "Organization", "OrganizationApiKey", "OrganizationApiKeysResponse", "OrganizationProject", diff --git a/langfuse/api/resources/metrics/client.py b/langfuse/api/resources/metrics/client.py index 471f5182e..85403e03c 100644 --- a/langfuse/api/resources/metrics/client.py +++ b/langfuse/api/resources/metrics/client.py @@ -25,6 +25,8 @@ def metrics( """ Get metrics from the Langfuse project using a query object. + Consider using the [v2 metrics endpoint](/api-reference/metrics-v2/metrics) for better performance. + For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api). Parameters @@ -138,6 +140,8 @@ async def metrics( """ Get metrics from the Langfuse project using a query object. + Consider using the [v2 metrics endpoint](/api-reference/metrics-v2/metrics) for better performance. + For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api). Parameters diff --git a/langfuse/api/resources/observations/client.py b/langfuse/api/resources/observations/client.py index cac4efe4d..d99dc909c 100644 --- a/langfuse/api/resources/observations/client.py +++ b/langfuse/api/resources/observations/client.py @@ -111,7 +111,9 @@ def get_many( request_options: typing.Optional[RequestOptions] = None, ) -> ObservationsViews: """ - Get a list of observations + Get a list of observations. + + Consider using the [v2 observations endpoint](/api-reference/observations-v2/getMany) for cursor-based pagination and field selection. Parameters ---------- @@ -412,7 +414,9 @@ async def get_many( request_options: typing.Optional[RequestOptions] = None, ) -> ObservationsViews: """ - Get a list of observations + Get a list of observations. + + Consider using the [v2 observations endpoint](/api-reference/observations-v2/getMany) for cursor-based pagination and field selection. Parameters ---------- diff --git a/langfuse/api/resources/projects/__init__.py b/langfuse/api/resources/projects/__init__.py index 26c74c1c7..7161cfff1 100644 --- a/langfuse/api/resources/projects/__init__.py +++ b/langfuse/api/resources/projects/__init__.py @@ -5,6 +5,7 @@ ApiKeyList, ApiKeyResponse, ApiKeySummary, + Organization, Project, ProjectDeletionResponse, Projects, @@ -15,6 +16,7 @@ "ApiKeyList", "ApiKeyResponse", "ApiKeySummary", + "Organization", "Project", "ProjectDeletionResponse", "Projects", diff --git a/langfuse/api/resources/projects/types/__init__.py b/langfuse/api/resources/projects/types/__init__.py index c59b62a62..6fd44aa52 100644 --- a/langfuse/api/resources/projects/types/__init__.py +++ b/langfuse/api/resources/projects/types/__init__.py @@ -4,6 +4,7 @@ from .api_key_list import ApiKeyList from .api_key_response import ApiKeyResponse from .api_key_summary import ApiKeySummary +from .organization import Organization from .project import Project from .project_deletion_response import ProjectDeletionResponse from .projects import Projects @@ -13,6 +14,7 @@ "ApiKeyList", "ApiKeyResponse", "ApiKeySummary", + "Organization", "Project", "ProjectDeletionResponse", "Projects", diff --git a/langfuse/api/resources/projects/types/organization.py b/langfuse/api/resources/projects/types/organization.py new file mode 100644 index 000000000..1a46b6f6c --- /dev/null +++ b/langfuse/api/resources/projects/types/organization.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class Organization(pydantic_v1.BaseModel): + id: str = pydantic_v1.Field() + """ + The unique identifier of the organization + """ + + name: str = pydantic_v1.Field() + """ + The name of the organization + """ + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = { + "by_alias": True, + "exclude_unset": True, + **kwargs, + } + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = { + "by_alias": True, + "exclude_unset": True, + **kwargs, + } + kwargs_with_defaults_exclude_none: typing.Any = { + "by_alias": True, + "exclude_none": True, + **kwargs, + } + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), + super().dict(**kwargs_with_defaults_exclude_none), + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/langfuse/api/resources/projects/types/project.py b/langfuse/api/resources/projects/types/project.py index cf257d406..913dbb040 100644 --- a/langfuse/api/resources/projects/types/project.py +++ b/langfuse/api/resources/projects/types/project.py @@ -5,11 +5,17 @@ from ....core.datetime_utils import serialize_datetime from ....core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .organization import Organization class Project(pydantic_v1.BaseModel): id: str name: str + organization: Organization = pydantic_v1.Field() + """ + The organization this project belongs to + """ + metadata: typing.Dict[str, typing.Any] = pydantic_v1.Field() """ Metadata for the project