mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 06:18:14 +00:00
feat: add support for OpenAI 1.78 distribution
- Update litellm dependency to allow >=1.68.0,<1.72.0 for OpenAI 1.78 compatibility - Add test to verify OpenAI 1.78 compatibility with multi-image input support - Resolves #2910 Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
53
tests/test_openai_178_compatibility.py
Normal file
53
tests/test_openai_178_compatibility.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from crewai import LLM, Agent, Crew, Task, TaskOutput
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Only run manually with valid API keys")
|
||||
def test_openai_178_compatibility_with_multimodal():
|
||||
"""
|
||||
Test that CrewAI works with OpenAI 1.78.0 and multi-image input support.
|
||||
This test verifies the fix for issue #2910.
|
||||
"""
|
||||
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
||||
if not OPENAI_API_KEY:
|
||||
pytest.skip("OPENAI_API_KEY environment variable not set")
|
||||
|
||||
llm = LLM(
|
||||
model="openai/gpt-4o", # model with vision capabilities
|
||||
api_key=OPENAI_API_KEY,
|
||||
temperature=0.7
|
||||
)
|
||||
|
||||
visual_agent = Agent(
|
||||
role="Multi-Image Analyst",
|
||||
goal="Analyze multiple images and provide comprehensive reports",
|
||||
backstory="Expert in visual analysis capable of processing multiple images simultaneously",
|
||||
llm=llm,
|
||||
verbose=True,
|
||||
allow_delegation=False,
|
||||
multimodal=True
|
||||
)
|
||||
|
||||
analysis_task = Task(
|
||||
description="""
|
||||
Analyze these product images:
|
||||
1. https://www.us.maguireshoes.com/cdn/shop/files/FW24-Edito-Lucena-Distressed-01_1920x.jpg?v=1736371244
|
||||
2. https://example.com/sample-image.jpg
|
||||
|
||||
Provide a comparative analysis focusing on design elements and quality indicators.
|
||||
""",
|
||||
expected_output="A comparative analysis of the provided images",
|
||||
agent=visual_agent
|
||||
)
|
||||
|
||||
crew = Crew(agents=[visual_agent], tasks=[analysis_task])
|
||||
result = crew.kickoff()
|
||||
|
||||
assert result is not None
|
||||
assert len(result.tasks_output) == 1
|
||||
task_output = result.tasks_output[0]
|
||||
assert isinstance(task_output, TaskOutput)
|
||||
assert len(task_output.raw) > 0
|
||||
Reference in New Issue
Block a user