Fix CI issues: lint, type checker, and test failures

- Remove unused imports from test and example files
- Fix f-string formatting in examples
- Add proper type handling for Union[str, Dict] in agent_utils.py
- Fix XML parser test assertion to match expected output
- Use isinstance() for proper type narrowing in LLM calls

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-06-24 05:21:30 +00:00
parent 39ea952acd
commit a1ebdb125b
5 changed files with 26 additions and 18 deletions

View File

@@ -2,8 +2,8 @@
Example demonstrating the new LLM generations and logprobs functionality.
"""
from crewai import Agent, Task, Crew, LLM
from crewai.utilities.xml_parser import extract_xml_content, extract_multiple_xml_tags
from crewai import Agent, Task, LLM
from crewai.utilities.xml_parser import extract_xml_content
def example_multiple_generations():
@@ -133,7 +133,7 @@ def example_logprobs_analysis():
print(f"Available logprobs data: {len(logprobs)} choices")
if usage:
print(f"\nToken usage:")
print("\nToken usage:")
print(f"Prompt tokens: {usage.get('prompt_tokens', 'N/A')}")
print(f"Completion tokens: {usage.get('completion_tokens', 'N/A')}")
print(f"Total tokens: {usage.get('total_tokens', 'N/A')}")