Files
41850cee28 fix(openai): call GPT-6 Astra and GPT-6.1 Sol tools through the Responses API (#9035)
* fix(openai): call GPT-6 Astra and GPT-6.1 Sol tools through the Responses API

On /v1/chat/completions every GPT-6 model rejects function tools with a
reasoning effort, and the 400 offers reasoning_effort "none" as the way out.
GPT-6 Luna and GPT-6.1 Terra accept it; GPT-6 Astra and GPT-6.1 Sol refuse it
with an "Unsupported value" 400, so any agent with a tool failed on them.

When the "none" retry is refused, or the 400 does not offer it (Bedrock's
OpenAI-compatible endpoint, from #7741), the call now goes to the Responses
API, and the model is remembered so later calls go there directly. The refused
retry no longer logs an error or emits LLMCallFailedEvent.

Co-authored-by: kimnamu <jihoon.lucas.kim@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(openai): keep streamed tool calls, storage default and routing per endpoint

Three gaps in the move to the Responses API, found in review:

- The streaming Responses handlers dropped function calls when the caller
  passed no available_functions, as crewAI's native agent executor does, and
  returned "". They now return the calls, as the non-streaming handler does.
- An implicit move from chat completions sent no `store`, so OpenAI stored the
  call. It now sends store=False unless `store` is set, a response is chained,
  or the endpoint is a compatible server.
- The learned set was keyed by model name alone, so one gateway's 400 could
  reroute the same name on api.openai.com or another gateway. It is keyed by
  (endpoint, model) now, like the reasoning-effort set.

The live cassettes now assert the tool actually ran, since they match
requests on path alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): offer only current models in the pickers and name missing keys (#9028)

* fix(cli): lead model pickers with small models and name missing keys

The create wizards now list gpt-5.6-luna and claude-sonnet-5 first, drop
gpt-5.4-mini, and fall back to openai/gpt-5.6-luna instead of openai/gpt-4o.
API-key prompts hide input, and a skipped key prints the exact .env line to
add instead of claiming the key was saved; the JSON crew prompts once per
provider and, in DMN or --skip-provider mode, names the key in its next steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): hide only secret prompts and skip keys the shell already sets

Every ENV_VARS prompt was hidden, including the Azure deployment name and
endpoint URLs, and a hidden prompt reads the terminal rather than piped stdin.
Prompts now hide only secrets and only when stdin is a terminal, and the
missing-key hint leaves out values with a runtime default (AWS region, Azure
API version) and keys already exported in the environment. A test now pins
the next-steps hint for --skip-provider without DMN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): offer only current models in the create pickers

Every provider in `crewai create crew` (wizard and --classic) now lists only
its current models, small to top, verified against the vendors' docs on
2026-11-03: GPT-6 Luna / GPT-6.1 Sol / GPT-6 Astra, Claude Sonnet / Haiku /
Opus 5.5 and Fable 5.1, Gemini 3.8 Flash / 3.5 Flash Lite / 4 Argon, and
current open-weight models elsewhere. GPT-4, GPT-5.x, the o-series, Claude 4
and Llama 3 entries are gone; they stay reachable through "Other".

The wizard gains curated lists for bedrock, azure, nvidia_nim, huggingface,
cerebras, sambanova and watson, which showed LiteLLM's feed before. A preview
model is labeled "(preview)" and never the default. The fallback model is
openai/gpt-6-luna.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): write watsonx models with the prefix crewAI can run

The wizard built `watson/<model>` from its provider key, and LiteLLM, which
crewAI hands watsonx models to, rejects that provider name. With a curated
watsonx list, `--provider watson` now wrote it too. The wizard writes
`watsonx/...`, as classic create already did, and maps the prefix back to the
`watson` ENV_VARS entry when it asks for or lists keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): keep classic create working when the model catalog is unreachable

With no fresh LiteLLM cache and the fetch failing (offline, DNS, proxy),
`crewai create crew --classic` returned before the provider menu, exited 0,
and left a folder with no pyproject.toml, crew.py or .env. select_choice
also reloaded the catalog itself, so each picker aborted the same way.

Now the catalog is optional: the curated PROVIDERS and MODELS are offered
and creation finishes, and the catalog still adds its providers to the
"other" list when it loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

* fix(cli): accept --provider watsonx as the watsonx provider

The wizard writes watsonx models as watsonx/..., but --provider watsonx found
no curated list and fell back to the OpenAI default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WfUv1NsUFz1RHjRgS73HBR

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: kimnamu <jihoon.lucas.kim@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 00:51:35 -03:00

26 lines
973 B
Python

"""Shared setup for the CLI's tests."""
import pytest
@pytest.fixture(autouse=True)
def _usage_counts_stay_on_this_machine(monkeypatch):
"""The CLI counts what its commands do (`cli_usage:*`), and a suite that
exercises them would send those counts as if users had run them: every
`crewai eval` stop reason within the same second, from a laptop or from CI.
A test that checks the counting replaces `Telemetry` or sets the flag
itself."""
monkeypatch.setenv("CREWAI_DISABLE_TELEMETRY", "true")
@pytest.fixture
def no_provider_keys(monkeypatch):
"""Unset every value `crewai create` prompts for, so a key exported on the
machine running the suite does not stop the CLI from naming it as missing."""
from crewai_cli.constants import ENV_VARS
for entries in ENV_VARS.values():
for details in entries:
if "key_name" in details:
monkeypatch.delenv(str(details["key_name"]).upper(), raising=False)