Skip to content

Commit

Permalink
update openapi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
japdubengsub committed Nov 6, 2024
1 parent 35ed985 commit 22a431f
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 110 deletions.
46 changes: 34 additions & 12 deletions sdks/python/code_generation/fern/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ paths:
in: query
schema:
type: string
- name: sorting
in: query
schema:
type: string
responses:
"200":
description: Project resource
Expand Down Expand Up @@ -968,7 +972,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Prompt_Write'
$ref: '#/components/schemas/Prompt_Updatable'
responses:
"204":
description: No content
Expand Down Expand Up @@ -1012,20 +1016,14 @@ paths:
responses:
"204":
description: No content
/v1/private/prompts/{id}/versions/{versionId}:
/v1/private/prompts/versions/{versionId}:
get:
tags:
- Prompts
summary: Get prompt version by id
description: Get prompt version by id
operationId: getPromptVersionById
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- name: versionId
in: path
required: true
Expand Down Expand Up @@ -1080,7 +1078,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/PromptVersionPage_Public'
/v1/private/prompts/prompts/versions/retrieve:
/v1/private/prompts/versions/retrieve:
post:
tags:
- Prompts
Expand Down Expand Up @@ -2923,6 +2921,10 @@ components:
type: array
items:
$ref: '#/components/schemas/Project_Public'
sortableBy:
type: array
items:
type: string
Project_Public:
required:
- name
Expand Down Expand Up @@ -3014,8 +3016,10 @@ components:
format: uuid
readOnly: true
commit:
pattern: "^[a-zA-Z0-9]{8}$"
type: string
description: "version short unique identifier, generated if absent"
description: "version short unique identifier, generated if absent. it must\
\ be 8 characters long"
template:
type: string
variables:
Expand Down Expand Up @@ -3063,8 +3067,10 @@ components:
format: uuid
readOnly: true
commit:
pattern: "^[a-zA-Z0-9]{8}$"
type: string
description: "version short unique identifier, generated if absent"
description: "version short unique identifier, generated if absent. it must\
\ be 8 characters long"
template:
type: string
variables:
Expand Down Expand Up @@ -3151,6 +3157,8 @@ components:
items:
$ref: '#/components/schemas/PromptVersion_Public'
PromptVersion_Public:
required:
- template
type: object
properties:
id:
Expand All @@ -3162,8 +3170,12 @@ components:
format: uuid
readOnly: true
commit:
pattern: "^[a-zA-Z0-9]{8}$"
type: string
description: "version short unique identifier, generated if absent. it must\
\ be 8 characters long"
template:
type: string
description: "version short unique identifier, generated if absent"
created_at:
type: string
format: date-time
Expand Down Expand Up @@ -3227,6 +3239,16 @@ components:
type: string
commit:
type: string
Prompt_Updatable:
required:
- name
type: object
properties:
name:
type: string
description:
pattern: (?s)^\s*(\S.*\S|\S)\s*$
type: string
Span:
required:
- name
Expand Down
2 changes: 0 additions & 2 deletions sdks/python/src/opik/rest_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
PromptVersionDetail,
PromptVersionPagePublic,
PromptVersionPublic,
PromptWrite,
Span,
SpanBatch,
SpanPagePublic,
Expand Down Expand Up @@ -223,7 +222,6 @@
"PromptVersionDetail",
"PromptVersionPagePublic",
"PromptVersionPublic",
"PromptWrite",
"Span",
"SpanBatch",
"SpanPagePublic",
Expand Down
10 changes: 8 additions & 2 deletions sdks/python/src/opik/rest_api/projects/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def find_projects(
page: typing.Optional[int] = None,
size: typing.Optional[int] = None,
name: typing.Optional[str] = None,
sorting: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> ProjectPagePublic:
"""
Expand All @@ -41,6 +42,8 @@ def find_projects(
name : typing.Optional[str]
sorting : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -59,7 +62,7 @@ def find_projects(
_response = self._client_wrapper.httpx_client.request(
"v1/private/projects",
method="GET",
params={"page": page, "size": size, "name": name},
params={"page": page, "size": size, "name": name, "sorting": sorting},
request_options=request_options,
)
try:
Expand Down Expand Up @@ -277,6 +280,7 @@ async def find_projects(
page: typing.Optional[int] = None,
size: typing.Optional[int] = None,
name: typing.Optional[str] = None,
sorting: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> ProjectPagePublic:
"""
Expand All @@ -290,6 +294,8 @@ async def find_projects(
name : typing.Optional[str]
sorting : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -316,7 +322,7 @@ async def main() -> None:
_response = await self._client_wrapper.httpx_client.request(
"v1/private/projects",
method="GET",
params={"page": page, "size": size, "name": name},
params={"page": page, "size": size, "name": name, "sorting": sorting},
request_options=request_options,
)
try:
Expand Down
58 changes: 14 additions & 44 deletions sdks/python/src/opik/rest_api/prompts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,29 +253,23 @@ def get_prompt_by_id(

def update_prompt(
self,
id_: str,
id: str,
*,
name: str,
id: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
template: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
Update prompt
Parameters
----------
id_ : str
id : str
name : str
id : typing.Optional[str]
description : typing.Optional[str]
template : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -289,19 +283,14 @@ def update_prompt(
client = OpikApi()
client.prompts.update_prompt(
id_="id",
id="id",
name="name",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/private/prompts/{jsonable_encoder(id_)}",
f"v1/private/prompts/{jsonable_encoder(id)}",
method="PUT",
json={
"id": id,
"name": name,
"description": description,
"template": template,
},
json={"name": name, "description": description},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -370,7 +359,6 @@ def delete_prompt(

def get_prompt_version_by_id(
self,
id: str,
version_id: str,
*,
request_options: typing.Optional[RequestOptions] = None,
Expand All @@ -380,8 +368,6 @@ def get_prompt_version_by_id(
Parameters
----------
id : str
version_id : str
request_options : typing.Optional[RequestOptions]
Expand All @@ -398,12 +384,11 @@ def get_prompt_version_by_id(
client = OpikApi()
client.prompts.get_prompt_version_by_id(
id="id",
version_id="versionId",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/private/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}",
f"v1/private/prompts/versions/{jsonable_encoder(version_id)}",
method="GET",
request_options=request_options,
)
Expand Down Expand Up @@ -505,7 +490,7 @@ def retrieve_prompt_version(
)
"""
_response = self._client_wrapper.httpx_client.request(
"v1/private/prompts/prompts/versions/retrieve",
"v1/private/prompts/versions/retrieve",
method="POST",
json={"name": name, "commit": commit},
request_options=request_options,
Expand Down Expand Up @@ -796,29 +781,23 @@ async def main() -> None:

async def update_prompt(
self,
id_: str,
id: str,
*,
name: str,
id: typing.Optional[str] = OMIT,
description: typing.Optional[str] = OMIT,
template: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
Update prompt
Parameters
----------
id_ : str
id : str
name : str
id : typing.Optional[str]
description : typing.Optional[str]
template : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -837,22 +816,17 @@ async def update_prompt(
async def main() -> None:
await client.prompts.update_prompt(
id_="id",
id="id",
name="name",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/private/prompts/{jsonable_encoder(id_)}",
f"v1/private/prompts/{jsonable_encoder(id)}",
method="PUT",
json={
"id": id,
"name": name,
"description": description,
"template": template,
},
json={"name": name, "description": description},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -929,7 +903,6 @@ async def main() -> None:

async def get_prompt_version_by_id(
self,
id: str,
version_id: str,
*,
request_options: typing.Optional[RequestOptions] = None,
Expand All @@ -939,8 +912,6 @@ async def get_prompt_version_by_id(
Parameters
----------
id : str
version_id : str
request_options : typing.Optional[RequestOptions]
Expand All @@ -962,15 +933,14 @@ async def get_prompt_version_by_id(
async def main() -> None:
await client.prompts.get_prompt_version_by_id(
id="id",
version_id="versionId",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/private/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}",
f"v1/private/prompts/versions/{jsonable_encoder(version_id)}",
method="GET",
request_options=request_options,
)
Expand Down Expand Up @@ -1088,7 +1058,7 @@ async def main() -> None:
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/private/prompts/prompts/versions/retrieve",
"v1/private/prompts/versions/retrieve",
method="POST",
json={"name": name, "commit": commit},
request_options=request_options,
Expand Down
Loading

0 comments on commit 22a431f

Please sign in to comment.