diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index dd6773c7c..9b3aaf382 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -10,20 +10,20 @@ errors: status-code: 501 type: unknown docs: KPI depends on other KPIs - not implemented - InternalServerError: - status-code: 500 - type: unknown - docs: Predicting error - examples: - - value: Server responded with an error. BadRequestError: status-code: 400 type: unknown - docs: Bad Request + docs: '' examples: - - value: string - value: key: value + - value: string + InternalServerError: + status-code: 500 + type: unknown + docs: Predicting error + examples: + - value: Server responded with an error. ForbiddenError: status-code: 403 type: unknown @@ -5455,6 +5455,67 @@ types: results: list source: openapi: openapi/openapi.yaml + PaginatedPaginatedProjectMemberList: + properties: + count: integer + next: + type: optional + validation: + format: uri + previous: + type: optional + validation: + format: uri + results: list + source: + openapi: openapi/openapi.yaml + PaginatedProjectMember: + docs: |- + A ModelSerializer that takes additional arguments for + "fields", "omit" and "expand" in order to + control which fields are displayed, and whether to replace simple + values with complex, nested serializations + properties: + active_organization: optional + active_organization_meta: string + allow_newsletters: + type: optional + docs: Allow sending newsletters to user + avatar: string + custom_hotkeys: optional + date_joined: optional + email: + type: optional + validation: + format: email + maxLength: 254 + first_name: + type: optional + validation: + maxLength: 256 + id: integer + initials: + type: string + default: '?' + last_activity: datetime + last_name: + type: optional + validation: + maxLength: 256 + lse_fields: LseFields + org_membership: list + pause: string + phone: + type: optional + validation: + maxLength: 256 + project_role: string + username: + type: string + validation: + maxLength: 256 + source: + openapi: openapi/openapi.yaml PaginatedRoleBasedTaskList: properties: tasks: list diff --git a/.mock/definition/llm.yml b/.mock/definition/llm.yml index f638e662d..160253296 100644 --- a/.mock/definition/llm.yml +++ b/.mock/definition/llm.yml @@ -1,3 +1,26 @@ +types: + ApiLlmOpenaiChatCompletionsCreateRequestMessagesItemRole: + enum: + - system + - user + - assistant + docs: The role of the message author + inline: true + source: + openapi: openapi/openapi.yaml + ApiLlmOpenaiChatCompletionsCreateRequestMessagesItem: + properties: + content: + type: string + docs: The content of the message + role: + type: ApiLlmOpenaiChatCompletionsCreateRequestMessagesItemRole + docs: The role of the message author + source: + openapi: openapi/openapi.yaml + inline: true +imports: + root: __package__.yml service: auth: false base-path: '' @@ -7,20 +30,38 @@ service: method: POST auth: true docs: >- - Proxy requests to OpenAI /chat/completions and return the full response - payload. + Proxy requests to OpenAI-compatible chat completions APIs and return the + full response payload. Supports multiple providers via model parameter + format: "model_name" (defaults to OpenAI), "provider/model_name", or + "provider:model_name". Works with providers that offer OpenAI-compatible + endpoints. source: openapi: openapi/openapi.yaml - display-name: Proxy to OpenAI Chat Completions + display-name: Proxy to OpenAI-Compatible Chat Completions request: - body: map + name: ApiLlmOpenaiChatCompletionsCreateRequest + body: + properties: + messages: + docs: Array of message objects for the chat completion + type: list + model: + type: string + docs: >- + Model identifier. Can be "model_name" (defaults to OpenAI), + "provider/model_name", or "provider:model_name" content-type: application/json response: docs: '' - type: map + type: unknown + errors: + - root.BadRequestError examples: - request: - key: value + messages: + - content: content + role: system + model: gpt-4 response: body: key: value diff --git a/.mock/definition/projects/members/paginated.yml b/.mock/definition/projects/members/paginated.yml index 19e53e7b6..0e94dad81 100644 --- a/.mock/definition/projects/members/paginated.yml +++ b/.mock/definition/projects/members/paginated.yml @@ -45,7 +45,7 @@ service: docs: Include deleted members in the results response: docs: '' - type: root.PaginatedLseUserList + type: root.PaginatedPaginatedProjectMemberList examples: - path-parameters: id: 1 @@ -78,6 +78,7 @@ service: role: role pause: pause phone: phone + project_role: project_role username: username audiences: - public diff --git a/.mock/openapi/openapi.yaml b/.mock/openapi/openapi.yaml index 7f61caabb..20546dde3 100644 --- a/.mock/openapi/openapi.yaml +++ b/.mock/openapi/openapi.yaml @@ -4257,33 +4257,113 @@ paths: x-fern-sdk-method-name: update /api/llm/openai/chat/completions: post: - description: Proxy requests to OpenAI /chat/completions and return the full response payload. + description: 'Proxy requests to OpenAI-compatible chat completions APIs and return the full response payload. Supports multiple providers via model parameter format: "model_name" (defaults to OpenAI), "provider/model_name", or "provider:model_name". Works with providers that offer OpenAI-compatible endpoints.' operationId: api_llm_openai_chat_completions_create requestBody: content: application/json: schema: - additionalProperties: {} - type: object - application/x-www-form-urlencoded: - schema: - additionalProperties: {} - type: object - multipart/form-data: - schema: - additionalProperties: {} + properties: + messages: + description: Array of message objects for the chat completion + items: + properties: + content: + description: The content of the message + type: string + role: + description: The role of the message author + enum: + - system + - user + - assistant + type: string + required: + - role + - content + type: object + type: array + model: + description: Model identifier. Can be "model_name" (defaults to OpenAI), "provider/model_name", or "provider:model_name" + example: gpt-4 + type: string + required: + - model + - messages type: object responses: '200': content: application/json: schema: - additionalProperties: {} - type: object + content: + application/json: + properties: + choices: + description: Array of completion choices + items: + properties: + finish_reason: + description: The reason the completion finished + type: string + index: + description: The index of the choice + type: integer + message: + properties: + content: + description: The content of the message + type: string + role: + description: The role of the message author + type: string + type: object + type: object + type: array + created: + description: Unix timestamp of when the completion was created + type: integer + id: + description: Unique identifier for the chat completion + type: string + model: + description: The model used for the completion + type: string + object: + description: Object type, always "chat.completion" + type: string + usage: + description: Token usage statistics + properties: + completion_tokens: + description: Number of tokens in the completion + type: integer + prompt_tokens: + description: Number of tokens in the prompt + type: integer + total_tokens: + description: Total number of tokens used + type: integer + type: object + type: object + description: Chat completion response + description: '' + '400': + content: + application/json: + schema: + content: + application/json: + properties: + detail: + description: Error message describing the issue + type: string + type: object + description: Bad request - missing required fields or invalid provider description: '' security: - Token: [] - summary: Proxy to OpenAI Chat Completions + summary: Proxy to OpenAI-Compatible Chat Completions tags: - LLM x-fern-audiences: @@ -7423,7 +7503,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PaginatedLseUserList' + $ref: '#/components/schemas/PaginatedPaginatedProjectMemberList' description: '' security: - Token: [] @@ -23599,6 +23679,110 @@ components: - count - results type: object + PaginatedPaginatedProjectMemberList: + properties: + count: + example: 123 + type: integer + next: + example: http://api.example.org/accounts/?page=4 + format: uri + nullable: true + type: string + previous: + example: http://api.example.org/accounts/?page=2 + format: uri + nullable: true + type: string + results: + items: + $ref: '#/components/schemas/PaginatedProjectMember' + type: array + required: + - count + - results + type: object + PaginatedProjectMember: + description: |- + A ModelSerializer that takes additional arguments for + "fields", "omit" and "expand" in order to + control which fields are displayed, and whether to replace simple + values with complex, nested serializations + properties: + active_organization: + nullable: true + type: integer + active_organization_meta: + readOnly: true + type: string + allow_newsletters: + description: Allow sending newsletters to user + nullable: true + type: boolean + avatar: + readOnly: true + type: string + custom_hotkeys: + description: Custom keyboard shortcuts configuration for the user interface + nullable: true + date_joined: + format: date-time + type: string + email: + format: email + maxLength: 254 + title: Email address + type: string + first_name: + maxLength: 256 + type: string + id: + readOnly: true + type: integer + initials: + default: '?' + readOnly: true + type: string + last_activity: + format: date-time + readOnly: true + type: string + last_name: + maxLength: 256 + type: string + lse_fields: + allOf: + - $ref: '#/components/schemas/LseFields' + readOnly: true + org_membership: + items: + $ref: '#/components/schemas/OrganizationMembership' + readOnly: true + type: array + pause: + readOnly: true + type: string + phone: + maxLength: 256 + type: string + project_role: + readOnly: true + type: string + username: + maxLength: 256 + type: string + required: + - active_organization_meta + - avatar + - id + - initials + - last_activity + - lse_fields + - org_membership + - pause + - project_role + - username + type: object PaginatedRoleBasedTaskList: properties: tasks: diff --git a/src/label_studio_sdk/__init__.py b/src/label_studio_sdk/__init__.py index e6c277865..753a8818e 100644 --- a/src/label_studio_sdk/__init__.py +++ b/src/label_studio_sdk/__init__.py @@ -121,6 +121,8 @@ PaginatedAllRolesProjectListList, PaginatedLseOrganizationMemberListList, PaginatedLseUserList, + PaginatedPaginatedProjectMemberList, + PaginatedProjectMember, PaginatedRoleBasedTaskList, Pause, PauseRequest, @@ -454,6 +456,8 @@ "PaginatedAllRolesProjectListList", "PaginatedLseOrganizationMemberListList", "PaginatedLseUserList", + "PaginatedPaginatedProjectMemberList", + "PaginatedProjectMember", "PaginatedRoleBasedTaskList", "PatchedLseProjectUpdateRequestSampling", "PatchedLseProjectUpdateRequestSkipQueue", diff --git a/src/label_studio_sdk/projects/members/paginated/client.py b/src/label_studio_sdk/projects/members/paginated/client.py index cae09da29..a395ff750 100644 --- a/src/label_studio_sdk/projects/members/paginated/client.py +++ b/src/label_studio_sdk/projects/members/paginated/client.py @@ -4,9 +4,9 @@ import typing from ....core.request_options import RequestOptions from ....core.pagination import SyncPager -from ....types.lse_user import LseUser +from ....types.paginated_project_member import PaginatedProjectMember from ....core.jsonable_encoder import jsonable_encoder -from ....types.paginated_lse_user_list import PaginatedLseUserList +from ....types.paginated_paginated_project_member_list import PaginatedPaginatedProjectMemberList from ....core.unchecked_base_model import construct_type from json.decoder import JSONDecodeError from ....core.api_error import ApiError @@ -30,7 +30,7 @@ def list( search: typing.Optional[str] = None, with_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> SyncPager[LseUser]: + ) -> SyncPager[PaginatedProjectMember]: """ Retrieve the members for a specific project. @@ -64,7 +64,7 @@ def list( Returns ------- - SyncPager[LseUser] + SyncPager[PaginatedProjectMember] Examples @@ -101,9 +101,9 @@ def list( try: if 200 <= _response.status_code < 300: _parsed_response = typing.cast( - PaginatedLseUserList, + PaginatedPaginatedProjectMemberList, construct_type( - type_=PaginatedLseUserList, # type: ignore + type_=PaginatedPaginatedProjectMemberList, # type: ignore object_=_response.json(), ), ) @@ -143,7 +143,7 @@ async def list( search: typing.Optional[str] = None, with_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncPager[LseUser]: + ) -> AsyncPager[PaginatedProjectMember]: """ Retrieve the members for a specific project. @@ -177,7 +177,7 @@ async def list( Returns ------- - AsyncPager[LseUser] + AsyncPager[PaginatedProjectMember] Examples @@ -222,9 +222,9 @@ async def main() -> None: try: if 200 <= _response.status_code < 300: _parsed_response = typing.cast( - PaginatedLseUserList, + PaginatedPaginatedProjectMemberList, construct_type( - type_=PaginatedLseUserList, # type: ignore + type_=PaginatedPaginatedProjectMemberList, # type: ignore object_=_response.json(), ), ) diff --git a/src/label_studio_sdk/types/__init__.py b/src/label_studio_sdk/types/__init__.py index 93fff20a5..5fe25a5f9 100644 --- a/src/label_studio_sdk/types/__init__.py +++ b/src/label_studio_sdk/types/__init__.py @@ -122,6 +122,8 @@ from .paginated_all_roles_project_list_list import PaginatedAllRolesProjectListList from .paginated_lse_organization_member_list_list import PaginatedLseOrganizationMemberListList from .paginated_lse_user_list import PaginatedLseUserList +from .paginated_paginated_project_member_list import PaginatedPaginatedProjectMemberList +from .paginated_project_member import PaginatedProjectMember from .paginated_role_based_task_list import PaginatedRoleBasedTaskList from .pause import Pause from .pause_request import PauseRequest @@ -315,6 +317,8 @@ "PaginatedAllRolesProjectListList", "PaginatedLseOrganizationMemberListList", "PaginatedLseUserList", + "PaginatedPaginatedProjectMemberList", + "PaginatedProjectMember", "PaginatedRoleBasedTaskList", "Pause", "PauseRequest", diff --git a/src/label_studio_sdk/types/paginated_paginated_project_member_list.py b/src/label_studio_sdk/types/paginated_paginated_project_member_list.py new file mode 100644 index 000000000..2ff968310 --- /dev/null +++ b/src/label_studio_sdk/types/paginated_paginated_project_member_list.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +from .paginated_project_member import PaginatedProjectMember +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class PaginatedPaginatedProjectMemberList(UncheckedBaseModel): + count: int + next: typing.Optional[str] = None + previous: typing.Optional[str] = None + results: typing.List[PaginatedProjectMember] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/label_studio_sdk/types/paginated_project_member.py b/src/label_studio_sdk/types/paginated_project_member.py new file mode 100644 index 000000000..aaa72a4ed --- /dev/null +++ b/src/label_studio_sdk/types/paginated_project_member.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import typing +import pydantic +import datetime as dt +from .lse_fields import LseFields +from .organization_membership import OrganizationMembership +from ..core.pydantic_utilities import IS_PYDANTIC_V2 + + +class PaginatedProjectMember(UncheckedBaseModel): + """ + A ModelSerializer that takes additional arguments for + "fields", "omit" and "expand" in order to + control which fields are displayed, and whether to replace simple + values with complex, nested serializations + """ + + active_organization: typing.Optional[int] = None + active_organization_meta: str + allow_newsletters: typing.Optional[bool] = pydantic.Field(default=None) + """ + Allow sending newsletters to user + """ + + avatar: str + custom_hotkeys: typing.Optional[typing.Optional[typing.Any]] = None + date_joined: typing.Optional[dt.datetime] = None + email: typing.Optional[str] = None + first_name: typing.Optional[str] = None + id: int + initials: str + last_activity: dt.datetime + last_name: typing.Optional[str] = None + lse_fields: LseFields + org_membership: typing.List[OrganizationMembership] + pause: str + phone: typing.Optional[str] = None + project_role: str + username: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow