Skip to content

Commit 5c8cb36

Browse files
Completions endpoint rename (#124)
* Completions endpoint rename * remove files * black * isort * unit tests
1 parent b173bcd commit 5c8cb36

119 files changed

Lines changed: 2480 additions & 731 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/llms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ client.create_llm_model_endpoint(
3737

3838
# Wait for the endpoint to be ready
3939

40-
output = client.completion_sync(endpoint_name, prompts=["What is Deep Learning?"], max_new_tokens=10, temperature=0)
40+
output = client.completions_sync(endpoint_name, prompts=["What is Deep Learning?"], max_new_tokens=10, temperature=0)
4141
print(output)
4242
```

launch/api_client/api_client.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,7 @@ def serialize(
659659
cast_in_data = self._json_encoder.default(cast_in_data)
660660
if self._content_type_is_json(content_type):
661661
value = self._serialize_json(cast_in_data, eliminate_whitespace=True)
662-
return self._to_dict(
663-
self.name,
664-
next(prefix_separator_iterator) + self.name + "=" + quote(value),
665-
)
662+
return self._to_dict(self.name, next(prefix_separator_iterator) + self.name + "=" + quote(value))
666663
raise NotImplementedError("Serialization of {} has not yet been implemented".format(content_type))
667664

668665

@@ -888,9 +885,7 @@ def __deserialize_json(response: urllib3.HTTPResponse) -> typing.Any:
888885
return json.loads(response.data)
889886

890887
@staticmethod
891-
def __file_name_from_response_url(
892-
response_url: typing.Optional[str],
893-
) -> typing.Optional[str]:
888+
def __file_name_from_response_url(response_url: typing.Optional[str]) -> typing.Optional[str]:
894889
if response_url is None:
895890
return None
896891
url_path = urlparse(response_url).path
@@ -1212,39 +1207,15 @@ def request(
12121207
return self.rest_client.HEAD(url, stream=stream, timeout=timeout, headers=headers)
12131208
elif method == "OPTIONS":
12141209
return self.rest_client.OPTIONS(
1215-
url,
1216-
headers=headers,
1217-
fields=fields,
1218-
stream=stream,
1219-
timeout=timeout,
1220-
body=body,
1210+
url, headers=headers, fields=fields, stream=stream, timeout=timeout, body=body
12211211
)
12221212
elif method == "POST":
1223-
return self.rest_client.POST(
1224-
url,
1225-
headers=headers,
1226-
fields=fields,
1227-
stream=stream,
1228-
timeout=timeout,
1229-
body=body,
1230-
)
1213+
return self.rest_client.POST(url, headers=headers, fields=fields, stream=stream, timeout=timeout, body=body)
12311214
elif method == "PUT":
1232-
return self.rest_client.PUT(
1233-
url,
1234-
headers=headers,
1235-
fields=fields,
1236-
stream=stream,
1237-
timeout=timeout,
1238-
body=body,
1239-
)
1215+
return self.rest_client.PUT(url, headers=headers, fields=fields, stream=stream, timeout=timeout, body=body)
12401216
elif method == "PATCH":
12411217
return self.rest_client.PATCH(
1242-
url,
1243-
headers=headers,
1244-
fields=fields,
1245-
stream=stream,
1246-
timeout=timeout,
1247-
body=body,
1218+
url, headers=headers, fields=fields, stream=stream, timeout=timeout, body=body
12481219
)
12491220
elif method == "DELETE":
12501221
return self.rest_client.DELETE(url, headers=headers, stream=stream, timeout=timeout, body=body)
@@ -1297,8 +1268,7 @@ def __init__(self, api_client: typing.Optional[ApiClient] = None):
12971268

12981269
@staticmethod
12991270
def _verify_typed_dict_inputs_oapg(
1300-
cls: typing.Type[typing_extensions.TypedDict],
1301-
data: typing.Dict[str, typing.Any],
1271+
cls: typing.Type[typing_extensions.TypedDict], data: typing.Dict[str, typing.Any]
13021272
):
13031273
"""
13041274
Ensures that:
@@ -1339,9 +1309,7 @@ def _verify_typed_dict_inputs_oapg(
13391309
if disallowed_additional_keys:
13401310
raise ApiTypeError(
13411311
"{} got {} unexpected keyword arguments: {}".format(
1342-
cls.__name__,
1343-
len(disallowed_additional_keys),
1344-
disallowed_additional_keys,
1312+
cls.__name__, len(disallowed_additional_keys), disallowed_additional_keys
13451313
)
13461314
)
13471315

launch/api_client/apis/path_to_api.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@
2626
from launch.api_client.apis.paths.v1_docker_image_batch_jobs_batch_job_id import (
2727
V1DockerImageBatchJobsBatchJobId,
2828
)
29-
from launch.api_client.apis.paths.v1_llm_completion_sync import (
30-
V1LlmCompletionSync,
29+
from launch.api_client.apis.paths.v1_llm_completions_stream import (
30+
V1LlmCompletionsStream,
31+
)
32+
from launch.api_client.apis.paths.v1_llm_completions_sync import (
33+
V1LlmCompletionsSync,
3134
)
3235
from launch.api_client.apis.paths.v1_llm_model_endpoints import (
3336
V1LlmModelEndpoints,
3437
)
38+
from launch.api_client.apis.paths.v1_llm_model_endpoints_model_endpoint_name import (
39+
V1LlmModelEndpointsModelEndpointName,
40+
)
3541
from launch.api_client.apis.paths.v1_model_bundles import V1ModelBundles
3642
from launch.api_client.apis.paths.v1_model_bundles_clone_with_changes import (
3743
V1ModelBundlesCloneWithChanges,
@@ -81,8 +87,10 @@
8187
PathValues.V1_DOCKERIMAGEBATCHJOBBUNDLES_DOCKER_IMAGE_BATCH_JOB_BUNDLE_ID: V1DockerImageBatchJobBundlesDockerImageBatchJobBundleId,
8288
PathValues.V1_DOCKERIMAGEBATCHJOBS: V1DockerImageBatchJobs,
8389
PathValues.V1_DOCKERIMAGEBATCHJOBS_BATCH_JOB_ID: V1DockerImageBatchJobsBatchJobId,
84-
PathValues.V1_LLM_COMPLETIONSYNC: V1LlmCompletionSync,
90+
PathValues.V1_LLM_COMPLETIONSSTREAM: V1LlmCompletionsStream,
91+
PathValues.V1_LLM_COMPLETIONSSYNC: V1LlmCompletionsSync,
8592
PathValues.V1_LLM_MODELENDPOINTS: V1LlmModelEndpoints,
93+
PathValues.V1_LLM_MODELENDPOINTS_MODEL_ENDPOINT_NAME: V1LlmModelEndpointsModelEndpointName,
8694
PathValues.V1_MODELBUNDLES: V1ModelBundles,
8795
PathValues.V1_MODELBUNDLES_CLONEWITHCHANGES: V1ModelBundlesCloneWithChanges,
8896
PathValues.V1_MODELBUNDLES_LATEST: V1ModelBundlesLatest,
@@ -114,8 +122,10 @@
114122
PathValues.V1_DOCKERIMAGEBATCHJOBBUNDLES_DOCKER_IMAGE_BATCH_JOB_BUNDLE_ID: V1DockerImageBatchJobBundlesDockerImageBatchJobBundleId,
115123
PathValues.V1_DOCKERIMAGEBATCHJOBS: V1DockerImageBatchJobs,
116124
PathValues.V1_DOCKERIMAGEBATCHJOBS_BATCH_JOB_ID: V1DockerImageBatchJobsBatchJobId,
117-
PathValues.V1_LLM_COMPLETIONSYNC: V1LlmCompletionSync,
125+
PathValues.V1_LLM_COMPLETIONSSTREAM: V1LlmCompletionsStream,
126+
PathValues.V1_LLM_COMPLETIONSSYNC: V1LlmCompletionsSync,
118127
PathValues.V1_LLM_MODELENDPOINTS: V1LlmModelEndpoints,
128+
PathValues.V1_LLM_MODELENDPOINTS_MODEL_ENDPOINT_NAME: V1LlmModelEndpointsModelEndpointName,
119129
PathValues.V1_MODELBUNDLES: V1ModelBundles,
120130
PathValues.V1_MODELBUNDLES_CLONEWITHCHANGES: V1ModelBundlesCloneWithChanges,
121131
PathValues.V1_MODELBUNDLES_LATEST: V1ModelBundlesLatest,

launch/api_client/apis/paths/v1_llm_completion_sync.py

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from launch.api_client.paths.v1_llm_completions_stream.post import ApiForpost
2+
3+
4+
class V1LlmCompletionsStream(
5+
ApiForpost,
6+
):
7+
pass
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from launch.api_client.paths.v1_llm_completions_sync.post import ApiForpost
2+
3+
4+
class V1LlmCompletionsSync(
5+
ApiForpost,
6+
):
7+
pass
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from launch.api_client.paths.v1_llm_model_endpoints_model_endpoint_name.get import (
2+
ApiForget,
3+
)
4+
5+
6+
class V1LlmModelEndpointsModelEndpointName(
7+
ApiForget,
8+
):
9+
pass

launch/api_client/apis/tags/default_api.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,21 @@
4848
from launch.api_client.paths.v1_docker_image_batch_jobs_batch_job_id.put import (
4949
UpdateDockerImageBatchJobV1DockerImageBatchJobsBatchJobIdPut,
5050
)
51-
from launch.api_client.paths.v1_llm_completion_sync.post import (
52-
CreateCompletionSyncTaskV1LlmCompletionSyncPost,
51+
from launch.api_client.paths.v1_llm_completions_stream.post import (
52+
CreateCompletionStreamTaskV1LlmCompletionsStreamPost,
53+
)
54+
from launch.api_client.paths.v1_llm_completions_sync.post import (
55+
CreateCompletionSyncTaskV1LlmCompletionsSyncPost,
5356
)
5457
from launch.api_client.paths.v1_llm_model_endpoints.get import (
5558
ListModelEndpointsV1LlmModelEndpointsGet,
5659
)
5760
from launch.api_client.paths.v1_llm_model_endpoints.post import (
5861
CreateModelEndpointV1LlmModelEndpointsPost,
5962
)
63+
from launch.api_client.paths.v1_llm_model_endpoints_model_endpoint_name.get import (
64+
GetModelEndpointV1LlmModelEndpointsModelEndpointNameGet,
65+
)
6066
from launch.api_client.paths.v1_model_bundles.get import (
6167
ListModelBundlesV1ModelBundlesGet,
6268
)
@@ -121,7 +127,8 @@ class DefaultApi(
121127
CloneModelBundleWithChangesV2ModelBundlesCloneWithChangesPost,
122128
CreateAsyncInferenceTaskV1AsyncTasksPost,
123129
CreateBatchJobV1BatchJobsPost,
124-
CreateCompletionSyncTaskV1LlmCompletionSyncPost,
130+
CreateCompletionStreamTaskV1LlmCompletionsStreamPost,
131+
CreateCompletionSyncTaskV1LlmCompletionsSyncPost,
125132
CreateDockerImageBatchJobBundleV1DockerImageBatchJobBundlesPost,
126133
CreateDockerImageBatchJobV1DockerImageBatchJobsPost,
127134
CreateModelBundleV1ModelBundlesPost,
@@ -140,6 +147,7 @@ class DefaultApi(
140147
GetLatestModelBundleV2ModelBundlesLatestGet,
141148
GetModelBundleV1ModelBundlesModelBundleIdGet,
142149
GetModelBundleV2ModelBundlesModelBundleIdGet,
150+
GetModelEndpointV1LlmModelEndpointsModelEndpointNameGet,
143151
GetModelEndpointV1ModelEndpointsModelEndpointIdGet,
144152
GetModelEndpointsApiV1ModelEndpointsApiGet,
145153
GetModelEndpointsSchemaV1ModelEndpointsSchemaJsonGet,

launch/api_client/model/clone_model_bundle_v1_request.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ def __new__(
113113
str,
114114
],
115115
new_app_config: typing.Union[
116-
MetaOapg.properties.new_app_config,
117-
dict,
118-
frozendict.frozendict,
119-
schemas.Unset,
116+
MetaOapg.properties.new_app_config, dict, frozendict.frozendict, schemas.Unset
120117
] = schemas.unset,
121118
_configuration: typing.Optional[schemas.Configuration] = None,
122119
**kwargs: typing.Union[

launch/api_client/model/clone_model_bundle_v1_request.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ class CloneModelBundleV1Request(schemas.DictSchema):
9696
str,
9797
],
9898
new_app_config: typing.Union[
99-
MetaOapg.properties.new_app_config,
100-
dict,
101-
frozendict.frozendict,
102-
schemas.Unset,
99+
MetaOapg.properties.new_app_config, dict, frozendict.frozendict, schemas.Unset
103100
] = schemas.unset,
104101
_configuration: typing.Optional[schemas.Configuration] = None,
105102
**kwargs: typing.Union[

0 commit comments

Comments
 (0)