crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

fix: normalize LLM parameter case and improve type handling

Open devin-ai-integration[bot] opened this issue 1 month ago • 3 comments

Fix LLM Parameter Case Normalization and Type Handling

Description

This PR addresses issue #1817 by implementing proper case normalization for the LLM parameter and improving type handling for all LLM-related parameters.

Changes

  • Add case normalization for 'LLM' parameter with deprecation warning
  • Add comprehensive type conversion for LLM parameters (int, float, bool, dict, list)
  • Add proper error handling for parameter conversion
  • Add tests to verify parameter handling

Testing

  • Added unit tests to verify:
    • Case-insensitive LLM parameter handling
    • Proper type conversion for different parameter types
    • Deprecation warning for uppercase 'LLM' usage
    • Environment variable handling

Implementation Details

  • Implemented in post_init_setup method of Agent class
  • Added type conversion for:
    • Integer parameters (timeout, max_tokens, etc.)
    • Float parameters (temperature, top_p, etc.)
    • Boolean parameters (logprobs)
    • Dictionary parameters (logit_bias)
    • List parameters (callbacks)
  • Added comprehensive error handling for each type conversion

Link to Devin run: https://app.devin.ai/sessions/ac96d6577a1c435c9d0e48744b2bb04f

Fixes #1817