omi
omi copied to clipboard
[Bounty proposal] fix(omi-tools): add config parameter, query defaults, and harden doc formatting ($50 proposed)
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:
- Missing
config: RunnableConfig = Noneparameter:- LangChain tool callers and runners automatically pass
configduring invocation. The lack ofconfig: RunnableConfig = NonecausesTypeError: get_omi_product_info_tool() got an unexpected keyword argument 'config'.
- LangChain tool callers and runners automatically pass
- Strict required
query: strparameter without default:- If invoked without arguments or with
query=None, direct invocations raiseTypeError: missing 1 required positional argument: 'query'. queryinput is now coerced and stripped cleanly (query: Optional[str] = "").
- If invoked without arguments or with
- Payload validation for
context:- Validates that
contextis a valid dictionary before iterating.items().
- Validates that
- Log sanitization:
- Added
sanitize()on query and exception messages to prevent log injection.
- Added
Proposed Changes
- Add
config: RunnableConfig = None: Ensure full compatibility with LangChain agent loops and direct test harnesses. - Safe Query Coercion & Default:
Provide
query: Optional[str] = ""with safe type conversion. - Payload Validation & Efficient String Formatting:
Validate
isinstance(context, dict)and build output lines efficiently. - Hermetic Unit Tests:
Add
backend/tests/unit/test_omi_tools_guards.pyverifying 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)
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)
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! 🙏