Skip to content

Commit 8723870

Browse files
langfuse-botlangfuse-bot
andauthored
feat(api): update API spec from langfuse/langfuse 1ded68c (#1414)
Co-authored-by: langfuse-bot <[email protected]>
1 parent 1319ddf commit 8723870

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

langfuse/api/reference.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,9 @@ client.media.get_upload_url(
29632963
<dl>
29642964
<dd>
29652965

2966-
Get metrics from the Langfuse project using a query object
2966+
Get metrics from the Langfuse project using a query object.
2967+
2968+
For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
29672969
</dd>
29682970
</dl>
29692971
</dd>
@@ -4812,6 +4814,22 @@ client.projects.create_api_key(
48124814
<dl>
48134815
<dd>
48144816

4817+
**public_key:** `typing.Optional[str]` — Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided.
4818+
4819+
</dd>
4820+
</dl>
4821+
4822+
<dl>
4823+
<dd>
4824+
4825+
**secret_key:** `typing.Optional[str]` — Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided.
4826+
4827+
</dd>
4828+
</dl>
4829+
4830+
<dl>
4831+
<dd>
4832+
48154833
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
48164834

48174835
</dd>

langfuse/api/resources/metrics/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def metrics(
2323
self, *, query: str, request_options: typing.Optional[RequestOptions] = None
2424
) -> MetricsResponse:
2525
"""
26-
Get metrics from the Langfuse project using a query object
26+
Get metrics from the Langfuse project using a query object.
27+
28+
For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
2729
2830
Parameters
2931
----------
@@ -134,7 +136,9 @@ async def metrics(
134136
self, *, query: str, request_options: typing.Optional[RequestOptions] = None
135137
) -> MetricsResponse:
136138
"""
137-
Get metrics from the Langfuse project using a query object
139+
Get metrics from the Langfuse project using a query object.
140+
141+
For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
138142
139143
Parameters
140144
----------

langfuse/api/resources/projects/client.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ def create_api_key(
387387
project_id: str,
388388
*,
389389
note: typing.Optional[str] = OMIT,
390+
public_key: typing.Optional[str] = OMIT,
391+
secret_key: typing.Optional[str] = OMIT,
390392
request_options: typing.Optional[RequestOptions] = None,
391393
) -> ApiKeyResponse:
392394
"""
@@ -399,6 +401,12 @@ def create_api_key(
399401
note : typing.Optional[str]
400402
Optional note for the API key
401403
404+
public_key : typing.Optional[str]
405+
Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided.
406+
407+
secret_key : typing.Optional[str]
408+
Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided.
409+
402410
request_options : typing.Optional[RequestOptions]
403411
Request-specific configuration.
404412
@@ -425,7 +433,7 @@ def create_api_key(
425433
_response = self._client_wrapper.httpx_client.request(
426434
f"api/public/projects/{jsonable_encoder(project_id)}/apiKeys",
427435
method="POST",
428-
json={"note": note},
436+
json={"note": note, "publicKey": public_key, "secretKey": secret_key},
429437
request_options=request_options,
430438
omit=OMIT,
431439
)
@@ -932,6 +940,8 @@ async def create_api_key(
932940
project_id: str,
933941
*,
934942
note: typing.Optional[str] = OMIT,
943+
public_key: typing.Optional[str] = OMIT,
944+
secret_key: typing.Optional[str] = OMIT,
935945
request_options: typing.Optional[RequestOptions] = None,
936946
) -> ApiKeyResponse:
937947
"""
@@ -944,6 +954,12 @@ async def create_api_key(
944954
note : typing.Optional[str]
945955
Optional note for the API key
946956
957+
public_key : typing.Optional[str]
958+
Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided.
959+
960+
secret_key : typing.Optional[str]
961+
Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided.
962+
947963
request_options : typing.Optional[RequestOptions]
948964
Request-specific configuration.
949965
@@ -978,7 +994,7 @@ async def main() -> None:
978994
_response = await self._client_wrapper.httpx_client.request(
979995
f"api/public/projects/{jsonable_encoder(project_id)}/apiKeys",
980996
method="POST",
981-
json={"note": note},
997+
json={"note": note, "publicKey": public_key, "secretKey": secret_key},
982998
request_options=request_options,
983999
omit=OMIT,
9841000
)

0 commit comments

Comments
 (0)