Fix CI failures: correct context window ratio and remove unused imports

- Fix test expectations to use 0.85 ratio instead of 0.75 (matches CONTEXT_WINDOW_USAGE_RATIO)
- Remove unused imports (pytest, Mock) from test file
- Add context window size warning for large models (>100K tokens)
- Update documentation with performance considerations and rate limiting best practices
- Address code review feedback from João regarding validation and error handling

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-06-04 10:15:30 +00:00
parent d89dfafdab
commit c96ae80121
3 changed files with 49 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
"""Tests for AI/ML API integration with CrewAI."""
import pytest
from unittest.mock import Mock, patch
from unittest.mock import patch
from crewai.llm import LLM
from crewai.utilities.llm_utils import create_llm
@@ -25,7 +24,7 @@ class TestAIMLAPIIntegration:
for model_name, expected_context_size in test_cases:
llm = LLM(model=model_name)
expected_usable_size = int(expected_context_size * 0.75)
expected_usable_size = int(expected_context_size * 0.85)
actual_context_size = llm.get_context_window_size()
assert actual_context_size == expected_usable_size, (
f"Model {model_name} should have context window size {expected_usable_size}, "