File size: 4,998 Bytes
d60dd84
ee67aea
6b116c4
ee67aea
 
 
fb22343
 
6eb6858
d60dd84
 
 
6b116c4
d60dd84
 
6b116c4
ee67aea
6b116c4
 
 
d60dd84
 
6b116c4
d60dd84
 
6b116c4
d60dd84
 
 
6b116c4
 
d60dd84
6b116c4
d60dd84
 
 
 
6b116c4
 
 
d60dd84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b116c4
d60dd84
 
 
 
 
6b116c4
 
 
 
 
 
d60dd84
 
6b116c4
 
d60dd84
6b116c4
 
 
d60dd84
6b116c4
 
 
d60dd84
6b116c4
 
 
 
d60dd84
6b116c4
 
d60dd84
 
 
 
6b116c4
d60dd84
 
 
6b116c4
d60dd84
6b116c4
 
 
 
 
d60dd84
 
6b116c4
d60dd84
 
 
 
 
 
 
6b116c4
fb22343
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import os

# 1) Set up environment so HF caches models in /tmp/hf
os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf"
os.environ["HF_HOME"] = "/tmp/hf"

from langchain_community.llms import HuggingFacePipeline
from langchain.agents import initialize_agent
from langchain.agents.agent_types import AgentType
from langchain.tools import BaseTool
from transformers import pipeline

# 2) Use a smaller model + force_download=True to avoid partial downloads
pipe = pipeline(
    "text-generation",
    model="bigscience/bloom-560m",
    tokenizer="bigscience/bloom-560m",
    device=-1,               # CPU only
    max_new_tokens=256,      # A smaller limit speeds up generation
    force_download=True      # Forces a fresh download if needed
)

# 3) Wrap the pipeline in a LangChain LLM
llm = HuggingFacePipeline(pipeline=pipe)

# 4) Define your custom tool for generating the machinery report
class MachineryReportTool(BaseTool):
    name = "machinery_report"
    description = (
        "This tool compiles a detailed report on the mini construction equipment project, "
        "including specifications, market analysis, and production considerations."
    )

    def _run(self, query: str) -> str:
        report = """
        ## Comprehensive Report on Mini Construction Equipment Project
        ### Overview
        The project involves designing and building construction machinery tailored for the local South African market. 
        The focus is on developing cost-effective, high-performance machines that can compete with expensive American-made 
        equipment while leveraging local manufacturing strengths.
        ### 1. Equipment Details
        - **Basic Gas-Powered Auction Unit**
          - Price: $3,700
          - Engine: 14 horsepower gas motor
          - Configuration: Two pump system
          - Capabilities: Digging, Scooping, Auger Operation, Trenching, Pallet Fork Operation
        - **DRT 450**
          - Original Price: $8,500 (current base price: $5,500-6,300)
          - Engine: Twin cylinder Honda gas motor
          - Pump System: Triple pump configuration
          - Compatible Attachments: Mulcher, Brush Cutter, Harley Rake, Trencher
        - **Mini Skid Steer (New Acquisition)**
          - Price: $15,000
          - Engine: Kubota diesel
          - Control: Pilot controls with vertical lift arms
          - Notable Feature: Mulcher attachment ($2,000)
        - **Mini Excavators (Kimron Units)**
          - Unit 1: One-ton unit with Briggs & Stratton engine
          - Unit 2: 3,500 lb unit with Yanmar diesel engine
          - Supplier: K&R Equipment (Oklahoma)
        ### 2. Market Comparison and Cost Impact
        - **American Equivalents:** Bobcat MT100, Kubota SCCL1000, Ditch Witch SK900 ($38,000 to $45,000+).
        - **Tariff Impact:** 
          - DRT 450: ~$6,300 base + 25% + additional 10% (~$630) = ~$9,000.
          - Mini Skid Steer: ~$9,300 + ~$5,000 shipping + 10% tariff (~$930) = ~$16,000.
        - **Competitive Advantage:** 
          Even with tariffs, Chinese equipment can be 25-30% the cost of American machines.
        ### 3. Designing and Building Locally in South Africa
        - **Local Manufacturing Advantages:**
          - "Made in South Africa" branding for local pride.
          - Custom designs for local farming and construction.
        - **Production Considerations:**
          - Assemble components locally to reduce tariffs.
          - Partner with local engineering firms.
          - Comply with SA standards (and international if exporting).
        - **Market Entry Strategies:**
          - Pilot production, gather feedback, scale.
          - Target local contractors/farmers.
          - Check government incentives for local manufacturing.
        ### 4. Next Steps & Recommendations
        - **R&D:** Prototypes + real-world testing.
        - **Supply Chain:** Local suppliers, modular designs.
        - **Financing:** Bank loans, grants, investor funding.
        - **Compliance:** Prepare for certifications and warranties.
        ### Conclusion
        Building "Made in South Africa" machinery meets a real need for affordable, durable equipment, 
        potentially disrupting a market dominated by high-priced American brands.
        """
        return report

    def _arun(self, query: str) -> str:
        raise NotImplementedError("Async not supported.")

tools = [MachineryReportTool()]

# 5) Initialize the agent with max_iterations=1 to avoid looping
agent = initialize_agent(
    tools=tools,
    llm=llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True,
    max_iterations=1
)

# 6) Run the agent with your query
query = (
    "Using the available tools, please compile a detailed research report on the "
    "mini construction equipment project, including design, market analysis, and production "
    "specifications based on the provided machinery details."
)

result = agent.run(query)
print("\n===== AGENT OUTPUT =====")
print(result)