-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise error in chat completion when unprocessable (#2257)
* Fix chat completion should throw error if not unprocessable * add docstring * forgot cassette
- Loading branch information
Showing
5 changed files
with
104 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/cassettes/InferenceClientVCRTest.test_chat_completion_unprocessable_entity.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
interactions: | ||
- request: | ||
body: '{"model": "tgi", "messages": "please output ''Observation''", "frequency_penalty": | ||
null, "logit_bias": null, "logprobs": null, "max_tokens": 200, "n": null, "presence_penalty": | ||
null, "seed": null, "stop": ["Observation", "Final Answer"], "temperature": | ||
null, "tool_choice": null, "tool_prompt": null, "tools": null, "top_logprobs": | ||
null, "top_p": null, "stream": false}' | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate, br | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '367' | ||
Content-Type: | ||
- application/json | ||
X-Amzn-Trace-Id: | ||
- 52f7edcd-57c0-4258-8ff1-e3c520a43ef7 | ||
user-agent: | ||
- unknown/None; hf_hub/0.23.0.dev0; python/3.10.12; torch/2.2.1; tensorflow/2.15.0.post1; | ||
fastcore/1.5.23 | ||
method: POST | ||
uri: https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B-Instruct/v1/chat/completions | ||
response: | ||
body: | ||
string: 'Failed to deserialize the JSON body into the target type: messages: | ||
invalid type: string "please output ''Observation''", expected a sequence | ||
at line 1 column 58' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- text/plain; charset=utf-8 | ||
Date: | ||
- Mon, 29 Apr 2024 16:18:50 GMT | ||
Transfer-Encoding: | ||
- chunked | ||
access-control-allow-credentials: | ||
- 'true' | ||
access-control-allow-origin: | ||
- '*' | ||
vary: | ||
- origin, Origin, Access-Control-Request-Method, Access-Control-Request-Headers | ||
x-request-id: | ||
- yECOxGeXLet5-Ae5rw808 | ||
x-sha: | ||
- e8cf5276ae3e97cfde8a058e64a636f2cde47820 | ||
status: | ||
code: 422 | ||
message: Unprocessable Entity | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters