Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

/v1/tokenize returns a flat list when the text array holds a single string

Aperta
#4,664 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Daksha1611 ci sta già lavorando.

Dal 17/10/2026.

  • #4665 di @Daksha1611 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp, json

Direzione di ricerca

Start with src/tokenize/tokenize_parser.cpp, especially the nesting condition based on outputShape[0] > 1, and compare it with the request parsing sequence in src/llm/servable.cpp. Update or add coverage in tokenize_parser_test.cpp and tokenize_endpoint_test.cpp for a one-element array, then update the tokenize response documentation. Done means every string array returns one token list per input, including a single string, with the endpoint behavior and documented response shape covered.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

The shape of the /v1/tokenize response follows the number of strings in the request instead of the
form of the request. src/tokenize/tokenize_parser.cpp nests the tokens only when the tokenizer
output has more than one row (outputShape[0] > 1), and a one-element array produces one row, the
same as a plain string:

{"text": "hello world"}              ->  {"tokens":[14990,1879]}
{"text": ["hello world"]}           ->  {"tokens":[14990,1879]}
{"text": ["hello world", "hi"]}     ->  {"tokens":[[14990,1879],[6023]]}

A client that sends a list and reads tokens[i] for each input gets a list of token lists for
two or more inputs, but a flat list of integers for exactly one. Batches that happen to contain one
string need special handling on the client.

None of the tests send a one-element array: the list cases in tokenize_parser_test.cpp and
tokenize_endpoint_test.cpp all use two or more strings. The docs show only the single-string
response.

To Reproduce

curl http://localhost:8000/v1/tokenize -H "Content-Type: application/json" \
  -d '{"model": "Qwen/Qwen3-8B", "text": ["hello world"]}'

Reproduced with the parser and a real Qwen3 tokenizer, following the same sequence as
src/llm/servable.cpp: parse the request, encode, build the response.

Expected behavior

An array of strings always gives a list of token lists, including an array with one string.

Note that this changes the response for clients that currently send a one-element array and rely on
the flat list.

Logs

None.

Configuration

  1. OVMS version: main @ eec7daac
  2. any servable that serves /v1/tokenize (LLM, VLM, embeddings, rerank)
  3. N/A
  4. N/A
  5. N/A

Additional context

I have a patch with tests and docs and will open a PR.

Lingua principale
C++
Stelle
952
Fork
285
Merge medio
3g 12h
PR unite (30g)
47

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openvinotoolkit/model_server

Tutte le issue di openvinotoolkit/model_server

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.