Skip to content

fix: ensure consistent return value with exempt_from_tracking=True#443

Open
majiayu000 wants to merge 1 commit intoMadcowD:mainfrom
majiayu000:fix/issue-394-exempt-from-tracking-return-value
Open

fix: ensure consistent return value with exempt_from_tracking=True#443
majiayu000 wants to merge 1 commit intoMadcowD:mainfrom
majiayu000:fix/issue-394-exempt-from-tracking-return-value

Conversation

@majiayu000
Copy link

Summary

  • Fixed inconsistent return value behavior when exempt_from_tracking=True
  • LMPs (@ell.simple, @ell.complex, @ell.tool, @ell.function) were returning a 3-tuple instead of just the result
  • Added wrapper to extract only the result, ensuring consistent behavior regardless of tracking setting

Changes

  • src/ell/lmp/complex.py: Added exempt_wrapper that extracts result from 3-tuple
  • src/ell/lmp/tool.py: Added exempt_wrapper for tools
  • src/ell/lmp/function.py: Added exempt_wrapper for functions
  • tests/test_exempt_from_tracking.py: Added comprehensive tests

Test plan

  • All existing tests pass (108 passed)
  • Added 7 new tests specifically for exempt_from_tracking behavior
  • Verified return types are consistent (not tuples)

Fixes #394

When exempt_from_tracking=True, LMPs (@ell.simple, @ell.complex, @ell.tool,
@ell.function) were returning a 3-tuple (result, api_params, metadata)
instead of just the result. This was inconsistent with the behavior when
exempt_from_tracking=False.

This fix wraps the internal function with an exempt_wrapper that extracts
only the result from the 3-tuple, ensuring consistent return behavior
regardless of the exempt_from_tracking setting.

Fixes MadcowD#394

Signed-off-by: majiayu000 <1835304752@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LMPs return a 3-tuple when exempt_from_tracking=True

1 participant