omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(omi-tools): add config parameter, query defaults, and harden doc formatting ($50 proposed)

Open Dimank92 opened this issue 1 month ago • 2 comments

Summary

In backend/utils/retrieval/tools/omi_tools.py, several edge cases and missing parameters in get_omi_product_info_tool impact tool execution and agent integration:

  1. Missing config: RunnableConfig = None parameter:
    • LangChain tool callers and runners automatically pass config during invocation. The lack of config: RunnableConfig = None causes TypeError: get_omi_product_info_tool() got an unexpected keyword argument 'config'.
  2. Strict required query: str parameter without default:
    • If invoked without arguments or with query=None, direct invocations raise TypeError: missing 1 required positional argument: 'query'.
    • query input is now coerced and stripped cleanly (query: Optional[str] = "").
  3. Payload validation for context:
    • Validates that context is a valid dictionary before iterating .items().
  4. Log sanitization:
    • Added sanitize() on query and exception messages to prevent log injection.

Proposed Changes

  1. Add config: RunnableConfig = None: Ensure full compatibility with LangChain agent loops and direct test harnesses.
  2. Safe Query Coercion & Default: Provide query: Optional[str] = "" with safe type conversion.
  3. Payload Validation & Efficient String Formatting: Validate isinstance(context, dict) and build output lines efficiently.
  4. Hermetic Unit Tests: Add backend/tests/unit/test_omi_tools_guards.py verifying config compatibility, no-arg invocation, exception handling, and empty docs fallback (4 tests, 100% pass).

Bounty Proposal

Proposed bounty: $50 USDC Payout address: 0xC345C07229307d4f1c7935aD2cAe48e390215808 (USDC Polygon/Base/Arbitrum)

Dimank92 avatar Oct 22 '26 05:10 Dimank92

I have implemented the complete fix and hermetic unit tests in PR #23244.

  • Pull Request: https://github.com/BasedHardware/omi/pull/23244
  • Unit Tests: 4/4 passing hermetically
  • Payout Address: 0xC345C07229307d4f1c7935aD2cAe48e390215808 (USDC Polygon/Base/Arbitrum)

Dimank92 avatar Oct 22 '26 05:10 Dimank92

Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

undivisible avatar Oct 22 '26 11:10 undivisible