Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #30: allow optional "stop" field for oai #36

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

Mardak
Copy link
Contributor

@Mardak Mardak commented Dec 1, 2023

Fix #30 r? @ggerganov

Previously omitting "stop" asserts:

curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
  "messages": [{
    "role": "user",
    "content": "Write a limerick about python exceptions"
  }]
}'

llama.cpp/server/json.h:21313: assert(it != m_value.object->end()) failed

@Mardak
Copy link
Contributor Author

Mardak commented Dec 1, 2023

This avoids the assert, but some .choices[0].message.content include <|im_sep|> (which also happens without this fix but requesting with "stop": null)

@Mardak
Copy link
Contributor Author

Mardak commented Dec 2, 2023

Oh, I see the original commit 401dd08 cherry-picked ggerganov/llama.cpp#4198 so maybe I should fix this upstream?

@Doublespaced1
Copy link

Doublespaced1 commented Dec 2, 2023 via email

Copy link
Collaborator

@jart jart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the OpenAI API documentation. https://platform.openai.com/docs/api-reference/chat/create I believe your fix is correct. I've confirmed the issue is also present ggerganov/llama.cpp too. It'd make me very happy to see you send a PR to the upstream project too. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAI /completions route fails
3 participants