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

Đang mở
#9,741 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@abhishekacharya200 đang làm issue này rồi.

Từ ngày 24/11/2026.

  • #9738 của @abhishekacharya200 — đã đóng, không merge
  • #9742 của @abhishekacharya200 — đang mở
  • #9748 của @Mansi2221 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
google-cloud, python
Lĩnh vực
ai

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
Python
Star
61.2k
Fork
9.2k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
180

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của crewAIInc/crewAI

Tất cả issue của crewAIInc/crewAI

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.