Skip to content

Commit 5e317bd

Browse files
[NA] [SDK] [DOCS] Update automatically OpenAPI spec and Fern code (#7424)
Co-authored-by: Andres Cruz <andresc@comet.com>
1 parent be8ae93 commit 5e317bd

19 files changed

Lines changed: 778 additions & 0 deletions

File tree

apps/opik-documentation/documentation/fern/openapi/opik.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8004,6 +8004,39 @@ paths:
80048004
application/octet-stream:
80058005
schema:
80068006
$ref: "#/components/schemas/ErrorMessage_Public"
8007+
/v1/private/spans/exists:
8008+
get:
8009+
tags:
8010+
- Spans
8011+
summary: Check whether a project has spans
8012+
description: Returns whether the project has at least one span matching the
8013+
given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions
8014+
without scanning or aggregating the whole project.
8015+
operationId: spansExist
8016+
parameters:
8017+
- name: project_id
8018+
in: query
8019+
schema:
8020+
type: string
8021+
format: uuid
8022+
- name: project_name
8023+
in: query
8024+
schema:
8025+
type: string
8026+
- name: source
8027+
in: query
8028+
schema:
8029+
type: string
8030+
description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\
8031+
\ for the Logs empty state), matching the rendered list's logs-source\
8032+
\ scope. Omit to probe any source."
8033+
responses:
8034+
"200":
8035+
description: Span existence
8036+
content:
8037+
application/json:
8038+
schema:
8039+
$ref: "#/components/schemas/ExistenceResponse"
80078040
/v1/private/spans/comments/{commentId}:
80088041
patch:
80098042
tags:
@@ -8878,6 +8911,46 @@ paths:
88788911
application/octet-stream:
88798912
schema:
88808913
$ref: "#/components/schemas/ErrorMessage_Public"
8914+
/v1/private/traces/exists:
8915+
get:
8916+
tags:
8917+
- Traces
8918+
summary: Check whether a project has traces
8919+
description: Returns whether the project has at least one trace matching the
8920+
given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions
8921+
without scanning or aggregating the whole project.
8922+
operationId: tracesExist
8923+
parameters:
8924+
- name: project_id
8925+
in: query
8926+
schema:
8927+
type: string
8928+
format: uuid
8929+
- name: project_name
8930+
in: query
8931+
schema:
8932+
type: string
8933+
- name: source
8934+
in: query
8935+
schema:
8936+
type: string
8937+
description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\
8938+
\ for the Logs empty state), matching the rendered list's logs-source\
8939+
\ scope. Omit to probe any source."
8940+
- name: thread_only
8941+
in: query
8942+
schema:
8943+
type: boolean
8944+
description: "When true, only considers traces that belong to a thread (thread_id\
8945+
\ is set) — used by the Threads empty state."
8946+
default: false
8947+
responses:
8948+
"200":
8949+
description: Trace existence
8950+
content:
8951+
application/json:
8952+
schema:
8953+
$ref: "#/components/schemas/ExistenceResponse"
88818954
/v1/private/traces/threads/{threadModelId}:
88828955
patch:
88838956
tags:
@@ -21405,6 +21478,13 @@ components:
2140521478
description: "Filter spans created up to this time (ISO-8601 format). If\
2140621479
\ not provided, defaults to current time. Must be after 'from_time'."
2140721480
format: date-time
21481+
ExistenceResponse:
21482+
type: object
21483+
properties:
21484+
exists:
21485+
type: boolean
21486+
description: Whether the project has at least one matching entity for the
21487+
given scope
2140821488
TraceBatchUpdate:
2140921489
required:
2141021490
- ids

sdks/code_generation/fern/openapi/openapi.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8004,6 +8004,39 @@ paths:
80048004
application/octet-stream:
80058005
schema:
80068006
$ref: "#/components/schemas/ErrorMessage_Public"
8007+
/v1/private/spans/exists:
8008+
get:
8009+
tags:
8010+
- Spans
8011+
summary: Check whether a project has spans
8012+
description: Returns whether the project has at least one span matching the
8013+
given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions
8014+
without scanning or aggregating the whole project.
8015+
operationId: spansExist
8016+
parameters:
8017+
- name: project_id
8018+
in: query
8019+
schema:
8020+
type: string
8021+
format: uuid
8022+
- name: project_name
8023+
in: query
8024+
schema:
8025+
type: string
8026+
- name: source
8027+
in: query
8028+
schema:
8029+
type: string
8030+
description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\
8031+
\ for the Logs empty state), matching the rendered list's logs-source\
8032+
\ scope. Omit to probe any source."
8033+
responses:
8034+
"200":
8035+
description: Span existence
8036+
content:
8037+
application/json:
8038+
schema:
8039+
$ref: "#/components/schemas/ExistenceResponse"
80078040
/v1/private/spans/comments/{commentId}:
80088041
patch:
80098042
tags:
@@ -8878,6 +8911,46 @@ paths:
88788911
application/octet-stream:
88798912
schema:
88808913
$ref: "#/components/schemas/ErrorMessage_Public"
8914+
/v1/private/traces/exists:
8915+
get:
8916+
tags:
8917+
- Traces
8918+
summary: Check whether a project has traces
8919+
description: Returns whether the project has at least one trace matching the
8920+
given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions
8921+
without scanning or aggregating the whole project.
8922+
operationId: tracesExist
8923+
parameters:
8924+
- name: project_id
8925+
in: query
8926+
schema:
8927+
type: string
8928+
format: uuid
8929+
- name: project_name
8930+
in: query
8931+
schema:
8932+
type: string
8933+
- name: source
8934+
in: query
8935+
schema:
8936+
type: string
8937+
description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\
8938+
\ for the Logs empty state), matching the rendered list's logs-source\
8939+
\ scope. Omit to probe any source."
8940+
- name: thread_only
8941+
in: query
8942+
schema:
8943+
type: boolean
8944+
description: "When true, only considers traces that belong to a thread (thread_id\
8945+
\ is set) — used by the Threads empty state."
8946+
default: false
8947+
responses:
8948+
"200":
8949+
description: Trace existence
8950+
content:
8951+
application/json:
8952+
schema:
8953+
$ref: "#/components/schemas/ExistenceResponse"
88818954
/v1/private/traces/threads/{threadModelId}:
88828955
patch:
88838956
tags:
@@ -21405,6 +21478,13 @@ components:
2140521478
description: "Filter spans created up to this time (ISO-8601 format). If\
2140621479
\ not provided, defaults to current time. Must be after 'from_time'."
2140721480
format: date-time
21481+
ExistenceResponse:
21482+
type: object
21483+
properties:
21484+
exists:
21485+
type: boolean
21486+
description: Whether the project has at least one matching entity for the
21487+
given scope
2140821488
TraceBatchUpdate:
2140921489
required:
2141021490
- ids

sdks/python/src/opik/rest_api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277
ExecutionPolicyCompare,
278278
ExecutionPolicyPublic,
279279
ExecutionPolicyWrite,
280+
ExistenceResponse,
280281
Experiment,
281282
ExperimentEvaluationMethod,
282283
ExperimentExecutionResponse,
@@ -1074,6 +1075,7 @@
10741075
"ExecutionPolicyCompare",
10751076
"ExecutionPolicyPublic",
10761077
"ExecutionPolicyWrite",
1078+
"ExistenceResponse",
10771079
"Experiment",
10781080
"ExperimentEvaluationMethod",
10791081
"ExperimentExecutionResponse",

sdks/python/src/opik/rest_api/spans/client.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ..types.comment import Comment
99
from ..types.error_info import ErrorInfo
1010
from ..types.error_info_write import ErrorInfoWrite
11+
from ..types.existence_response import ExistenceResponse
1112
from ..types.feedback_score_batch_item import FeedbackScoreBatchItem
1213
from ..types.feedback_score_names_public import FeedbackScoreNamesPublic
1314
from ..types.feedback_score_source import FeedbackScoreSource
@@ -937,6 +938,44 @@ def search_spans(
937938
) as r:
938939
yield from r.data
939940

941+
def exist(
942+
self,
943+
*,
944+
project_id: typing.Optional[str] = None,
945+
project_name: typing.Optional[str] = None,
946+
source: typing.Optional[str] = None,
947+
request_options: typing.Optional[RequestOptions] = None,
948+
) -> ExistenceResponse:
949+
"""
950+
Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project.
951+
952+
Parameters
953+
----------
954+
project_id : typing.Optional[str]
955+
956+
project_name : typing.Optional[str]
957+
958+
source : typing.Optional[str]
959+
960+
request_options : typing.Optional[RequestOptions]
961+
Request-specific configuration.
962+
963+
Returns
964+
-------
965+
ExistenceResponse
966+
Span existence
967+
968+
Examples
969+
--------
970+
from Opik import OpikApi
971+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
972+
client.spans.exist()
973+
"""
974+
_response = self._raw_client.exist(
975+
project_id=project_id, project_name=project_name, source=source, request_options=request_options
976+
)
977+
return _response.data
978+
940979
def update_span_comment(
941980
self,
942981
comment_id: str,
@@ -1949,6 +1988,47 @@ async def main() -> None:
19491988
async for data in r.data:
19501989
yield data
19511990

1991+
async def exist(
1992+
self,
1993+
*,
1994+
project_id: typing.Optional[str] = None,
1995+
project_name: typing.Optional[str] = None,
1996+
source: typing.Optional[str] = None,
1997+
request_options: typing.Optional[RequestOptions] = None,
1998+
) -> ExistenceResponse:
1999+
"""
2000+
Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project.
2001+
2002+
Parameters
2003+
----------
2004+
project_id : typing.Optional[str]
2005+
2006+
project_name : typing.Optional[str]
2007+
2008+
source : typing.Optional[str]
2009+
2010+
request_options : typing.Optional[RequestOptions]
2011+
Request-specific configuration.
2012+
2013+
Returns
2014+
-------
2015+
ExistenceResponse
2016+
Span existence
2017+
2018+
Examples
2019+
--------
2020+
from Opik import AsyncOpikApi
2021+
import asyncio
2022+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
2023+
async def main() -> None:
2024+
await client.spans.exist()
2025+
asyncio.run(main())
2026+
"""
2027+
_response = await self._raw_client.exist(
2028+
project_id=project_id, project_name=project_name, source=source, request_options=request_options
2029+
)
2030+
return _response.data
2031+
19522032
async def update_span_comment(
19532033
self,
19542034
comment_id: str,

0 commit comments

Comments
 (0)