Spaces:
Sleeping
Sleeping
Commit
·
f94c558
1
Parent(s):
dd6d18b
refactor(models): simplify tools type annotation in ChatRequest
Browse filesThe type annotation for the `tools` field in the `ChatRequest` class was simplified from `List[ChatCompletionInputTool]` to `List`. This change reduces complexity while maintaining the same functionality, as the specific type within the list is not critical for the model's operation.
- models/chat_completion.py +1 -1
- routes/chatCompletion.py +3 -3
models/chat_completion.py
CHANGED
@@ -21,4 +21,4 @@ class ChatRequest(BaseModel):
|
|
21 |
top_p: Optional[float] = Field(0.95, gt=0.0, lt=1.0, description="Fraction of the most likely next words to sample from.")
|
22 |
tool_choice: Optional[ChatCompletionInputToolChoiceClass] = Field("auto", description="The tool to use for the completion. Defaults to 'auto'.")
|
23 |
tool_prompt: Optional[str] = Field(None, description="A prompt to be appended before the tools.")
|
24 |
-
tools: Optional[List
|
|
|
21 |
top_p: Optional[float] = Field(0.95, gt=0.0, lt=1.0, description="Fraction of the most likely next words to sample from.")
|
22 |
tool_choice: Optional[ChatCompletionInputToolChoiceClass] = Field("auto", description="The tool to use for the completion. Defaults to 'auto'.")
|
23 |
tool_prompt: Optional[str] = Field(None, description="A prompt to be appended before the tools.")
|
24 |
+
tools: Optional[List] = Field(None, description="A list of tools the model may call.")
|
routes/chatCompletion.py
CHANGED
@@ -31,9 +31,9 @@ async def chat_completion(body: ChatRequest):
|
|
31 |
temperature=body.temperature,
|
32 |
top_logprobs=body.top_logprobs,
|
33 |
top_p=body.top_p,
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
)
|
38 |
|
39 |
if not body.stream:
|
|
|
31 |
temperature=body.temperature,
|
32 |
top_logprobs=body.top_logprobs,
|
33 |
top_p=body.top_p,
|
34 |
+
tool_choice=body.tool_choice,
|
35 |
+
tool_prompt=body.tool_prompt,
|
36 |
+
tools=body.tools
|
37 |
)
|
38 |
|
39 |
if not body.stream:
|