crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] Native OpenAI rejects GPT-6 Astra file inputs before the API call

Open Damaraland opened this issue 2 months ago • 5 comments

Description

CrewAI 1.15.22 and 1.15.23 reject file inputs for openai/gpt-6-astra through the native OpenAICompletion provider before making an API request.

The error was encountered when passing documents through crew.kickoff(input_files=...) with api="responses". The isolated reproducer below exercises the same local formatting gate, using a synthetic PDF and a text file. It requires no real credentials, makes no model requests, and imports no application code or local compatibility adapter.

Steps to Reproduce

  1. Use Python 3.12 and install crewai==1.15.23, crewai-files==1.15.23 and pypdf==6.16.2.

  2. Save the code below as reproducir_bug.py.

  3. Run it in that environment. Alternatively, run it in an isolated environment with uv:

    uv run --isolated --no-project --python 3.12 --with crewai==1.15.23 --with crewai-files==1.15.23 --with pypdf==6.16.2 python reproducir_bug.py
    
  4. Observe supports_multimodal=False and the same ValueError for both files. Exit code 1 means the local rejection was reproduced.

Expected behavior

The native OpenAI provider should recognize GPT-6 Astra's supported file capabilities and allow a PDF to be formatted for the Responses API instead of rejecting it locally.

The text-file case demonstrates that the current gate also rejects text attachments. It does not imply that text must be embedded as a PDF-style Responses input; CrewAI may continue to expose text through its existing file-reading tool.

Screenshots/Code snippets

"""Reproduce CrewAI's native OpenAI file gate without API calls."""

import os
import platform
from importlib.metadata import version
from io import BytesIO


def main() -> int:
    os.environ["PYTHON_DOTENV_DISABLED"] = "1"
    os.environ["OTEL_SDK_DISABLED"] = "true"
    os.environ["CREWAI_TELEMETRY_OPT_OUT"] = "true"

    from crewai import LLM
    from crewai.llms.providers.openai.completion import OpenAICompletion
    from crewai_files import FileBytes, PDFFile, TextFile
    from pypdf import PdfWriter

    print(f"Python {platform.python_version()}")
    print(f"crewai=={version('crewai')}")
    print(f"crewai-files=={version('crewai-files')}")

    llm = LLM(
        model="openai/gpt-6-astra",
        api="responses",
        api_key="unused-local-reproducer",
        base_url="https://example.invalid/v1",
        prefer_upload=False,
    )
    assert isinstance(llm, OpenAICompletion), type(llm)
    print(f"provider={type(llm).__name__}")
    print(f"supports_multimodal={llm.supports_multimodal()}")

    buffer = BytesIO()
    writer = PdfWriter()
    writer.add_blank_page(width=72, height=72)
    writer.write(buffer)
    files = {
        "sample.pdf": PDFFile(
            source=FileBytes(data=buffer.getvalue(), filename="sample.pdf")
        ),
        "sample.txt": TextFile(
            source=FileBytes(data=b"Synthetic example", filename="sample.txt")
        ),
    }

    rejected = 0
    for name, file in files.items():
        try:
            # Exercise only the local gate used by call()/crew.kickoff().
            llm._format_messages([
                {"role": "user", "content": "Inspect the file.", "files": {name: file}}
            ])
        except ValueError as exc:
            if "does not support multimodal input" not in str(exc):
                raise
            rejected += 1
            print(f"{name}: {type(exc).__name__}: {exc}")
        else:
            print(f"{name}: no local rejection")

    return 1 if rejected else 0


if __name__ == "__main__":
    raise SystemExit(main())

Operating System

Windows.

Python Version

3.12.14.

crewAI Version

1.15.23. crewai-files==1.15.23; pypdf==6.16.2.

Originally reproduced with crewai==1.15.22 and crewai-files==1.15.22; confirmed again with 1.15.23.

crewAI Tools Version

1.15.23 is installed in the current reporting environment (1.15.22 in the original report). The reproducer does not use tools from that package.

Virtual Environment

Local .venv managed with uv.

Evidence

Retested on 2026-09-29 with the original offline reproducer, Python 3.12.14, crewai==1.15.23 and crewai-files==1.15.23. The issue persists: supports_multimodal() returns False, and both PDF and text attachments raise the same local ValueError. No API requests were made.

Python 3.12.14
crewai==1.15.23
crewai-files==1.15.23
provider=OpenAICompletion
supports_multimodal=False
sample.pdf: ValueError: Model 'gpt-6-astra' does not support multimodal input, but files were provided via 'input_files'. Use a vision-capable model or remove the file inputs.
sample.txt: ValueError: Model 'gpt-6-astra' does not support multimodal input, but files were provided via 'input_files'. Use a vision-capable model or remove the file inputs.

Original reproduction on 2026-09-27 with the script above:

Python 3.12.14
crewai==1.15.22
crewai-files==1.15.22
provider=OpenAICompletion
supports_multimodal=False
sample.pdf: ValueError: Model 'gpt-6-astra' does not support multimodal input, but files were provided via 'input_files'. Use a vision-capable model or remove the file inputs.
sample.txt: ValueError: Model 'gpt-6-astra' does not support multimodal input, but files were provided via 'input_files'. Use a vision-capable model or remove the file inputs.

In both tested versions (1.15.22 and 1.15.23), OpenAICompletion.supports_multimodal() matches these prefixes:

("gpt-4o", "gpt-4.1", "gpt-4-turbo", "gpt-4-vision", "gpt-5", "o1", "o3", "o4")

gpt-6-astra matches none of them, so BaseLLM._process_message_files() raises as soon as a message has a nonempty files mapping.

Relevant source:

A separate endpoint check, recorded during the original diagnosis on 2026-09-27, accepted a 688-byte synthetic PDF through the OpenAI Responses API with gpt-6-astra: status completed, 45 input tokens and 10 output tokens. That check used store=False and an inline PDF. It is separate from the offline reproducer above and was not rerun while preparing this issue. The complete application workflow and real application documents were not used in that check.

Possible Solution

Consider adding "gpt-6" to the vision_models prefixes, following the existing "gpt-5" matching convention, if all models covered support multimodal inputs. This report verifies GPT-6 Astra's PDF capability; other GPT-6 models were not tested here.

vision_models = (
    "gpt-4o",
    "gpt-4.1",
    "gpt-4-turbo",
    "gpt-4-vision",
    "gpt-5",
    "gpt-6",
    "o1",
    "o3",
    "o4",
)
return any(self.model.lower().startswith(m) for m in vision_models)

The original proposal was intentionally limited to Astra. A family-wide prefix is a broader proposal that should follow verified model capabilities and the maintainers' preferred matching policy.

Suggested regression coverage:

  • The native LLM factory resolves openai/gpt-6-astra to a provider that supports the relevant file inputs.
  • A synthetic PDF becomes an input_file block in a Responses request without a real API call.
  • Text attachments pass the local gate and remain accessible through CrewAI's file-reading path.
  • Existing supported models retain their behavior, and an unsupported model is still rejected.

A local subclass overriding only supports_multimodal() currently works around the gate in the reporting application. A proposed Astra-specific fix is available in PR #7795. The broader "gpt-6" proposal above has not been validated against CrewAI's full test suite.

Additional context

  • Issue #7732 and its associated PR #7733 concern Bedrock. This report concerns the native OpenAI provider.
  • The offline reproducer intentionally isolates capability detection from agent orchestration, retries, model output quality and API credentials.
  • This report and reproducer were prepared with assistance from an AI coding agent. Please retain the llm-generated label as required by the contribution guidelines.

Damaraland avatar Sep 27 '26 18:09 Damaraland

Hi! I’d be interested in working on this. I’d begin by converting the offline reproduction into regression tests for the native OpenAI provider, covering Astra PDF input through the Responses API, text attachments, an existing supported model, and an unsupported-model control.

I’d keep the implementation narrowly scoped to verified capabilities rather than treating every GPT-6 model as multimodal. Are you already preparing a fix, and would maintainers prefer an explicit Astra capability entry or a more structured capability check?

musi22 avatar Sep 27 '26 18:09 musi22

Could a maintainer please add the bug and llm-generated labels? This report was prepared with AI assistance, as disclosed in the issue. I don’t have permission to apply labels.

Damaraland avatar Sep 27 '26 19:09 Damaraland

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Oct 29 '26 12:10 github-actions[bot]

The proposed fix in #7795 is still open and has not been merged into main. Please keep this issue open while the fix is pending review. Thank you.

Damaraland avatar Oct 29 '26 14:10 Damaraland

Confirmed that the fix is included in CrewAI 1.15.38 and remains present in 1.15.45: supports_multimodal() now recognizes the gpt-6 family.

The change was merged through #9272. The original PR #7795 was subsequently closed without merging.

Closing as fixed.

Damaraland avatar Nov 27 '26 11:11 Damaraland