Skip to content

Commit 27a157f

Browse files
Tweaks for llm APIs (#133)
* Tweaks for llm APIs * fix * fix
1 parent ad0919a commit 27a157f

13 files changed

+108
-327
lines changed

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.completions_sync(endpoint_name, prompts=["What is Deep Learning?"], max_new_tokens=10, temperature=0)
40+
output = client.completions_sync(endpoint_name, prompt="What is Deep Learning?", max_new_tokens=10, temperature=0)
4141
print(output)
4242
```

launch/api_client/model/completion_output.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ class MetaOapg:
3939
class properties:
4040
num_completion_tokens = schemas.IntSchema
4141
text = schemas.StrSchema
42-
num_prompt_tokens = schemas.IntSchema
4342
__annotations__ = {
4443
"num_completion_tokens": num_completion_tokens,
4544
"text": text,
46-
"num_prompt_tokens": num_prompt_tokens,
4745
}
4846

4947
num_completion_tokens: MetaOapg.properties.num_completion_tokens
@@ -59,12 +57,6 @@ def __getitem__(
5957
def __getitem__(self, name: typing_extensions.Literal["text"]) -> MetaOapg.properties.text:
6058
...
6159

62-
@typing.overload
63-
def __getitem__(
64-
self, name: typing_extensions.Literal["num_prompt_tokens"]
65-
) -> MetaOapg.properties.num_prompt_tokens:
66-
...
67-
6860
@typing.overload
6961
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema:
7062
...
@@ -75,7 +67,6 @@ def __getitem__(
7567
typing_extensions.Literal[
7668
"num_completion_tokens",
7769
"text",
78-
"num_prompt_tokens",
7970
],
8071
str,
8172
],
@@ -93,12 +84,6 @@ def get_item_oapg(
9384
def get_item_oapg(self, name: typing_extensions.Literal["text"]) -> MetaOapg.properties.text:
9485
...
9586

96-
@typing.overload
97-
def get_item_oapg(
98-
self, name: typing_extensions.Literal["num_prompt_tokens"]
99-
) -> typing.Union[MetaOapg.properties.num_prompt_tokens, schemas.Unset]:
100-
...
101-
10287
@typing.overload
10388
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]:
10489
...
@@ -109,7 +94,6 @@ def get_item_oapg(
10994
typing_extensions.Literal[
11095
"num_completion_tokens",
11196
"text",
112-
"num_prompt_tokens",
11397
],
11498
str,
11599
],
@@ -131,9 +115,6 @@ def __new__(
131115
MetaOapg.properties.text,
132116
str,
133117
],
134-
num_prompt_tokens: typing.Union[
135-
MetaOapg.properties.num_prompt_tokens, decimal.Decimal, int, schemas.Unset
136-
] = schemas.unset,
137118
_configuration: typing.Optional[schemas.Configuration] = None,
138119
**kwargs: typing.Union[
139120
schemas.AnyTypeSchema,
@@ -157,7 +138,6 @@ def __new__(
157138
*_args,
158139
num_completion_tokens=num_completion_tokens,
159140
text=text,
160-
num_prompt_tokens=num_prompt_tokens,
161141
_configuration=_configuration,
162142
**kwargs,
163143
)

launch/api_client/model/completion_output.pyi

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ class CompletionOutput(schemas.DictSchema):
3737
class properties:
3838
num_completion_tokens = schemas.IntSchema
3939
text = schemas.StrSchema
40-
num_prompt_tokens = schemas.IntSchema
4140
__annotations__ = {
4241
"num_completion_tokens": num_completion_tokens,
4342
"text": text,
44-
"num_prompt_tokens": num_prompt_tokens,
4543
}
4644
num_completion_tokens: MetaOapg.properties.num_completion_tokens
4745
text: MetaOapg.properties.text
@@ -53,18 +51,13 @@ class CompletionOutput(schemas.DictSchema):
5351
@typing.overload
5452
def __getitem__(self, name: typing_extensions.Literal["text"]) -> MetaOapg.properties.text: ...
5553
@typing.overload
56-
def __getitem__(
57-
self, name: typing_extensions.Literal["num_prompt_tokens"]
58-
) -> MetaOapg.properties.num_prompt_tokens: ...
59-
@typing.overload
6054
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
6155
def __getitem__(
6256
self,
6357
name: typing.Union[
6458
typing_extensions.Literal[
6559
"num_completion_tokens",
6660
"text",
67-
"num_prompt_tokens",
6861
],
6962
str,
7063
],
@@ -78,18 +71,13 @@ class CompletionOutput(schemas.DictSchema):
7871
@typing.overload
7972
def get_item_oapg(self, name: typing_extensions.Literal["text"]) -> MetaOapg.properties.text: ...
8073
@typing.overload
81-
def get_item_oapg(
82-
self, name: typing_extensions.Literal["num_prompt_tokens"]
83-
) -> typing.Union[MetaOapg.properties.num_prompt_tokens, schemas.Unset]: ...
84-
@typing.overload
8574
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
8675
def get_item_oapg(
8776
self,
8877
name: typing.Union[
8978
typing_extensions.Literal[
9079
"num_completion_tokens",
9180
"text",
92-
"num_prompt_tokens",
9381
],
9482
str,
9583
],
@@ -110,9 +98,6 @@ class CompletionOutput(schemas.DictSchema):
11098
MetaOapg.properties.text,
11199
str,
112100
],
113-
num_prompt_tokens: typing.Union[
114-
MetaOapg.properties.num_prompt_tokens, decimal.Decimal, int, schemas.Unset
115-
] = schemas.unset,
116101
_configuration: typing.Optional[schemas.Configuration] = None,
117102
**kwargs: typing.Union[
118103
schemas.AnyTypeSchema,
@@ -136,7 +121,6 @@ class CompletionOutput(schemas.DictSchema):
136121
*_args,
137122
num_completion_tokens=num_completion_tokens,
138123
text=text,
139-
num_prompt_tokens=num_prompt_tokens,
140124
_configuration=_configuration,
141125
**kwargs,
142126
)

launch/api_client/model/completion_stream_output.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ class properties:
4040
finished = schemas.BoolSchema
4141
text = schemas.StrSchema
4242
num_completion_tokens = schemas.IntSchema
43-
num_prompt_tokens = schemas.IntSchema
4443
__annotations__ = {
4544
"finished": finished,
4645
"text": text,
4746
"num_completion_tokens": num_completion_tokens,
48-
"num_prompt_tokens": num_prompt_tokens,
4947
}
5048

5149
finished: MetaOapg.properties.finished
@@ -65,12 +63,6 @@ def __getitem__(
6563
) -> MetaOapg.properties.num_completion_tokens:
6664
...
6765

68-
@typing.overload
69-
def __getitem__(
70-
self, name: typing_extensions.Literal["num_prompt_tokens"]
71-
) -> MetaOapg.properties.num_prompt_tokens:
72-
...
73-
7466
@typing.overload
7567
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema:
7668
...
@@ -82,7 +74,6 @@ def __getitem__(
8274
"finished",
8375
"text",
8476
"num_completion_tokens",
85-
"num_prompt_tokens",
8677
],
8778
str,
8879
],
@@ -104,12 +95,6 @@ def get_item_oapg(
10495
) -> typing.Union[MetaOapg.properties.num_completion_tokens, schemas.Unset]:
10596
...
10697

107-
@typing.overload
108-
def get_item_oapg(
109-
self, name: typing_extensions.Literal["num_prompt_tokens"]
110-
) -> typing.Union[MetaOapg.properties.num_prompt_tokens, schemas.Unset]:
111-
...
112-
11398
@typing.overload
11499
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]:
115100
...
@@ -121,7 +106,6 @@ def get_item_oapg(
121106
"finished",
122107
"text",
123108
"num_completion_tokens",
124-
"num_prompt_tokens",
125109
],
126110
str,
127111
],
@@ -145,9 +129,6 @@ def __new__(
145129
num_completion_tokens: typing.Union[
146130
MetaOapg.properties.num_completion_tokens, decimal.Decimal, int, schemas.Unset
147131
] = schemas.unset,
148-
num_prompt_tokens: typing.Union[
149-
MetaOapg.properties.num_prompt_tokens, decimal.Decimal, int, schemas.Unset
150-
] = schemas.unset,
151132
_configuration: typing.Optional[schemas.Configuration] = None,
152133
**kwargs: typing.Union[
153134
schemas.AnyTypeSchema,
@@ -172,7 +153,6 @@ def __new__(
172153
finished=finished,
173154
text=text,
174155
num_completion_tokens=num_completion_tokens,
175-
num_prompt_tokens=num_prompt_tokens,
176156
_configuration=_configuration,
177157
**kwargs,
178158
)

launch/api_client/model/completion_stream_output.pyi

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ class CompletionStreamOutput(schemas.DictSchema):
3838
finished = schemas.BoolSchema
3939
text = schemas.StrSchema
4040
num_completion_tokens = schemas.IntSchema
41-
num_prompt_tokens = schemas.IntSchema
4241
__annotations__ = {
4342
"finished": finished,
4443
"text": text,
4544
"num_completion_tokens": num_completion_tokens,
46-
"num_prompt_tokens": num_prompt_tokens,
4745
}
4846
finished: MetaOapg.properties.finished
4947
text: MetaOapg.properties.text
@@ -57,10 +55,6 @@ class CompletionStreamOutput(schemas.DictSchema):
5755
self, name: typing_extensions.Literal["num_completion_tokens"]
5856
) -> MetaOapg.properties.num_completion_tokens: ...
5957
@typing.overload
60-
def __getitem__(
61-
self, name: typing_extensions.Literal["num_prompt_tokens"]
62-
) -> MetaOapg.properties.num_prompt_tokens: ...
63-
@typing.overload
6458
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
6559
def __getitem__(
6660
self,
@@ -69,7 +63,6 @@ class CompletionStreamOutput(schemas.DictSchema):
6963
"finished",
7064
"text",
7165
"num_completion_tokens",
72-
"num_prompt_tokens",
7366
],
7467
str,
7568
],
@@ -85,10 +78,6 @@ class CompletionStreamOutput(schemas.DictSchema):
8578
self, name: typing_extensions.Literal["num_completion_tokens"]
8679
) -> typing.Union[MetaOapg.properties.num_completion_tokens, schemas.Unset]: ...
8780
@typing.overload
88-
def get_item_oapg(
89-
self, name: typing_extensions.Literal["num_prompt_tokens"]
90-
) -> typing.Union[MetaOapg.properties.num_prompt_tokens, schemas.Unset]: ...
91-
@typing.overload
9281
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
9382
def get_item_oapg(
9483
self,
@@ -97,7 +86,6 @@ class CompletionStreamOutput(schemas.DictSchema):
9786
"finished",
9887
"text",
9988
"num_completion_tokens",
100-
"num_prompt_tokens",
10189
],
10290
str,
10391
],
@@ -120,9 +108,6 @@ class CompletionStreamOutput(schemas.DictSchema):
120108
num_completion_tokens: typing.Union[
121109
MetaOapg.properties.num_completion_tokens, decimal.Decimal, int, schemas.Unset
122110
] = schemas.unset,
123-
num_prompt_tokens: typing.Union[
124-
MetaOapg.properties.num_prompt_tokens, decimal.Decimal, int, schemas.Unset
125-
] = schemas.unset,
126111
_configuration: typing.Optional[schemas.Configuration] = None,
127112
**kwargs: typing.Union[
128113
schemas.AnyTypeSchema,
@@ -147,7 +132,6 @@ class CompletionStreamOutput(schemas.DictSchema):
147132
finished=finished,
148133
text=text,
149134
num_completion_tokens=num_completion_tokens,
150-
num_prompt_tokens=num_prompt_tokens,
151135
_configuration=_configuration,
152136
**kwargs,
153137
)

0 commit comments

Comments
 (0)