|
8 | 8 | from ..types.comment import Comment |
9 | 9 | from ..types.error_info import ErrorInfo |
10 | 10 | from ..types.error_info_write import ErrorInfoWrite |
| 11 | +from ..types.existence_response import ExistenceResponse |
11 | 12 | from ..types.feedback_score_batch_item import FeedbackScoreBatchItem |
12 | 13 | from ..types.feedback_score_names_public import FeedbackScoreNamesPublic |
13 | 14 | from ..types.feedback_score_source import FeedbackScoreSource |
@@ -937,6 +938,44 @@ def search_spans( |
937 | 938 | ) as r: |
938 | 939 | yield from r.data |
939 | 940 |
|
| 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 | + |
940 | 979 | def update_span_comment( |
941 | 980 | self, |
942 | 981 | comment_id: str, |
@@ -1949,6 +1988,47 @@ async def main() -> None: |
1949 | 1988 | async for data in r.data: |
1950 | 1989 | yield data |
1951 | 1990 |
|
| 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 | + |
1952 | 2032 | async def update_span_comment( |
1953 | 2033 | self, |
1954 | 2034 | comment_id: str, |
|
0 commit comments