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

Define meaningful `LMStudioPredictionError` subclasses

Aperta
#96 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia individuando la definizione esistente di LMStudioPredictionError e i sei percorsi di gestione di predictions e tool-call descritti nell’issue. Traccia come vengono attualmente esposti i messaggi del server, le richieste di tool non valide e le chiamate ai tool fallite, quindi implementa e verifica la gerarchia delle eccezioni proposta e il contesto strutturato per ogni caso mappato.

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

Descrizione

enhancement

LMStudioPredictionError is raised/reported in the following cases:

  • the server sends an "error" message on the prediction's streaming channel
  • the server sends a "toolCallGenerationFailed" message on the prediction's streaming channel
  • the server sends a tool request on the final round of an .act() call (when tool requests are disabled)
  • the server sends a tool request for an unknown tool name
  • the server sends a tool request for a known tool, but parsing the tool parameters fails
  • a valid tool call request raises an unhandled Python exception during execution

The first two are raised directly by the SDK, the last three are processed through the handle_invalid_tool_request callback (which defaults to sending them back to the LLM as text rather than raising them locally). The "tool call request when tool requests are disabled" handling is currently a hybrid of the two: handle_invalid_tool_request is invoked, but without any request details, and the exception is raised directly by the SDK (since the LLM interaction is complete, the invalid call can't be reported back to the LLM to fix)

Each of these could meaningfully report additional structured information:

  • the two server errors could report the triggering message from the server
  • the four tool call request errors could report the request that resulted in the error
  • tool calls with invalid args could report the tool details in addition to the tool call request
  • failed tool calls could report the raised exception (as __cause__), the parsed tool call args, and the tool details

Potential hierarchy:

- LMStudioPredictionError
  - LMStudioServerPredictionError
  - LMStudioToolCallError
    - LMStudioServerToolCallError  # Also inherits from LMStudioServerPredictionError
    - LMStudioToolCallInvalidError
      - LMStudioToolCallUnknownError
      - LMStudioToolCallInvalidArgsError
    - LMStudioToolCallFailedError # Has __cause__ set to the unhandled tool call exception

The 6 specific cases would then map to

  • server "error" message -> LMStudioServerPredictionError
  • server "toolCallGenerationFailed" message -> LMStudioServerToolCallError
  • unknown tool name -> LMStudioToolCallUnknownError
  • parsing the tool parameters fails -> LMStudioToolCallInvalidArgsError
  • tool request when tool requests are disabled -> LMStudioToolCallInvalidError (no dedicated subclass)
  • unhandled Python exception -> LMStudioToolCallFailedError
Lingua principale
Python
Stelle
881
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 lmstudio-ai/lmstudio-python

Tutte le issue di lmstudio-ai/lmstudio-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.