Structured response not consistently returned
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Inizia dallo script Python riprodotto e dal punto di ingresso model.respond(..., response_format=BookSchema), quindi segui come vengono impostati result.parsed e result.structured quando il ragionamento precede il JSON. Il lavoro è completato quando esecuzioni consecutive contrassegnano costantemente la risposta come strutturata e preservano i dati BookSchema analizzati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment:
- Python 3.14.2 on Windows
- lmstudio-py version 1.5.0
- LM Studio Bionic 1.0.7 (build 2)
Using the following script, which is essentially the example from the documentation, the returned response is not always structured.
import lmstudio
from lmstudio import BaseModel
# A class based schema for a book
class BookSchema(BaseModel):
title: str
author: str
year: int
model = lmstudio.llm("qwen/qwen3-4b-2507")
result = model.respond("Tell me about The Hobbit", response_format=BookSchema)
book = result.parsed
print(book)
assert result.structured
assert isinstance(book, dict)
Here's the output from two consecutive runs, with the script unchanged. One works, one fails the result.structured assertion, even though it seems the response contains the correct structured JSON, preceded by its reasoning and __LM_STUDIO_INTERNAL_LSEP_SYNTHETIC_REASONING_END_:
(.venv) PS C:\Users> python .\test_structured.py
{'author': 'J.R.R. Tolkien', 'title': 'The Hobbit', 'year': 1937}
(.venv) PS C:\Users> python .\test_structured.py
Okay, the user asked "Tell me about The Hobbit." Let me start by recalling the basics. The Hobbit is a fantasy novel by J.R.R. Tolkien, written in the early 20th century. It's a key work in the Middle-earth series, which also includes The Lord of the Rings.
First, I should cover the main plot: Bilbo Baggins, a hobbit, is taken on a journey from the Shire to the land of the dwarves, where he helps them reclaim their homeland from a dragon. The story is framed as a quest that starts with a simple adventure but evolves into a deeper exploration of courage, friendship, and personal growth.
I need to mention the setting—Middle-earth, the Shire, the Misty Mountains, the Lonely Mountain, and the dragon Smaug. Highlighting key characters like Bilbo, Gandalf, the dwarves (like Thorin Oakenshield), and others like Gollum or the trolls adds depth.
Themes are important too—like the hero's journey, the contrast between hobbits and other races, and how the story introduces elements of magic and myth. Also, note that The Hobbit is a children's book but has mature themes.
I should also mention its significance in literature and popular culture—how it influenced fantasy genres and inspired films by Peter Jackson. Maybe touch on the tone: whimsical at first, then darker as it progresses.
Avoid getting too detailed or going off track. Keep it structured but conversational. Make sure to clarify that The Hobbit is a standalone story but part of a larger universe. Also, note that it was published in 1937 and is one of the foundational works of modern fantasy.
Check if the user might be looking for a summary, themes, characters, or cultural impact. Since they just said "tell me about," a balanced overview should work. No need to go into deep analysis unless asked.
Finally, end with a note on its legacy—how it's beloved and influential, even though it's not as complex as The Lord of the Rings.
__LM_STUDIO_INTERNAL_LSEP_SYNTHETIC_REASONING_END_f4e9a8d2c6b14d0c9e5f3a7b8c1d2e6a__{
"author": "J.R.R. Tolkien",
"title": "The Hobbit",
"year": 1937
}
Traceback (most recent call last):
File "C:\Users\test_structured.py", line 15, in <module>
assert result.structured
^^^^^^^^^^^^^^^^^
AssertionError
- Lingua principale
- Python
- Stelle
- 885
- Fork
- 168
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lmstudio-ai/lmstudio-python
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
lmstudio-ai/lmstudio-python#186 ·
-
Reasoning parametersAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
lmstudio-ai/lmstudio-python#183 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
lmstudio-ai/lmstudio-python#182 · 1 reazione ·
-
error code: 502Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
lmstudio-ai/lmstudio-python#180 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
lmstudio-ai/lmstudio-python#179 ·
Tutte le issue di lmstudio-ai/lmstudio-python
Issue simili
-
No test checks that scheduled workflows declare minimal permissions, concurrency and a timeoutApertaci enhancement testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
area/config comp/tools P2 platform/telegram type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
NousResearch/hermes-agent#145412 ·
I maintainer di solito rispondono entro 1 giorno
-
[oblt-aw][autodoc] Update docs for security org scaffolding and Docs AI menu permission changesForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
curriculum documentation quality
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
githubnext/gh-aw-workshop#5039 ·
I maintainer di solito rispondono entro 1 giorno
-
Community project: hosted MOSS-Image studio with a visual JSON layout builder (no ComfyUI needed)Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
OpenMOSS/MOSS-Image#27 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno