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

BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every request

Aperta
#3,445 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ShivamSharma43 ci sta già lavorando.

Dal 21/10/2026.

  • #3447 di @ShivamSharma43 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

The issue identifies OpenAITTSTarget.__init__ and _send_prompt_to_target_async; locate those entry points in the PyRIT source and check how OpenAIVideoTarget validates duration. Add coverage for the listed invalid speed values and for None and valid boundary values. Done when invalid speeds raise ValueError at construction while None remains accepted; linked pull request #3447 is already open.

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

Descrizione

Describe the bug

OpenAITTSTarget.__init__ documents speed as "Select a value from 0.25 to 4.0", which is the range of the OpenAI speech API's speed parameter, but stores whatever is passed. _send_prompt_to_target_async then puts it in every request body (if self._speed is not None: body_parameters["speed"] = self._speed).

So speed=10, speed=-1.0, speed=0, speed=float("nan") or speed=True all construct a target without error, and the mistake only surfaces when each request reaches the API. The value is also recorded in the target's identifier as if it were valid. OpenAIVideoTarget already rejects an unsupported duration at the target instead of leaving it to the API.

Steps/Code to Reproduce
import asyncio
from pyrit.setup import IN_MEMORY, initialize_pyrit_async

asyncio.run(initialize_pyrit_async(memory_db_type=IN_MEMORY))

from pyrit.prompt_target import OpenAITTSTarget

for speed in (10, -1.0, 0, float("nan"), True):
    target = OpenAITTSTarget(model_name="tts-1", endpoint="https://api.openai.com/v1", api_key="sk-test", speed=speed)
    print(repr(speed), "-> accepted, will send speed =", repr(target._speed))
Expected Results

A speed that is not a finite number from 0.25 to 4.0 raises a ValueError when the target is created. None keeps the API default.

Actual Results
10 -> accepted, will send speed = 10
-1.0 -> accepted, will send speed = -1.0
0 -> accepted, will send speed = 0
nan -> accepted, will send speed = nan
True -> accepted, will send speed = True
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (898b3bdc) in editable mode
Lingua principale
Python
Stelle
4.6k
Fork
962
Merge medio
2g 13h
PR unite (30g)
417

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 microsoft/PyRIT

Tutte le issue di microsoft/PyRIT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.