Skip to content
Merged
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
20 changes: 19 additions & 1 deletion langfuse/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,9 @@ client.media.get_upload_url(
<dl>
<dd>

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).
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -4812,6 +4814,22 @@ client.projects.create_api_key(
<dl>
<dd>

**public_key:** `typing.Optional[str]` — Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided.

</dd>
</dl>

<dl>
<dd>

**secret_key:** `typing.Optional[str]` — Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided.

</dd>
</dl>

<dl>
<dd>

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

</dd>
Expand Down
8 changes: 6 additions & 2 deletions langfuse/api/resources/metrics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
----------
Expand Down
20 changes: 18 additions & 2 deletions langfuse/api/resources/projects/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand All @@ -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.

Expand All @@ -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,
)
Expand Down Expand Up @@ -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:
"""
Expand All @@ -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.

Expand Down Expand Up @@ -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,
)
Expand Down