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

Feat/support logit bias #270

Merged
merged 5 commits into from
Oct 29, 2024
Merged

Feat/support logit bias #270

merged 5 commits into from
Oct 29, 2024

Conversation

nguyenhoangthuan99
Copy link
Contributor

@nguyenhoangthuan99 nguyenhoangthuan99 commented Oct 28, 2024

Fix #263

request example:

  curl http://localhost:3928/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "engine":"cortex.llamacpp",
    "logit_bias":{"12345":1},
    "model": "meta-llama3.1-8b-instruct",
    "n_probs":1,
    "stream":false,
    "top_k":20,
    "messages": [
      {
        "role": "user",
        "content": "Who won the world series in 2020?"
      },
    ]
  }'

Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100 (source: https://platform.openai.com/docs/api-reference/chat/create#chat-create-logit_bias)

@nguyenhoangthuan99 nguyenhoangthuan99 marked this pull request as ready for review October 29, 2024 02:21
@nguyenhoangthuan99 nguyenhoangthuan99 merged commit 185a7cf into main Oct 29, 2024
33 checks passed
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.

feat: [support logit_bias for OpenAI API compatible]
2 participants