Skip to content

Commit

Permalink
OPIK-844 Autogenerated code (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisTkachenko authored Jan 27, 2025
1 parent 0fd113e commit 0d7606c
Show file tree
Hide file tree
Showing 85 changed files with 3,429 additions and 171 deletions.
443 changes: 424 additions & 19 deletions apps/opik-documentation/documentation/rest_api/opik.yaml

Large diffs are not rendered by default.

443 changes: 424 additions & 19 deletions sdks/code_generation/fern/openapi/openapi.yaml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions sdks/python/src/opik/rest_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
ColumnPublic,
ColumnPublicTypesItem,
ColumnTypesItem,
Comment,
CommentCompare,
CommentPublic,
CompletionTokensDetails,
CountValueStatPublic,
DataPointNumberPublic,
Expand Down Expand Up @@ -126,6 +129,9 @@
LlmAsJudgeOutputSchemaType,
LlmAsJudgeOutputSchemaWrite,
LlmAsJudgeOutputSchemaWriteType,
LogItem,
LogItemLevel,
LogPage,
Message,
NumericalFeedbackDefinition,
NumericalFeedbackDefinitionCreate,
Expand Down Expand Up @@ -266,6 +272,9 @@
"ColumnPublic",
"ColumnPublicTypesItem",
"ColumnTypesItem",
"Comment",
"CommentCompare",
"CommentPublic",
"CompletionTokensDetails",
"ConflictError",
"CountValueStatPublic",
Expand Down Expand Up @@ -360,6 +369,9 @@
"LlmAsJudgeOutputSchemaType",
"LlmAsJudgeOutputSchemaWrite",
"LlmAsJudgeOutputSchemaWriteType",
"LogItem",
"LogItemLevel",
"LogPage",
"Message",
"NotFoundError",
"NotImplementedError",
Expand Down
133 changes: 133 additions & 0 deletions sdks/python/src/opik/rest_api/automation_rule_evaluators/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from ..core.serialization import convert_and_respect_annotation_metadata
from ..types.automation_rule_evaluator_public import AutomationRuleEvaluatorPublic
from ..types.llm_as_judge_code import LlmAsJudgeCode
from ..types.log_page import LogPage
from ..core.client_wrapper import AsyncClientWrapper

# this is used as the default value for optional parameters
Expand Down Expand Up @@ -351,6 +352,68 @@ def update_automation_rule_evaluator(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def get_evaluator_logs_by_id(
self,
project_id: str,
id: str,
*,
size: typing.Optional[int] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> LogPage:
"""
Get automation rule evaluator logs by id
Parameters
----------
project_id : str
id : str
size : typing.Optional[int]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
LogPage
Automation rule evaluator logs resource
Examples
--------
from Opik import OpikApi
client = OpikApi(
api_key="YOUR_API_KEY",
workspace_name="YOUR_WORKSPACE_NAME",
)
client.automation_rule_evaluators.get_evaluator_logs_by_id(
project_id="projectId",
id="id",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/private/automations/projects/{jsonable_encoder(project_id)}/evaluators/{jsonable_encoder(id)}/logs",
method="GET",
params={
"size": size,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
LogPage,
parse_obj_as(
type_=LogPage, # type: ignore
object_=_response.json(),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncAutomationRuleEvaluatorsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
Expand Down Expand Up @@ -722,3 +785,73 @@ async def main() -> None:
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get_evaluator_logs_by_id(
self,
project_id: str,
id: str,
*,
size: typing.Optional[int] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> LogPage:
"""
Get automation rule evaluator logs by id
Parameters
----------
project_id : str
id : str
size : typing.Optional[int]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
LogPage
Automation rule evaluator logs resource
Examples
--------
import asyncio
from Opik import AsyncOpikApi
client = AsyncOpikApi(
api_key="YOUR_API_KEY",
workspace_name="YOUR_WORKSPACE_NAME",
)
async def main() -> None:
await client.automation_rule_evaluators.get_evaluator_logs_by_id(
project_id="projectId",
id="id",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/private/automations/projects/{jsonable_encoder(project_id)}/evaluators/{jsonable_encoder(id)}/logs",
method="GET",
params={
"size": size,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
LogPage,
parse_obj_as(
type_=LogPage, # type: ignore
object_=_response.json(),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import typing

ProviderApiKeyWriteProvider = typing.Union[
typing.Literal["openai", "anthropic"], typing.Any
typing.Literal["openai", "anthropic", "gemini"], typing.Any
]
Loading

0 comments on commit 0d7606c

Please sign in to comment.