diff --git a/langfuse/api/reference.md b/langfuse/api/reference.md index 199c9421b..8291edf16 100644 --- a/langfuse/api/reference.md +++ b/langfuse/api/reference.md @@ -2963,7 +2963,9 @@ client.media.get_upload_url(
-Get metrics from the Langfuse project using a query object +Get metrics from the Langfuse project using a query object. + +For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
@@ -4812,6 +4814,22 @@ client.projects.create_api_key(
+**public_key:** `typing.Optional[str]` — Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided. + +
+
+ +
+
+ +**secret_key:** `typing.Optional[str]` — Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/langfuse/api/resources/metrics/client.py b/langfuse/api/resources/metrics/client.py index f46dc75f2..471f5182e 100644 --- a/langfuse/api/resources/metrics/client.py +++ b/langfuse/api/resources/metrics/client.py @@ -23,7 +23,9 @@ def metrics( self, *, query: str, request_options: typing.Optional[RequestOptions] = None ) -> MetricsResponse: """ - Get metrics from the Langfuse project using a query object + Get metrics from the Langfuse project using a query object. + + For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api). Parameters ---------- @@ -134,7 +136,9 @@ async def metrics( self, *, query: str, request_options: typing.Optional[RequestOptions] = None ) -> MetricsResponse: """ - Get metrics from the Langfuse project using a query object + Get metrics from the Langfuse project using a query object. + + For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api). Parameters ---------- diff --git a/langfuse/api/resources/projects/client.py b/langfuse/api/resources/projects/client.py index 2c63e3186..9af7cfdfa 100644 --- a/langfuse/api/resources/projects/client.py +++ b/langfuse/api/resources/projects/client.py @@ -387,6 +387,8 @@ def create_api_key( project_id: str, *, note: typing.Optional[str] = OMIT, + public_key: typing.Optional[str] = OMIT, + secret_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ApiKeyResponse: """ @@ -399,6 +401,12 @@ def create_api_key( note : typing.Optional[str] Optional note for the API key + public_key : typing.Optional[str] + Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided. + + secret_key : typing.Optional[str] + Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -425,7 +433,7 @@ def create_api_key( _response = self._client_wrapper.httpx_client.request( f"api/public/projects/{jsonable_encoder(project_id)}/apiKeys", method="POST", - json={"note": note}, + json={"note": note, "publicKey": public_key, "secretKey": secret_key}, request_options=request_options, omit=OMIT, ) @@ -932,6 +940,8 @@ async def create_api_key( project_id: str, *, note: typing.Optional[str] = OMIT, + public_key: typing.Optional[str] = OMIT, + secret_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ApiKeyResponse: """ @@ -944,6 +954,12 @@ async def create_api_key( note : typing.Optional[str] Optional note for the API key + public_key : typing.Optional[str] + Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided. + + secret_key : typing.Optional[str] + Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -978,7 +994,7 @@ async def main() -> None: _response = await self._client_wrapper.httpx_client.request( f"api/public/projects/{jsonable_encoder(project_id)}/apiKeys", method="POST", - json={"note": note}, + json={"note": note, "publicKey": public_key, "secretKey": secret_key}, request_options=request_options, omit=OMIT, )