[BUG] Native Gemini provider ignores timeout, so requests never time out

Abierto
#9,741 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@abhishekacharya200 ya está trabajando en esto.

Desde el 24/11/2026.

  • #9738 de @abhishekacharya200 — cerrado sin fusionar
  • #9742 de @abhishekacharya200 — abierto
  • #9748 de @Mansi2221 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
google-cloud, python
Área
ai

Línea de trabajo

Start in crewai/llms/providers/gemini/completion.py: inspect GeminiCompletion, how BaseLLM moves timeout into additional_params, and where genai.Client is built with http_options. Check the linked PRs #9742 and #9748 before writing anything, since work is already under way. Done means http_options.timeout is set in milliseconds for call() and acall(), to_config_dict() keeps timeout, and the reproduction from the issue plus provider tests pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

LLM(model="gemini/...", timeout=120) builds a GeminiCompletion, but the timeout is never passed to the Google Gen AI client. GeminiCompletion has no timeout field, so BaseLLM moves the value into additional_params, and the Gemini provider never reads additional_params. The client is created with no http_options.timeout, so a slow or stuck request waits forever.

The LLM docs use a Gemini model as the example for timeout=120, and the OpenAI and Anthropic providers both honor it.

Steps to Reproduce
from unittest.mock import patch
from crewai import LLM

with patch("crewai.llms.providers.gemini.completion.genai") as genai:
    llm = LLM(model="gemini/gemini-2.0-flash-001", api_key="x", timeout=30)
    print(type(llm).__name__)              # GeminiCompletion
    print(genai.Client.call_args.kwargs)   # no http_options
    print(llm.additional_params)           # {'timeout': 30}
Expected behavior

The client is built with http_options.timeout=30000 (the SDK takes milliseconds), and to_config_dict() keeps timeout.

Actual behavior

The timeout is silently dropped. Calls through call() and acall() have no client side timeout.

Possible Solution

Add a timeout field to GeminiCompletion and merge it into client_params["http_options"] when building genai.Client. In Vertex AI Express mode, merge api_version="v1" into the same options instead of replacing them.

Note for maintainers: this was prepared with help from an AI coding agent and checked by me, so per CONTRIBUTING please add the llm-generated label (I don't have permission to add labels).

Lenguaje dominante
Python
Estrellas
61.2k
Forks
9.2k
Merge medio
1 d 14 h
PR fusionados (30 d)
180

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de crewAIInc/crewAI

Todos los issues de crewAIInc/crewAI

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.