FEAT: Support PDF and file inputs via `binary_path` in OpenAI chat and response targets

Ouverte
#3,274 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@PranavD2905 y travaille déjà.

Depuis le 17/10/2026.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
ai, api

Piste de recherche

Start from the binary_path message pieces that PDFConverter already produces, then read how OpenAIChatTarget and OpenAIResponseTarget build their request payloads and declare input capabilities. Reading the storage abstraction used to load files is also needed. Done means a request containing a PDF plus text serializes correctly for both targets, passes capability validation, survives history rebuilding, and has regression tests and a documented example.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

feature-request help wanted
Is your feature request related to a problem? Please describe.

PyRIT represents files such as PDFs using binary_path, and converters such as PDFConverter already produce this type. However, OpenAIChatTarget and OpenAIResponseTarget do not currently support sending these files as native file inputs.

This leaves a gap between generating a file and submitting it to a model for document-based testing.

Describe the solution you'd like

Support binary_path message pieces in both targets, starting with PDFs and extending to other file formats where the selected API and model support them.

Expected behavior:

  • Read the referenced file through PyRIT's storage abstraction and serialize it into the appropriate Chat Completions or Responses API file-input format.
  • Support file-only messages, files alongside text instructions, and multiple files where supported by the API.
  • Update target input capabilities so requests containing binary_path pass validation.
  • Preserve file inputs when rebuilding conversation history.
  • Surface clear errors for unreadable files and unsupported inputs. Document API/model-specific format and size restrictions rather than implying that all binary files are supported.

Include request-serialization and regression tests for both targets, plus a documented example that sends a PDF with a text instruction.

Describe alternatives you've considered, if relevant

Extracting text from the PDF or converting its pages to images can work for some use cases, but changes how the model receives the document and does not exercise native file handling.

Manually building API requests outside these targets requires users to duplicate request-building logic.

Additional context

Related issues #423, #415, and #541 cover file generation and injection. This request covers the separate target responsibility of sending those files to the model.

Langage dominant
Python
Étoiles
4.7k
Forks
1k
Merge moyen
2 j 2 h
PR mergées (30 j)
439

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/PyRIT

Toutes les issues de microsoft/PyRIT

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.