Skip to content

Commit 71d3b09

Browse files
committed
Updating Request Type
1 parent a6457ba commit 71d3b09

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

llama_cpp/server/types.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import List, Optional, Union, Dict
3+
from typing import List, Optional, Union, Dict, Any
44
from typing_extensions import TypedDict, Literal
55

66
from pydantic import BaseModel, Field
@@ -54,6 +54,11 @@
5454
description="Whether to stream the results as they are generated. Useful for chatbots.",
5555
)
5656

57+
include_usage = Field(
58+
default=False,
59+
description="If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value.",
60+
)
61+
5762
top_k_field = Field(
5863
default=40,
5964
ge=0,
@@ -127,6 +132,12 @@ class CreateCompletionRequest(BaseModel):
127132
)
128133
stop: Optional[Union[str, List[str]]] = stop_field
129134
stream: bool = stream_field
135+
136+
stream_options: Optional[Dict[str, Any]] = Field(
137+
default=None,
138+
description="Options for streaming response. Only set this when you set stream: true.",
139+
)
140+
130141
logprobs: Optional[int] = Field(
131142
default=None,
132143
ge=0,
@@ -216,7 +227,7 @@ class CreateChatCompletionRequest(BaseModel):
216227
min_tokens: int = min_tokens_field
217228
logprobs: Optional[bool] = Field(
218229
default=False,
219-
description="Whether to output the logprobs or not. Default is True"
230+
description="Whether to output the logprobs or not. Default is True",
220231
)
221232
top_logprobs: Optional[int] = Field(
222233
default=None,
@@ -228,6 +239,10 @@ class CreateChatCompletionRequest(BaseModel):
228239
min_p: float = min_p_field
229240
stop: Optional[Union[str, List[str]]] = stop_field
230241
stream: bool = stream_field
242+
stream_options: Optional[Dict[str, Any]] = Field(
243+
default=None,
244+
description="Options for streaming response. Only set this when you set stream: true.",
245+
)
231246
presence_penalty: Optional[float] = presence_penalty_field
232247
frequency_penalty: Optional[float] = frequency_penalty_field
233248
logit_bias: Optional[Dict[str, float]] = Field(None)

0 commit comments

Comments
 (0)