Skip to content

Patches for langchain and removed detic dependencies#987

Merged
spomichter merged 2 commits intodevfrom
alexl_langchain_patch_dependency_cleanup
Jan 13, 2026
Merged

Patches for langchain and removed detic dependencies#987
spomichter merged 2 commits intodevfrom
alexl_langchain_patch_dependency_cleanup

Conversation

@alexlin2
Copy link
Contributor

Remove Detic dependencies and keep tool-call compatibility in human CLI

Summary

  • Drop Detic/CLIP/detectron2-related extras and UV sources from pyproject.toml.
  • Regenerate uv.lock to remove the Detic dependency tree.
  • Update humancli to read tool calls from normalized msg.tool_calls (with legacy fallback).

@alexlin2 alexlin2 requested a review from a team January 13, 2026 09:07
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 13, 2026

Greptile Overview

Greptile Summary

This PR removes Detic, CLIP, and detectron2 dependencies from the project while maintaining backward compatibility in the human CLI tool.

Key Changes

Dependency Removal (pyproject.toml):

  • Removed clip, detectron2, and related Detic GPU stack dependencies from the cuda extra
  • Removed clip from the misc extra
  • Cleaned up [tool.uv] configuration by removing clip and detectron2 git sources
  • Removed detectron2 from extra-build-dependencies

Human CLI Compatibility (humancli.py):

  • Added backward-compatible tool call handling that supports both legacy and modern formats
  • Legacy format: msg.additional_kwargs.get("tool_calls") with structure {"function": {"name": "...", "arguments": "..."}}
  • Modern format: msg.tool_calls attribute with structure {"name": "...", "args": {...}, "id": "...", "type": "tool_call"}
  • Enhanced _format_tool_call to handle both dict formats and serialize non-string arguments to JSON

Lock File (uv.lock):

  • Regenerated to remove 320 lines of Detic dependency tree

Minor Issues

The PR leaves some stale configuration references to dimos/models/Detic in ruff and mypy ignore patterns. These are harmless but should be cleaned up for consistency.

Note on Existing Code

While not introduced by this PR, dimos/manipulation/manip_aio_processer.py and dimos/manipulation/manip_aio_pipeline.py have unprotected imports of Detic2DDetector that will fail now that detectron2 is removed. However, these modules are not imported anywhere else in the codebase, so they won't cause immediate failures. The pattern used in dimos/perception/object_detection_stream.py (try/except around Detic import with DETIC_AVAILABLE flag) should be applied to these files in a follow-up PR.

Confidence Score: 4/5

  • This PR is safe to merge with minor cleanup recommended
  • The core changes are well-implemented: dependency removal is clean, tool call compatibility is properly handled with fallback logic, and the lock file was correctly regenerated. The only issues are minor style concerns (stale config references) that don't affect functionality. The backward-compatible approach for tool_calls ensures existing code continues to work. However, existing broken imports in manip_aio files (not introduced by this PR) should be addressed in a follow-up.
  • No files in this PR require special attention. The changes are straightforward and well-tested patterns are used (similar to object_detection_stream.py's approach)

Important Files Changed

File Analysis

Filename Score Overview
dimos/utils/cli/human/humancli.py 4/5 Updated tool_calls handling to support both legacy (additional_kwargs) and new (msg.tool_calls attribute) formats with proper JSON serialization for non-string arguments
pyproject.toml 3/5 Removed Detic/CLIP/detectron2 dependencies and related build configurations, but stale references remain in ruff/mypy ignore patterns and breaking imports exist in manip_aio files
uv.lock 5/5 Regenerated lockfile with 320 lines removed, successfully removing Detic dependency tree

Sequence Diagram

sequenceDiagram
    participant Agent as Agent/LLM
    participant Transport as pLCMTransport
    participant HumanCLI as HumanCLI App
    participant Format as _format_tool_call

    Agent->>Transport: Publish AIMessage
    Note over Agent,Transport: msg.tool_calls or<br/>msg.additional_kwargs["tool_calls"]
    
    Transport->>HumanCLI: receive_msg(AIMessage)
    
    HumanCLI->>HumanCLI: Check msg.tool_calls attribute
    alt msg.tool_calls exists
        Note over HumanCLI: Use modern format<br/>{"name": "...", "args": {...}}
    else msg.tool_calls is None
        HumanCLI->>HumanCLI: Fallback to additional_kwargs
        Note over HumanCLI: Use legacy format<br/>{"function": {"name": "...", "arguments": "..."}}
    end
    
    loop For each tool_call
        HumanCLI->>Format: _format_tool_call(tool_call)
        
        alt Legacy format (has "function" key)
            Format->>Format: Extract function.name and function.arguments
        else Modern format
            Format->>Format: Extract name and args directly
        end
        
        alt args is not string
            Format->>Format: json.dumps(args)
        end
        
        Format-->>HumanCLI: "▶ name(args)"
        HumanCLI->>HumanCLI: Display tool call with timestamp
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 13, 2026

Additional Comments (2)

pyproject.toml
This ruff ignore pattern references dimos/models/Detic/* which no longer exists in the codebase. Consider removing this stale configuration.


pyproject.toml
The mypy exclude pattern still references ^dimos/models/Detic(/|$) which is no longer present. Consider cleaning up this stale configuration:

exclude = "^dimos/rxpy_backpressure(/|$)|.*/test_.|.*/conftest.py*"

@spomichter spomichter merged commit 546b280 into dev Jan 13, 2026
6 checks passed
@spomichter spomichter deleted the alexl_langchain_patch_dependency_cleanup branch January 13, 2026 11:12
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.

2 participants