Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e40fcb0

Browse filesBrowse files
committed
llama_cpp server: mark model as required
`model` is ignored, but currently marked "optional"... on the one hand could mark "required" to make it explicit in case the server supports multiple llama's at the same time, but also could delete it since its ignored. decision: mark it required for the sake of openai api compatibility. I think out of all parameters, `model` is probably the most important one for people to keep using even if its ignored for now.
1 parent 53c0129 commit e40fcb0
Copy full SHA for e40fcb0

File tree

Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed

‎llama_cpp/server/app.py

Copy file name to clipboardExpand all lines: llama_cpp/server/app.py
+12-5Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def get_llama():
6666
with llama_lock:
6767
yield llama
6868

69+
model_field = Field(
70+
description="The model to use for generating completions."
71+
)
72+
6973
class CreateCompletionRequest(BaseModel):
7074
prompt: Union[str, List[str]]
7175
suffix: Optional[str] = Field(None)
@@ -76,8 +80,9 @@ class CreateCompletionRequest(BaseModel):
7680
stop: Optional[List[str]] = []
7781
stream: bool = False
7882

79-
# ignored or currently unsupported
80-
model: Optional[str] = Field(None)
83+
# ignored, but marked as required for the sake of compatibility with openai's api
84+
model: str = model_field
85+
8186
n: Optional[int] = 1
8287
logprobs: Optional[int] = Field(None)
8388
presence_penalty: Optional[float] = 0
@@ -133,7 +138,8 @@ def create_completion(
133138

134139

135140
class CreateEmbeddingRequest(BaseModel):
136-
model: Optional[str]
141+
# ignored, but marked as required for the sake of compatibility with openai's api
142+
model: str = model_field
137143
input: str
138144
user: Optional[str]
139145

@@ -173,8 +179,9 @@ class CreateChatCompletionRequest(BaseModel):
173179
stop: Optional[List[str]] = []
174180
max_tokens: int = 128
175181

176-
# ignored or currently unsupported
177-
model: Optional[str] = Field(None)
182+
# ignored, but marked as required for the sake of compatibility with openai's api
183+
model: str = model_field
184+
178185
n: Optional[int] = 1
179186
presence_penalty: Optional[float] = 0
180187
frequency_penalty: Optional[float] = 0

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.