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

[Frontend] Support for chat completions input in the tokenize endpoint #5923

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sasha0552
Copy link
Contributor

Related: #5054 (#5054 (comment))

Example:

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","prompt":"test"}' http://localhost:8000/tokenize
{
  "count": 1,
  "max_model_len": 8192,
  "tokens": [1985],
}

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","messages":[{"role":"user","content":"Hi"}]}' http://localhost:8000/tokenize
{
  "count": 11,
  "max_model_len": 8192,
  "tokens": [128000,128006,882,128007,271,13347,128009,128006,78191,128007,271]
}

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","tokens":[128000,128006,882,128007,271,13347,128009,128006,78191,128007,271]}' http://localhost:8000/detokenize
{
  "prompt": "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHi<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
}

@DarkLight1337
Copy link
Collaborator

DarkLight1337 commented Jun 28, 2024

To speed up the CI queue for #5905, I've cancelled the distributed tests for the latest CI run in this PR since they won't pass anyway until #5905 has been merged. Please merge main into your branch after that happens so that the CI can pass once again.

@DarkLight1337
Copy link
Collaborator

DarkLight1337 commented Jun 29, 2024

Hmm, I think we can move this to a new file (as in create a new subclass of OpenAIServing) since it's not really a part of OpenAI's Chat or Completions API. We can support both Chat and Completions input.

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.

None yet

2 participants