pritmanvar-bacancy commited on
Commit
accb514
·
verified ·
1 Parent(s): 657b169

initial commit

Browse files
PriceEstimation/__pycache__/classify.cpython-310.pyc ADDED
Binary file (603 Bytes). View file
 
PriceEstimation/__pycache__/price_predict.cpython-310.pyc ADDED
Binary file (609 Bytes). View file
 
PriceEstimation/classify.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+
3
+
4
+ def predict_class(model_path, img_path, conf=0.7):
5
+ # Load the model
6
+ model = YOLO(model_path)
7
+ # Get the results for the given image
8
+ results_list = model(img_path, conf=conf)
9
+
10
+ # Ensure results_list is not empty and access the first result
11
+ if results_list:
12
+ results = results_list[0]
13
+ # Access the probabilities
14
+ probs = results.probs
15
+ if probs is not None:
16
+ # Find the class index with the highest probability (top1)
17
+ class_idx = probs.top1
18
+ class_name = results.names[class_idx]
19
+ return class_name
20
+ else:
21
+ return "No probabilities found in the results."
22
+ else:
23
+ return "No results returned by the model."
PriceEstimation/price_predict.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def waste_tyre_price(quality, category):
2
+ if quality not in {'good', 'poor', 'worst'}:
3
+ return "Invalid quality"
4
+
5
+ if category == 'truck':
6
+ if quality == 'good':
7
+ return 1000
8
+ elif quality == 'poor':
9
+ return 900
10
+ elif quality == 'worst':
11
+ return 800
12
+ elif category == 'car':
13
+ if quality == 'good':
14
+ return 700
15
+ elif quality == 'poor':
16
+ return 600
17
+ elif quality == 'worst':
18
+ return 500
19
+ elif category == 'bike':
20
+ if quality == 'good':
21
+ return 480
22
+ elif quality == 'poor':
23
+ return 380
24
+ elif quality == 'worst':
25
+ return 280
PriceEstimation/qulity_predictor_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdcdc749a688173a7a2b4720556f14aecffd2230efe84373cea85da11229751f
3
+ size 2966081
Tyre.png ADDED
app.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import streamlit as st
3
+ import random
4
+ from app_config import SYSTEM_PROMPT, NLP_MODEL_NAME, NUMBER_OF_VECTORS_FOR_RAG, NLP_MODEL_TEMPERATURE, NLP_MODEL_MAX_TOKENS, VECTOR_MAX_TOKENS, SLOT_ID_PATTERN, INVOICE_NUM_PATTERN
5
+ from utils.functions import get_vectorstore, tiktoken_len
6
+ from langchain.memory import ConversationSummaryBufferMemory
7
+ from langchain_groq import ChatGroq
8
+ from langchain.agents import initialize_agent
9
+ from langchain.agents.agent_types import AgentType
10
+ from dotenv import load_dotenv
11
+ from pathlib import Path
12
+ import os
13
+ from tools.tools import response_generator,cancle_ongoing_process,cancle_slot,get_invoice,get_slot_details,schedule_slot,update_slot,price_estimation
14
+ import session_manager
15
+ env_path = Path('.') / '.env'
16
+ load_dotenv(dotenv_path=env_path)
17
+
18
+
19
+ st.markdown(
20
+ """
21
+ <style>
22
+ .st-emotion-cache-janbn0 {
23
+ flex-direction: row-reverse;
24
+ text-align: right;
25
+ }
26
+ .st-emotion-cache-1ec2a3d{
27
+ display: none;
28
+ }
29
+ </style>
30
+ """,
31
+ unsafe_allow_html=True,
32
+ )
33
+
34
+ # Intialize chat history
35
+ print("SYSTEM MESSAGE")
36
+ if "messages" not in st.session_state:
37
+ st.session_state.messages = [{"role": "system", "content": SYSTEM_PROMPT}]
38
+
39
+ print("SYSTEM MODEL")
40
+ if "llm" not in st.session_state:
41
+ st.session_state.llm = ChatGroq(temperature=NLP_MODEL_TEMPERATURE, groq_api_key=str(os.getenv('GROQ_API_KEY')), model_name=NLP_MODEL_NAME)
42
+
43
+ print("rag")
44
+ if "rag_memory" not in st.session_state:
45
+ st.session_state.rag_memory = ConversationSummaryBufferMemory(
46
+ llm=st.session_state.llm, max_token_limit=NLP_MODEL_MAX_TOKENS - tiktoken_len(SYSTEM_PROMPT) - VECTOR_MAX_TOKENS*NUMBER_OF_VECTORS_FOR_RAG)
47
+
48
+ print("retrival")
49
+ if "retriever" not in st.session_state:
50
+ st.session_state.retriever = get_vectorstore().as_retriever(k=NUMBER_OF_VECTORS_FOR_RAG)
51
+
52
+ print("agent_history")
53
+ if "agent_history" not in st.session_state:
54
+ st.session_state.agent_history = {}
55
+
56
+ print("next agent")
57
+ if "next_agent" not in st.session_state:
58
+ st.session_state.next_agent = "general_agent"
59
+
60
+ print("last_query")
61
+ if "last_query" not in st.session_state:
62
+ st.session_state.last_query = ""
63
+
64
+ print("last_tool")
65
+ if "last_tool" not in st.session_state:
66
+ st.session_state.last_tool = ""
67
+
68
+ print("agent")
69
+ session_manager.set_session_state(st.session_state)
70
+ # intilize all tools
71
+ if "agents" not in st.session_state:
72
+
73
+ st.session_state.agents = {"general_agent": initialize_agent(tools=[response_generator, schedule_slot, cancle_ongoing_process, cancle_slot, update_slot, get_slot_details, get_invoice, price_estimation],
74
+ llm=st.session_state.llm,
75
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
76
+ verbose=True,
77
+ max_iterations=3,
78
+ handle_parsing_errors=True,
79
+ ),
80
+ "slot_booking_agent": initialize_agent(tools=[schedule_slot, cancle_ongoing_process],
81
+ llm=st.session_state.llm,
82
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
83
+ verbose=True,
84
+ max_iterations=3,
85
+ handle_parsing_errors=True),
86
+ "slot_canclelation_agent": initialize_agent(tools=[cancle_slot, cancle_ongoing_process],
87
+ llm=st.session_state.llm,
88
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
89
+ verbose=True,
90
+ max_iterations=3,
91
+ handle_parsing_errors=True),
92
+ "slot_update_agent": initialize_agent(tools=[update_slot, cancle_ongoing_process],
93
+ llm=st.session_state.llm,
94
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
95
+ verbose=True,
96
+ max_iterations=3,
97
+ handle_parsing_errors=True),
98
+ "get_invoice_agent": initialize_agent(tools=[get_invoice, cancle_ongoing_process],
99
+ llm=st.session_state.llm,
100
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
101
+ verbose=True,
102
+ max_iterations=3,
103
+ handle_parsing_errors=True),
104
+ "price_estimation_agent": initialize_agent(tools=[price_estimation, cancle_ongoing_process],
105
+ llm=st.session_state.llm,
106
+ agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
107
+ verbose=True,
108
+ max_iterations=3,
109
+ handle_parsing_errors=True),
110
+ }
111
+
112
+ if img_file_buffer := st.file_uploader('Upload a Tyre image', type=['png', 'jpg', 'jpeg'],accept_multiple_files=False,label_visibility="hidden"):
113
+ with open(os.path.join("Tyre.png"), "wb") as f:
114
+ f.write(img_file_buffer.getbuffer())
115
+
116
+
117
+ print("container")
118
+ # Display chat messages from history
119
+ container = st.container(height=600)
120
+ for message in st.session_state.messages:
121
+ if message["role"] != "system":
122
+ with container.chat_message(message["role"]):
123
+ if message['type'] == "table":
124
+ st.dataframe(message['content'].set_index(message['content'].columns[0]))
125
+ elif message['type'] == "html":
126
+ st.markdown(message['content'], unsafe_allow_html=True)
127
+ else:
128
+ st.write(message["content"])
129
+
130
+ # When user gives input
131
+ if prompt := st.chat_input("Enter your query here... "):
132
+ with container.chat_message("user"):
133
+ st.write(prompt)
134
+ st.session_state.messages.append({"role": "user", "content": prompt,"type":"string"})
135
+ st.session_state.last_query = prompt
136
+
137
+ with container.chat_message("assistant"):
138
+ current_conversation = """"""
139
+
140
+ if st.session_state.next_agent != "general_agent" and st.session_state.next_agent in st.session_state.agent_history:
141
+ for message in st.session_state.agent_history[st.session_state.next_agent]:
142
+ if message['role'] == 'user':
143
+ current_conversation += f"""user: {message['content']}\n"""
144
+ if message['role'] == 'assistant':
145
+ current_conversation += f"""ai: {message['content']}\n"""
146
+
147
+ current_conversation += f"""user: {prompt}\n"""
148
+
149
+ print("***************************************** HISTORY ********************************************")
150
+ print(st.session_state.agent_history)
151
+
152
+ print("****************************************** Messages ******************************************")
153
+ print("messages", current_conversation)
154
+ print()
155
+ print()
156
+ response = st.session_state.agents[st.session_state.next_agent](current_conversation)['output']
157
+ print("******************************************************** Response ********************************************************")
158
+ print("MY RESPONSE IS:", response)
159
+ if st.session_state.last_tool == "get-invoice-tool":
160
+ st.session_state.messages.append({"role": "assistant", "content": response, "type": "html"})
161
+ st.markdown(response, unsafe_allow_html=True)
162
+ elif st.session_state.last_tool == "slot-fetching-tool":
163
+ st.dataframe(response['df'].set_index(response['df'].columns[0]))
164
+ st.write(f"Congratulations!!! You have recycled ***{response['num_of_tyres']}*** tyres.")
165
+ st.session_state.messages.append({"role": "assistant", "content": response['df'], "type": "table"})
166
+ st.session_state.messages.append({"role": "assistant", "content": f"Congratulations!!! You have recycled ***{response['num_of_tyres']}*** tyres.", "type": "string"})
167
+ else:
168
+ st.write(response)
169
+ st.session_state.messages.append({"role": "assistant", "content": response, "type": "string"})
170
+
171
+ if st.session_state.last_tool == "question-answer-tool":
172
+ st.session_state.rag_memory.save_context({'input': prompt}, {'output': response})
app_config.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ # Debug switch
4
+ DEBUG = False
5
+
6
+
7
+ # Settings for OpenAI NLP models. Here, NLP tokens are not to be confused with user chat or image generation tokens
8
+ # SYSTEM_PROMPT = """
9
+ # 1. You are a virtual assistant with a specific focus on providing expert information and answers related to Tyrex, a company that specializes in recycling tyres. You are knowledgeable about all aspects of Tyrex's operations, including their recycling processes, environmental impact, benefits, and overall mission. you can't answer any question which are not related to tyre or tyrex company. now you are not any chatbot which gives every quetions answer. if you can't answer the quetions then tell them "Thank you for your question! I'm here to help with information related to tyre recycling and our company. If you have any queries about those topics, feel free to ask. For other questions, I recommend reaching out to the appropriate source. Is there anything specific you'd like to know about tyre recycling or our company?" nothing else.
10
+ # 2. You can answer any questions about what Tyrex does, how it works, its environmental impact, and the benefits of tyre recycling. You should provide clear, concise, and accurate information to help users understand the value and importance of Tyrex's work.
11
+ # 3. If a user poses a question outside the domain of Tyrex's or tyre recycling, you are strictly instructed to decline politely and redirect them to questions related to Tyrex. Additionally, suggest that they contact "Tyrex" for expert assistance in those specific areas, providing the website and contact number as resources.
12
+ # 4. Your role is to serve as a highly knowledgeable assistant, providing high-level information and support related to Tyrex and its tyre recycling initiatives. Engage with users as if you are an expert in tyre recycling, ready to tackle any questions and provide detailed insights into Tyrex's operations and environmental impact.
13
+ # 5. any company related information must be answered from provided context only, you must not to answer outside to the context.
14
+ # context: {context}
15
+
16
+ # previous_message_summary: {previous_message_summary}
17
+ # """
18
+
19
+ SYSTEM_PROMPT = """
20
+ 1. You are a virtual assistant with a specific focus on providing expert information and answers related to Tyrex, a company that specializes in recycling tyres and tyre recycling. You are knowledgeable about all aspects of Tyrex's operations, including their recycling processes, environmental impact, benefits, and overall mission, additionally you can't answer any question which are not related to tyre or tyrex company. now you are not any chatbot which gives every quetions answer. if you can't provide the answer of the quetions then only tell them "Thank you for your question! I'm here to help with information related to tyre recycling and our company. If you have any queries about those topics, feel free to ask. For other questions, I recommend reaching out to the appropriate source. Is there anything specific you'd like to know about tyre recycling or our company?" nothing else.
21
+ 2. You can answer any questions about what Tyrex does, how it works, its environmental impact, and the benefits of tyre recycling. You should provide clear, concise, and accurate information to help users understand the value and importance of Tyrex's work.
22
+ 3. If a user poses a question outside the domain of Tyrex's or tyre recycling, you are strictly instructed to decline politely and redirect them to questions related to Tyrex. Additionally, suggest that they contact "Tyrex" for expert assistance in those specific areas, providing the website and contact number as resources.
23
+ 4. Your role is to serve as a highly knowledgeable assistant, providing high-level information and support related to Tyrex and its tyre recycling initiatives. Engage with users as if you are an expert in tyre recycling, ready to tackle any questions and provide detailed insights into Tyrex's operations and environmental impact.
24
+ 5. User can also give you some greetings like thank you, welcome, please, sorry etc... so you have to handle it appropriately without giving any unnecessary information which is not wanted by user.
25
+ 6. any company related information must be answered from provided context only, you must not to answer outside to the context.
26
+
27
+ context: {context}
28
+
29
+ previous_message_summary: {previous_message_summary}
30
+ """
31
+
32
+ SLOT_ID_PATTERN = r"\bSLOT-\d+\b"
33
+ INVOICE_NUM_PATTERN = r"\d{5}"
34
+
35
+
36
+ NLP_MODEL_NAME = "llama3-70b-8192"
37
+ REASONING_MODEL_NAME = "mixtral-8x7b-32768 "
38
+ REASONING_MODEL_TEMPERATURE = 0
39
+ NLP_MODEL_TEMPERATURE = 0
40
+ NLP_MODEL_MAX_TOKENS = 5400
41
+ VECTOR_MAX_TOKENS = 384
42
+ VECTORS_TOKEN_OVERLAP_SIZE = 20
43
+
44
+ NUMBER_OF_VECTORS_FOR_RAG = 7
45
+
46
+ ROOT_DIR = os.path.abspath(os.curdir)
databases/invoice.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "10000":{
3
+ "Date":"27-05-2024",
4
+ "Time":"5:00",
5
+ "Company Name":"Tyrex",
6
+ "items":[
7
+ {
8
+ "Category":"Truck",
9
+ "Qulity":"Good",
10
+ "Quntity":5,
11
+ "price_per_unit":1000
12
+ },
13
+ {
14
+ "Category":"Bike",
15
+ "Qulity":"poor",
16
+ "Quntity":15,
17
+ "price_per_unit":380
18
+ },
19
+ {
20
+ "Category":"Car",
21
+ "Qulity":"Good",
22
+ "Quntity":10,
23
+ "price_per_unit":700
24
+ }
25
+ ]
26
+ },
27
+ "10001":{
28
+ "Date":"28-05-2024",
29
+ "Time":"15:00",
30
+ "Company Name":"Tyrex",
31
+ "items":[
32
+ {
33
+ "Category":"Truck",
34
+ "Qulity":"poor",
35
+ "Quntity":5,
36
+ "price_per_unit":900
37
+ },
38
+ {
39
+ "Category":"Bike",
40
+ "Qulity":"good",
41
+ "Quntity":15,
42
+ "price_per_unit":480
43
+ },
44
+ {
45
+ "Category":"Car",
46
+ "Qulity":"worst",
47
+ "Quntity":10,
48
+ "price_per_unit":500
49
+ }
50
+ ]
51
+ }
52
+ }
databases/slots.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ slot_id,address,num_of_tyres,pickup_date,status
2
+ SLOT-0,bacancy house,12,03-06-2024,Cancled
3
+ SLOT-1,"139, surat",21,31-05-2024,Cancled
4
+ SLOT-2,"surat, gujarat, india",43,29-05-2024,Booked
5
+ SLOT-3,"ahmedabad, gujarat",44,06-06-2024,Booked
6
+ SLOT-4,"t/4, vasna, ahmedabad-380007",4,29-05-2024,Cancled
7
+ SLOT-5,"t/4,Sugam Apartment, vasna, ahmedabad-380007",5,31-05-2024,Booked
8
+ SLOT-6,"t/6, vasna ahmedabad-380007",6,28-05-2024,Booked
9
+ SLOT-7,"t/4, vasna ahmedabad-370007",4,05-06-2024,Booked
10
+ SLOT-8,"t/4, vasna, ahmedabad-380007",4,01-06-2024,Booked
11
+ SLOT-9,"t/13, vasna , surat-368098",1,01-06-2024,Booked
12
+ SLOT-10,surat-23345,14,31-05-2024,Booked
13
+ SLOT-11,"5, Surat, India",1,30-05-2024,Booked
14
+ SLOT-12,"r/13, ahmedabad-43797",1,03-06-2024,Booked
15
+ SLOT-13,"r-11, ahmedabad-380007",1,31-05-2024,Booked
16
+ SLOT-14,Ahmedabad,1,31-05-2024,Booked
17
+ SLOT-15,"bacancy house, Ahmedabad",15,03-06-2024,Booked
18
+ SLOT-16,"Bacancy house, Ahmedabad, Gujarat",50,31-05-2024,Cancled
19
+ SLOT-17,h/123 vansa,15,31-05-2024,Cancled
20
+ SLOT-18,bacancy house,5,19-07-2024,Cancled
databases/tyrex_data.txt ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ With 80% of used tires recycled each year in the US, disused rubber is proving beneficial in a multitude of industries, lauded as a versatile material that would otherwise spend its days clogging our waste disposal systems. From sustainable fuels that drive innovation to the 56 million tires used in civil engineering projects to overhaul our infrastructure, and even providing a gentle cushioning in playgrounds to nurture future generations, the durable nature of tires are paving the way to a new age of sustainability, keeping our landfills clear and our air fresh, one recycled tire at a time.
2
+ We're moving 200-300% more used tires in every move, dramatically reducing our carbon footprint. Revolutionizing the scrap tire industry, one tire at a time.
3
+ Leveraging technology to gain efficiency is just what we do. We've developed a proprietary, patented tire compaction technology that makes it quicker and easier to collect, process and dispose of car and light truck waste tires.
4
+
5
+
6
+ WHY RECYCLE
7
+ With 290 million tires discarded in the US annually, transforming mass waste into a selection of practical solutions comes hand-in-hand with an endless list of benefits. Ultimately, tire recycling plays an active role in creating a greener future for the children of tomorrow, from the environmental impact to keeping our communities safe.
8
+
9
+ No more landfills filled with tires!
10
+
11
+ With tires responsible for taking up to 75% of landfill space due to their bulky size and round shape, eliminating rubber from landfills will have the invaluable benefit of freeing up space for non-recyclable items. Reducing unsightly waste, keeping our landfills to a minimum will have a positive impact on wildlife, pollution, and disease.
12
+
13
+ Halt the spread of diseases.
14
+
15
+ More than a provision for the future, ensuring your discarded tires find the right home will play a role in keeping your loved ones healthy. Providing a sanctuary for unwelcome visitors, disused tires encourage the reproduction of vermin, enhancing the spread of disease in your local area. According to Kim Biggs of the Illinois Environmental Protection Agency, one tire can produce more than 10,000 adult mosquitoes. A community savior, proper disposal is vital.
16
+
17
+ A better future.
18
+
19
+ The key to sustainability, re-purposing disused items is not just ethically encouraged, but useful too! From a one-of-a-kind doormat that welcomes guests to eye-catching outdoor furniture sets that wow, the versatility of tires knows no bounds. Whether you see yourself as something of a DIYer or you'd like to pass on your discarded items to a new home, each tire harnesses a number of materials that can transform into an entirely new purpose.
20
+
21
+ Illegal disposal is too common
22
+
23
+ What happens when we illegally dispose of our used tires? To many, recycling is yet another chore to add to the to-do list, often falling to the bottom of the pile in favor of more timely demands. But with a multitude of harmful impacts, it is vital to ensure your used tires make their way to the appropriate facility efficiently. The consequences fall into four main categories: Disease, fire hazard, environmental impact, and waste.
24
+
25
+ Ultimately, improper tire disposal is not a victimless act, with the negative impacts seeping into our communities. More than adding yet another tire to the bottomless heap, adding to waste means playing a role in wreaking havoc for ecosystems, with harsh chemicals entering our environment and water supply. A non-biodegradable blend of materials, the hazardous chemicals within tires release toxins into the environment, with harsh compounds slowly making their way through the soil and towards water supply over time, before being consumed by animals and marine life, with potentially fatal effects.
26
+
27
+ Burning rubbers can have disastrous consequences
28
+
29
+ Similarly, the makeup of tires presents a distinct fire risk that should not be dismissed. When exposed to heat, the combination of synthetic and natural rubbers can have disastrous consequences. In October 1983, a fire burned between 5-7 million tires over the course of 9 months, allowing tar to enter the local water supply. Noticeably difficult to extinguish due to the combustible nature of tires, rubber catching fire is not only a risk to those in the vicinity, but also releases hazardous chemicals into the air to impact the wider community.
30
+
31
+ KEY FEATURES
32
+ Make a greener future.
33
+ Minimize landfill buildup of tires.
34
+ Eliminate habitats for vermin, pests, and mosquitoes.
35
+ Make a better future.
36
+
37
+
38
+ THE FUTURE OF TIRES
39
+ Spearheading a vast range of transformative solutions, properly recycled tires ensure a new lease of life, providing practical items in the plenty. Offering the ultimate golden trio; durable, versatile, and readily available, used tires are transforming a range of spaces, from the construction realm to the roads we frequent daily.
40
+
41
+ Utilized since the 1960s, tires are used in asphalt binder as part of a performance-enhancing initiative, improving the road surface, enhancing the durability of the highway, and reducing the volume from tire-asphalt friction. With an almost endless supply, roads across the US can benefit from a dependable, sustainable answer to their road-improvement plans, while playing a role in keeping the planet green.
42
+
43
+ Tires are used in roadways, for performance enhancing
44
+
45
+ Similarly, sports facilities across the nation are benefiting from ultra-robust tires lining their perimeters. Produced in the form of crumb rubber, athletes will notice a marked difference in the surface of their arenas, with used tires creating a gentle cushioning to help avoid shin-splints and joint pain. An exceptionally reliable all-weather material, crumb rubber is known as a quick-drying, easily-draining, anti-freezing option, all while remaining sustainable.
46
+
47
+ Tire rubber used in sports provides softer ground
48
+
49
+ According to the Environmental Protection Agency, the biggest use of used tires is TDF, or tire-derived fuel, with 130 million tires turned into fuel each year. A 2009 report by Rubber Manufacturers Association found that TDF is '8% cleaner and more economical alternative to coal', with 41% of the fuel used for the cement industry, with the rest distributed between pulp and paper mills, electric utilities, and industrial boilers. Targeting the A-to-Z of fuel-using industries, tires are reducing the demand for climate-hurting fossil fuels, with the share declining from 94% in 1966 to 80% in 2019
50
+
51
+ KEY FEATURES
52
+ Tires used as asphalt binders.
53
+ Keep the planet green.
54
+ Crumb Rubber for sports facilities.
55
+ Tire recycling reduces the use of fossil fuels.
56
+
57
+
58
+ DISEASES ARE PREVENTABLE STARTING WITH YOU!
59
+ Providing a warm, safe, and sheltered home for troublesome creatures, our disused tires offer a home for vermin if not properly disposed of. Carrying a multitude of diseases, including Weil's disease, salmonella, tuberculosis, E.Coli, and foot and mouth disease (and more!), attracting rats to your region will wreak havoc within human populations, agriculture, and ecosystems. And it's not just a concern in the event of a bite – simply inhaling particles or consuming contaminated food/ water can put you at risk of potentially fatal diseases. An often-neglected thought, there is a direct impact between the disposal of our disused tires and the health of those in our communities.
60
+
61
+ There is a direct impact between the disposal of our disused tires and the health of those in our communities
62
+
63
+ Similarly, mosquitoes prefer warmer environments, leading them to set up camp within landfill-bound tires. With one tire producing over 10,000 adult mosquitoes, and the mini insects known to carry a range of harmful viruses including the West Nile virus, as well as Dengue, chikungunya, and Zika in the past, a quick trip to the recycling center will have potentially life-saving consequences for those around you.
64
+
65
+ One tire can produce 10,000 adult mosquitoes
66
+
67
+ KEY FEATURES
68
+ Tires can house vermin and pests.
69
+ Sitting tires provide optimal breeding grounds for mosquitoes.
70
+ Stock piled tires can disrupt a small town.
71
+
72
+
73
+ DANGERS OF TIRE STOCKPILES
74
+ Stockpiles of tires are dangerous for a number of reasons. Mainly, towered up piles of tires can catch fire releasing large amounts of dangerous and toxic materials into the atmosphere and polluting the local area.
75
+
76
+ In addition to toxic air emissions, the burning of tires creates water and soil pollution. "For every million tires consumed by fire, about 55,000 gallons of runoff oil can pollute the environment unless contained and collected. This oily material is also highly flammable,"-EPA This oily material is also highly flammable, making any large tire fires a significant environmental event.
77
+
78
+ For every million tires consumed by fire, about 55,000 gallons of runoff oil can pollute the environment.
79
+
80
+ A further reason is that stockpiled tires provide a breeding ground for vermin such as rats, and can form conditions for disease spreading mosquitos. Clearly, this in itself is a strong reason to avoid the practice of stockpiling.
81
+
82
+ KEY FEATURES
83
+ Prevent Tire Fires.
84
+ Minimize pollution.
85
+ Eliminate housing for pests and vermin.
86
+
87
+
88
+ STOP DANGEROUS FIRES BEFORE THEY START
89
+ Notably difficult to extinguish, a readiness for reigniting, and brimming with materials that become harmful when burned, tire fires are exceptionally difficult to combat. When improperly disposed of, tires are often placed side-by-side with flammable materials, with catastrophic consequences. With pollution released into the atmosphere, tire fires can contaminate the water supply in the region, namely potentially fatal sulfur dioxide and carbon dioxide.
90
+
91
+ ...the synthetic and natural rubber combination can result in fires that burn for years...
92
+
93
+ A result of extreme weather conditions, as well as arson, the synthetic and natural rubber combination can result in fires that burn for years. While specialist equipment may be able to control the fire – albeit while contaminating the soil – the inside of the tire often smolders, resulting in fires that reignite unexpectedly. If left, the environment will impact from the thick, black smoke emitted into the atmosphere, causing an aggravation in health problems, impacts on wildlife, and long-term effects to the water supply.
94
+
95
+ For every million tires consumed by fire, about 55,000 gallons of runoff oil can pollute the environment.
96
+
97
+ KEY FEATURES
98
+ Tire Fires are hard to put out.
99
+ Putting out tire fires causes local soil contamination.
100
+ Pollution from tire fires can result in potentially fatal conditions.
101
+
102
+
103
+ DISEASES ARE PREVENTABLE STARTING WITH YOU!
104
+ Providing a warm, safe, and sheltered home for troublesome creatures, our disused tires offer a home for vermin if not properly disposed of. Carrying a multitude of diseases, including Weil's disease, salmonella, tuberculosis, E.Coli, and foot and mouth disease (and more!), attracting rats to your region will wreak havoc within human populations, agriculture, and ecosystems. And it's not just a concern in the event of a bite – simply inhaling particles or consuming contaminated food/ water can put you at risk of potentially fatal diseases. An often-neglected thought, there is a direct impact between the disposal of our disused tires and the health of those in our communities.
105
+
106
+ There is a direct impact between the disposal of our disused tires and the health of those in our communities
107
+
108
+ Similarly, mosquitoes prefer warmer environments, leading them to set up camp within landfill-bound tires. With one tire producing over 10,000 adult mosquitoes, and the mini insects known to carry a range of harmful viruses including the West Nile virus, as well as Dengue, chikungunya, and Zika in the past, a quick trip to the recycling center will have potentially life-saving consequences for those around you.
109
+
110
+ One tire can produce 10,000 adult mosquitoes
111
+
112
+ KEY FEATURES
113
+ Tires can house vermin and pests.
114
+ Sitting tires provide optimal breeding grounds for mosquitoes.
115
+ Stock piled tires can disrupt a small town.
116
+
117
+
118
+ TURNING OLD TIRES INTO NEW IDEAS
119
+ An incredibly versatile blend of materials, tires have an endless list of future identities. From the practical to the innovative, the durable nature of tires makes them an attractive candidate for re-purposing. A sustainable resource, creating future-proof items while helping you slash costs, it's a triple threat!
120
+
121
+ Working hand-in-hand with a multitude of industries, tire recycling plays a role in the long-term health of planet Earth. A practical solution to climate change, greenhouse gas emissions, and water wastage, whether that's bike stands from halved tires, playground pavements from crumb rubber, or landfill liners from chipped tires, each recycled tire provides a sustainable answer to our needs. With 197 million scrap tires recycled or re-purposed annually, the looming environmental era is paving the way for a greener tomorrow.
122
+
123
+ A sustainable resource, creating future-proof items while helping you slash costs...
124
+
125
+ In a trailblazing age where green is good and longevity beats disposability, we are welcoming a new generation of sustainable products. Creating rustic planters without the cost and state-of-the-art mats that last, as well as ultra-edgy bags and sturdy footwear, our homes, gardens, outfits, and even daily lives can benefit from the tires that would otherwise spend the next century creating eyesore landfills. Innovative solutions with lasting results!
126
+
127
+ KEY FEATURES
128
+ 197 million scrap tires recycled annually
129
+ Rubber is durable and long-lasting, making it great for re-purposing.
130
+ Minimize pollution by recycling tires.
131
+
132
+
133
+ RESPONSIBLY RE-PURPOSE
134
+ More than a transformation from tire to table, rubber has the advantage of being an incredibly durable, weather-proof, and versatile material; A winner for those outdoor escapades, interiors antics, and wardrobe re-freshers. We're not just talking hard-wearing sandboxes and swings – from unique planters with a lick of paint and a new home for your furry friend to one-of-a-kind sandals and even outdoor furniture to act as the ultimate conversation-starter, the opportunities for disused tires are endless.
135
+
136
+ The most commonly seen re-purposing of tires is undoubtedly flooring...
137
+
138
+ Not content with just adding a sprinkle of quirkiness into your home environment, tires are incredibly useful away from their position under your vehicle. Packed with practical materials such as steel, fiber, and nylon, industries including construction, solar, and food processing can all benefit from your decision to recycle your tires. Additionally, tire-derived fuel offers the advantage of energy efficiency, reducing climate-changing emissions, thus unlocking guilt-free journeys.
139
+
140
+ The most commonly seen re-purposing of tires is undoubtedly flooring. Offering an unrivaled level of grip, spaces including children's playgrounds, sports facilities, railroads, and even landfills are all benefitting from the durability that tires provide. From water-proof crumb rubber providing a supportive foundation to chipped tire landfill liners helping stop toxins reaching our soils, as well as skid-proof rubberized asphalt used as pavements, re-purposing is a sustainability savior, combatting the A-to-Z of environmental concerns, namely greenhouse gas emissions, climate change, and environmental contaminants.
141
+
142
+ KEY FEATURES
143
+ Recycled rubber is durable, weather-proof, and versatile.
144
+ Recycled rubber can be used for many things including outdoor furniture to footwear.
145
+ Be responsible, choose to recycle your tires.
146
+
147
+
148
+ By today we have recycles 12,693,259 tyres successfully.
149
+
150
+ EVERYONE DESERVES A SECOND CHANCE, INCLUDING TIRES
151
+ Giving your disused tires a new lease of life, we are committed to bridging the gap between your rubber waste and thriving local businesses, bustling playgrounds, and sustainable resources, tapping 'refresh' on the typical tire lifecycle. A hub of innovation, we're hitting the brakes on toxic landfill sites, harmful pollutants, and material scarcity, creating a greener future for the next generation.
152
+
153
+ ANOTHER CHANCE. A BETTER FUTURE.
154
+
155
+ As a company, we are constantly seeking to develop and implement environmentally acceptable and economically viable end-use markets for scrap tires to increase the recycling and the reuse endeavors for end-of-life regeneration of the scrap tire components for the responsible processing and eventual marketable disposal outlets. Our overall objective is to create a sustainable infrastructure for using scrap tire resources over the long term. It is Tyrex' intent to take advantage of these opportunities and be the provider of choice to recycle and transform scrap tires into its base components, create good, solid paying jobs and provide innovative solutions to the waste tire dilemma facing the nation.
156
+
157
+ Tyrex resources is giving tires their second chance, and building a better future for tomorrow.
158
+
159
+ TIRE DERIVED FUEL (TDF)
160
+ With almost half of scrap tires in the US later finding themselves powering concrete kilns, paper mills, and utilities in the form of tire-derived fuel (TDF), shredded tires present a greener way to access fuel. The epitome of 'another chance', TDF offers far more than a fast-track route towards a plummeting number of tires clogging our fire-starting, pest-loving landfills; emitting fewer fossil fuels than its counterparts, shredded tires produce 25% more energy, fewer heavy metals, and fewer emissions when compared to coal – a measurable 'win' for the environment, public health, and future of our planet.
161
+ Often blended with wood or coal, shredded tires are regarded as a stellar energy source due to their high heat value – reducing costs, enhancing boiler efficiency, and boasting a higher BTU value, the amount of heat required to raise its temperature, than coal. Shredded into 3/4" - 2" chips to kickstart the burning process, it is often encouraged to add TDF to coal due to its emission-reducing nature, striking a balance between being environmentally friendly and cost-effective; as long as we have tires, TDF will be a viable option, catapulting sustainability.
162
+
163
+ TIRE DERIVED AGGREGATE (TDA)
164
+ Tire-derived aggregate, or TDA, represents the process of shredding scrap tires for use within the construction industry, acting as a sustainable, budget-conscious, highly durable alternative to traditional fill materials. Often used within civil engineering projects, namely embankments, rail systems, landfill drainage, and septic systems, TDA is lauded for its exceptional drainage abilities, lightweight nature, and low earth pressure.
165
+ Depending on its intended purpose, tires will be shredded to between 2"-12", with the smaller pieces used as a drainage aid and the larger pieces used as a filling material or as a piping cover. For large-scale infrastructure, tires may be left whole for use within a bale, offering 8-times better thermal insulation than gravel.
166
+ An incredibly durable material, far surpassing the rigidity and permeability of stone, TDA is renowned for its refusal to wear down, representing an option low in costly maintenance and disruptive repairs. While usage is subject to the approval of the U.S. Environmental protection Agency, TDA is a sought-after choice for shooting ranges, as well as within the construction industry for retaining walls, reinforcing roads, and protecting against erosion, championed for its compressible abilities.
167
+
168
+ TRUCK TIRE SIDEWALLS
169
+ Representing the height of versatility, the uses of disused tires are continually evolving, replacing the need for costly new materials while slashing harmful emissions. With the rubber industry representing one of the biggest contributors to deforestation, and each rubber tree merely producing 8-12 tires before it reaches the end of its lifespan, a new era of sustainability is required to combat scarcity – and the inevitable skyrocketing price of rubber.
170
+ Tire sidewalls – the 'smooth' section spanning from the tread shoulder to the rim bead – are utilized by a multitude of industries, celebrated for their weatherproof, durable nature. From being given 'another chance' as silage protection, called upon by farmers to create an airtight field to keep vermin, mold, disease, and air exposure away from farm feed, through to fostering a new role as a construction barrel (big traffic cones), with tire sidewalls tasked with holding down traffic barrels or channelizer drums, recycled tires offer a cost-effective, eco-friendly route for businesses of all scopes.
171
+
172
+ CRUMB RUBBER
173
+ The height of innovation, the reach of crumb rubber spans throughout our daily lives, from the parking lot bumpers that protect our vehicles, the mats that support our joints at the gym, and the football field turf that we eyeball at every gameday. With cushioning effects and a weather-proof nature, crumb rubber is often called upon for cost-effective, hard-wearing support, with usage within the railway industry in a bid to reduce noise, road paving to repair potholes, cycling tracks to aid a smoother ride, children's playgrounds to combat slipping, and brick pavers for durability, all with little maintenance required.
174
+ Made from recycled tires, crumb rubber is the result of a meticulous process to grind scrap tires down to powder form while being stripped of steel and fabric. Measured in 'mesh', with one mesh equivalent to 1 square inch, one tire can account for up to 40 mesh particles, developed in one of two ways; ambient grinding and cryogenic processing. The former takes tires through a shredder, fabric separator, and a screener to ensure each piece solely contains rubber, and the latter separates the tire into pieces through freezing, a crucial route to avoiding heat degradation. Tackling deforestation head-on, crumb rubber combats the need for new rubber, plummeting our carbon footprint.
175
+
176
+ TIRE PYROLYSIS
177
+ Championed as a simple, cost-effective option by factories globally, namely those responsible for the development of steel and cement, tire pyrolysis is extensively used within the production of methanol, charcoal, oil, natural gas, and recovered carbon black, among others. Replacing fossil fuels, tire pyrolysis offers a pivotal opportunity to break into base commodities purely using recycled products; a green technology, converting disused tires into in-demand materials.
178
+ An eco-friendly process, tire pyrolysis involves melting tires down to their base components, with the outcome weighted equally between steel, oil/gas, and carbon black – an additive used to reinforce rubber. With steel often recycled by steel factories, gas recycled to heat the reactor, recovered black carbon used to produce rubber products, and pyrolysis oil hosting a multitude of uses, the process serves a vast range of industries. Fuel oil spans four main uses; to generate electricity within a heavy oil generator, to be used as non-standard diesel, to be sold to a multitude of industries, and recycled back into the pyrolysis machine, thus relied upon by several international markets.
179
+
180
+
181
+ tyrex products:
182
+ TDF
183
+ The go-to for pulp and paper mills, electrical utilities, industrial boilers, and powerhouses in the cement industry, our expertly handled tire-derived fuel is celebrated for its ever-expanding list of benefits. From driving boiler efficiency to stamping out emissions, we're known as the leading TDF supplier in the region, nurturing the process from tire pick-up to TDF drop-off.
184
+ TDA
185
+ Where cost-efficiency meets sustainability, tire-derived aggregate offers a key resource for civil engineering projects, presenting unparalleled durability. Shunning toxin-heavy landfills in favor of supporting ever-evolving structures, we offer TDA for use within backfill, stone aggregate replacement, and septic systems, with our tires presenting a superior, environmentally responsible alternative to conventional fill.
186
+ CRUSHED RIMS
187
+ A 'win' for those seeking environmentally friendly, budget-conscious aluminum and steel, we offer high-quality crushed rims for all purposes. Hitting the brakes on costly mining, our recycled resources can be utilized across communities, from revamping pipes and train tracks to putting an industrial stamp on your décor options.
188
+ OTR TIRES
189
+ From pocket-sized home-gyms to sprawling fitness centers, our off-the-road tires are a must-have for workout facilities everywhere, introducing a greener way to train. Representing the gold standard of sustainable fitness solutions, each tire is meticulously cleaned, conditioned, and inspected before making its way into the hands of goal-getters across the nation.
190
+ TIRE BEAD (HIGH CARBON STEEL)
191
+ Lauded for its unmatched flexibility, strength, and wear-resistance, our multifaceted tire bead wire represents a green source of high-carbon steel, bringing new realms of sustainability to your operations. From bridges, ball bearings, and bolts to airplane components, our tire bead wires boast a minimum of 0.60% carbon, with our commitment to excellence weaved through the full A-to-Z.
192
+ TRUCK TIRE SIDEWALLS
193
+ Partnering with some of the region's leading construction firms, we hand over exceptional quality, hand-vetted truck tire sidewalls for use within projects of all scopes. Whether you're seeking an eco-friendly traffic barrel weight or ultra-durable, weatherproof silage protection, our recycled tires add a sustainable touch, balancing output with ethics.
194
+
195
+
196
+ WHY CHOOSE US
197
+
198
+ With 290 million tires discarded in the US each year – almost one waste tire per citizen – industry disruption is crucial to minimize the environmental impact. Our response? To reimagine the waste tire management realm, calling upon trailblazing patented technologies to drive change. Championing a revolutionized approach to waste tire management, we combat environmental concerns head-on, giving businesses across the region an opportunity to make a difference, while tapping into remarkable financial benefits.
199
+
200
+ Built upon a foundation of innovation, attention to detail, and budget-conscious services, Tyrex leads the curve, pushing the boundaries of what can be achieved through advanceding technology. Striking a balance between consistency and creativity, we are in a class of our own, recognized equally for our rich industry specialization and our drive to do 'what’s is right', fostering greener processes for future generations.
201
+
202
+ Redefining the tire disposal industry one collection at a time, we are renowned for crushing the status quo. From devising the blueprint of responsible waste tire collection to curating a patented, proprietary tire compaction process, we are transforming the tire collection market as we know it, reeling in a new age of sustainability. Through our stringent procedures, environmental commitment, and eye for the imaginative, we go beyond expectations; a space where efficiency meets effectiveness, revolutionizing the industry.
203
+
204
+ Ultimately, Tyrex is underpinned by a series of aims; to lead with unparalleled professionalism, efficiency, and productivity, while helping our customers access enhanced customer service and cost avoidance. When handing over your used-tire disposal responsibilities to us, we help you steer clear of costly equipment, manpower, and output-reducing duties, helping you focus your time where it counts: Goal-getting. Continually striving to better our processes, industry, and environment, we see ourselves as an extension of your team, outdoing competitors on speed, efficacy, and price point.
205
+
206
+ The home of our sought-after environmentally-focused Tyrex team, we're making a stand. Are you joining us?
207
+
208
+
209
+ WHAT IS A UNIQUE/NON-UNIQUE PURCHASE?
210
+ Non-exclusive purchase means that other people can buy the template you have chosen some time later. Exclusive or unique purchase guarantees that you are the last person to buy this template. After an exclusive purchase occurs the template is being permanently removed from the sales directory and will never be available to other customers again. Only you and people who bought the template before you will own it.
211
+
212
+
213
+ HOW DOES PRICING WORK FOR WASTE TIRE PICKUP?
214
+ Our pricing is unique to the customer's situation. It is optimized depending on location, how many waste tires we will be picking up when we visit, how many waste tires you may be producing on a monthly basis, and how frequently you would like us to stop by. The one constant is that the only thing you can expect to pay is the cost per scrap tire collected - no added fees. Call us today for a quote on (888) 558 1919!
215
+
216
+
217
+ phone number: (888) 558-1919
218
+ email: info@tyrex.io
219
+ address: 572 Whitehead Road, Trenton, NJ 08638
220
+ address: 2485 Maysville Pike, Zanesville, OH 43701
221
+ address: 710 Grass Run Rd, Weston, WV 26452
222
+
223
+
224
+ HOW CAN I PAY FOR MY SERVICE?
225
+ We accept Automatic ACH, Visa, MasterCard, and American Express credit cards, and checks via mail for your convenience.
226
+
227
+
228
+ CAN WE DROP OFF WASTE TIRES?
229
+ Of course! You can drop scrap tires off at any of our multiple recycling facilities. Just call (888) 558-1919 to schedule.
230
+
231
+
232
+ HOW FREQUENTLY CAN YOU SERVICE CUSTOMERS AT-STORE FOR?
233
+ Our customers can opt for one of two service types:
234
+
235
+ Simply call us whenever you need a waste tire pick-up. We are typically able to get to you within 2 business days of a request, irrespective of quantity!
236
+
237
+ Or, we can automate a service based on your unique desires and requirements. We're proud of the level of service we are able to offer our customers. We have those we visit every single day, some once every two months, and all in between. Wherever you may fall on this spectrum, be it once every 2 days, or once a week, you tell us and our advanced computer systems are going to make it happen. Few industry operators can deliver the high-end frequency with the consistency and dependability that we do.
238
+
239
+
240
+ WHAT DO YOU DO WITH THE TIRES AFTER PICKUP?
241
+ The "End of Life" market for used tires is continuously evolving, for this reason our method of recycling scrap tires after pickup is constantly adapting and improving each time it does. The consistency that we like to convey in this process is that 100% of the waste tires that we collect are recycled, and not ending up in a ditch on the side of the road somewhere!
242
+
243
+ The lack of environmentally friendly operators is something that has plagued the tire disposal industry for decades - it's one of the main reasons we got in to this business! At Tyrex we invest a LARGE amount of our time and resources in to ensuring that all elements of our business and its operations are completely eco-friendly and Department of Environmental Protection compliant. So you can rest assured that partnering with us is a choice to ensure you and your business are in the best footing possible when it comes to protecting yourself and our planet.
244
+
245
+ Read about our "Another Chance" tire program where we re-use tires in every way we can.
246
+
247
+
248
+ WASTE TIRE MANAGEMENT
249
+ To us, our role entails far more than expert-led tire management. Ensuring your collection scheduling is taken care of, handling a seamless behind-the-scenes, and representing the driving force behind a new age of responsible tire disposal, we have gone the extra mile to become recognized as the gold standard of environmentally friendly used tire disposal handlers.
250
+
251
+ Working at your pace, our customers benefit from tailored collections, from multiple weekly pickups to impromptu tire clean-ups, each customized to fit your needs. Executing outstanding services, while offering measurable cost savings, we are at the forefront of the industry, leading with integrity.
252
+
253
+
254
+ SPECIAL SITUATION CLEANUP
255
+ While collecting tires on our scheduled route is our 'gig', we value the importance of versatility. With a team of hands-on, dedicated, and driven specialists in tow, we are often called upon to handle special situations that need to be met with an enhanced level of precision, care, and attention.
256
+
257
+ If you believe your used tire scenario is slightly out of the ordinary, we'd love to discuss the necessary measures needed to aid a safe clean-up. Simply contact our friendly team and we'll kickstart the process, from delivering accurate quotes in advance to slotting you into our schedule with an air of urgency.
258
+
259
+
260
+ HASSLE-FREE SCHEDULING
261
+ At our core, our role is to make your day-to-day easier. The result? A smooth-running scheduling program, designed to bridge the gap between you and a minimal 'to do' list. The home of lightning-fast tire collections, we ease the weight from your shoulders.
262
+
263
+ From ad-hoc tire pickups in line with your requirements to scheduled waste tire collections, we take pride in re-imagining convenience. Utilizing our in-house technology to analyze your needs, we are able to pinpoint the number of tires you typically produce, before honing a collection schedule to suit. Through bespoke, customer-first programs, we hit the brakes on time-consuming scheduling.
264
+
265
+
266
+ PAPERLESS BILLING
267
+ Lauded for our trailblazing nature, our state-of-the-art approach doesn't stop at our front door. Having curated an all-in-one hub to digitally store information, we are committed to delivering a seamless A-to-B, tapping into advanced technology to streamline the customer experience.
268
+
269
+ Our solution-seeking strategy is what makes us… us, calling upon unique, one-of-a-kind programs to deliver unparalleled customer service, while reducing outlays so we can pass on those savings to you; our valued, quality-focused customers. With everything stored in the cloud, we can track and manage each tire collection virtually, even with photos and signatures, before securely viewing and paying invoices, ensuring every 'T' is crossed and 'I' is dotted.
270
+
271
+
272
+ EXCEPTIONAL CUSTOMER SERVICE
273
+ At Tyrex, our commitment to excellence is weaved through our every move. From our drive to deliver cutting-edge technologies to building a tight-knit team of fully insured, experienced, and courteous drivers from the ground up, we're on a mission to redefine waste tire collection, with stellar customer service lying at the forefront.
274
+
275
+ Ultimately, we understand that there are various scrap tire removal routes on offer. Through our push for change, we have secured our status as industry leaders. Challenging the status quo, our underpinning aim is to build a legacy that embraces our core values; customer-oriented, environmentally responsible, and pioneering, with an eye for innovation.
276
+
277
+
278
+ WHAT DO YOU DO WITH THE TIRES AFTER PICKUP?
279
+ The "End of Life" market for used tires is continuously evolving, for this reason our method of recycling scrap tires after pickup is constantly adapting and improving each time it does. The consistency that we like to convey in this process is that 100% of the waste tires that we collect are recycled, and not ending up in a ditch on the side of the road somewhere!
280
+
281
+ The lack of environmentally friendly operators is something that has plagued the tire disposal industry for decades - it's one of the main reasons we got in to this business! At Tyrex we invest a LARGE amount of our time and resources in to ensuring that all elements of our business and its operations are completely eco-friendly and Department of Environmental Protection compliant. So you can rest assured that partnering with us is a choice to ensure you and your business are in the best footing possible when it comes to protecting yourself and our planet.
282
+
283
+ Read about our "Another Chance" tire program where we re-use tires in every way we can.
284
+
285
+
286
+ CAN WE DROP OFF WASTE TIRES?
287
+ Of course! You can drop scrap tires off at any of our multiple recycling facilities. Just call (888) 558-1919 to schedule.
288
+
289
+
290
+ HOW CAN I PAY FOR MY SERVICE?
291
+ We accept Automatic ACH, Visa, MasterCard, and American Express credit cards, and checks via mail for your convenience.
292
+
293
+
294
+ HOW FREQUENTLY CAN YOU SERVICE CUSTOMERS AT-STORE FOR?
295
+ Our customers can opt for one of two service types:
296
+
297
+ Simply call us whenever you need a waste tire pick-up. We are typically able to get to you within 2 business days of a request, irrespective of quantity!
298
+
299
+ Or, we can automate a service based on your unique desires and requirements. We're proud of the level of service we are able to offer our customers. We have those we visit every single day, some once every two months, and all in between. Wherever you may fall on this spectrum, be it once every 2 days, or once a week, you tell us and our advanced computer systems are going to make it happen. Few industry operators can deliver the high-end frequency with the consistency and dependability that we do.
300
+
301
+
302
+ HOW DOES PRICING WORK FOR WASTE TIRE PICKUP?
303
+ Our pricing is unique to the customer's situation. It is optimized depending on location, how many waste tires we will be picking up when we visit, how many waste tires you may be producing on a monthly basis, and how frequently you would like us to stop by. The one constant is that the only thing you can expect to pay is the cost per scrap tire collected - no added fees. Call us today for a quote on (888) 558 1919!
304
+
305
+
306
+ WHAT IS A UNIQUE/NON-UNIQUE PURCHASE?
307
+ Non-exclusive purchase means that other people can buy the template you have chosen some time later. Exclusive or unique purchase guarantees that you are the last person to buy this template. After an exclusive purchase occurs the template is being permanently removed from the sales directory and will never be available to other customers again. Only you and people who bought the template before you will own it.
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ langchain
3
+ langchain_groq
4
+ python-dotenv
5
+ langchain_community
6
+ langchain_chroma
7
+ tiktoken
8
+ sentence_transformers
9
+ ultralytics
tools/__pycache__/tools.cpython-310.pyc ADDED
Binary file (15.2 kB). View file
 
tools/tools.py ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import random
3
+ from app_config import SYSTEM_PROMPT, SLOT_ID_PATTERN, INVOICE_NUM_PATTERN,ROOT_DIR
4
+ from utils.schemas import ChatBotInput, SlotScheduleInput, SlotUpdateInput
5
+ from PriceEstimation.classify import predict_class
6
+ from PriceEstimation.price_predict import waste_tyre_price
7
+ from langchain.agents import tool
8
+ from langchain_core.messages import SystemMessage, HumanMessage
9
+ from dotenv import load_dotenv
10
+ from pathlib import Path
11
+ import pandas as pd
12
+ from datetime import datetime, timedelta
13
+ import os
14
+ import json
15
+ env_path = Path('.') / '.env'
16
+ load_dotenv(dotenv_path=env_path)
17
+
18
+ import session_manager
19
+
20
+ session_state = session_manager.get_session_state()
21
+ @tool("question-answer-tool", args_schema=ChatBotInput, return_direct=True)
22
+ def response_generator(prompt: str) -> str:
23
+ """this function can be used for general quetion answers which are related to tyrex and tyre recycling
24
+
25
+ Args:
26
+ prompt (string): user query
27
+
28
+ Returns:
29
+ string: answer of the query
30
+ """
31
+
32
+ try:
33
+ session_state = session_manager.get_session_state()
34
+ session_state.last_tool = "question-answer-tool"
35
+ prompt = session_state.last_query
36
+
37
+ print("my_Prompt is", prompt)
38
+ print()
39
+ print()
40
+ retriever = session_state.retriever
41
+ docs = retriever.invoke(prompt)
42
+ my_context = [doc.page_content for doc in docs]
43
+ my_context = '\n\n'.join(my_context)
44
+
45
+ print("***************************** CONTEXT *****************************")
46
+ print(my_context)
47
+
48
+ system_message = SystemMessage(content=SYSTEM_PROMPT.format(context=my_context, previous_message_summary=session_state.rag_memory.moving_summary_buffer))
49
+ chat_messages = (system_message + session_state.rag_memory.chat_memory.messages + HumanMessage(content=prompt)).messages
50
+
51
+ print("messages", chat_messages)
52
+ print()
53
+ print()
54
+ response = session_state.llm.invoke(chat_messages)
55
+ print(response)
56
+
57
+ return response.content
58
+
59
+ except Exception as error:
60
+ print(error)
61
+ return "Oops! something went wrong, please try again."
62
+
63
+
64
+ @tool("slot-scheduling-tool", args_schema=SlotScheduleInput, return_direct=True)
65
+ def schedule_slot(address, tyre_counts) -> str:
66
+ """this function can be used for scheduling or booking slot
67
+
68
+ Args:
69
+ address (string): Address to pickup the tyres
70
+ tyre_counts (int): Number of the tyres to pickup
71
+
72
+ Returns:
73
+ string: final responce which user needs
74
+ """
75
+
76
+ try:
77
+ session_state = session_manager.get_session_state()
78
+ session_state.last_tool = "slot-scheduling-tool"
79
+ if "slot_booking_agent" in session_state.agent_history:
80
+ session_state.agent_history['slot_booking_agent'].append({"role": "user", "content": session_state.last_query})
81
+ else:
82
+ session_state.agent_history['slot_booking_agent'] = [{"role": "user", "content": session_state.last_query}]
83
+
84
+ session_state.next_agent = "slot_booking_agent"
85
+
86
+ try:
87
+ tyre_counts = int(tyre_counts)
88
+ except Exception as error:
89
+ tyre_counts = None
90
+ print(error)
91
+
92
+ words = ['provide', 'give me ', 'address', 'need', 'want', 'needs', 'wants']
93
+ is_valid_address = True
94
+ for word in words:
95
+ if word in address.lower():
96
+ is_valid_address = False
97
+ break
98
+
99
+ if (not address or not is_valid_address) and not tyre_counts:
100
+ response = "We will need your address and number of tyres to pick up to book a slot. also you can type **CANCLE** to cancle ongoing process of slot scheduling."
101
+ session_state.agent_history['slot_booking_agent'].append({"role": "assistant", "content": response})
102
+ return response
103
+ elif not address or not is_valid_address:
104
+ response = "We will need your address to book a slot. also you can type **CANCLE** to cancle ongoing process of slot scheduling."
105
+ session_state.agent_history['slot_booking_agent'].append({"role": "assistant", "content": response})
106
+ return response
107
+ elif not tyre_counts:
108
+ response = "We will need number of tyres to pick up to book a slot. also you can type **CANCLE** to cancle ongoing process of slot scheduling."
109
+ session_state.agent_history['slot_booking_agent'].append({"role": "assistant", "content": response})
110
+ return response
111
+
112
+ day = random.randint(1, 10)
113
+
114
+
115
+ pickup_time = datetime.now() + timedelta(days=day)
116
+ df = pd.read_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))))
117
+ df.loc[len(df)] = [f"SLOT-{len(df)}", address, tyre_counts, pickup_time.strftime('%d-%m-%Y'), "Booked"]
118
+ df.to_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))), index=False)
119
+ response = f"Your slot has been booked with slot id ***{df.iloc[-1]['slot_id']}*** our pickup agent will come at ***{pickup_time.strftime('%d-%m-%Y')}*** at your address ***{address}*** to pickup ***{tyre_counts}*** tyres."
120
+
121
+ session_state.agent_history['slot_booking_agent'] = []
122
+ session_state.next_agent = "general_agent"
123
+ return response
124
+ except Exception as error:
125
+ print(error)
126
+ return error
127
+
128
+
129
+ @tool("slot-canclelation-tool", return_direct=True)
130
+ def cancle_slot(inp = None) -> str:
131
+ """this function can be used cancle booked slot.
132
+
133
+ Returns:
134
+ string: final responce after slot canclelation.
135
+ """
136
+
137
+ try:
138
+ session_state = session_manager.get_session_state()
139
+ session_state.last_tool = "slot-canclelation-tool"
140
+ if "slot_canclelation_agent" in session_state.agent_history:
141
+ session_state.agent_history['slot_canclelation_agent'].append({"role": "user", "content": session_state.last_query})
142
+ else:
143
+ session_state.agent_history['slot_canclelation_agent'] = [{"role": "user", "content": session_state.last_query}]
144
+
145
+ session_state.next_agent = "slot_canclelation_agent"
146
+
147
+ slot_id = None
148
+ for message in reversed(session_state.agent_history['slot_canclelation_agent']):
149
+ if message['role'] == 'user':
150
+ match = re.search(SLOT_ID_PATTERN, message['content'])
151
+ if match:
152
+ slot_id = match.group(0)
153
+ break
154
+
155
+ if slot_id is None:
156
+ response = "We will need a valid Slot id to Cancle a slot."
157
+ session_state.agent_history['slot_canclelation_agent'].append({"role": "assistant", "content": response})
158
+ return response
159
+
160
+ df = pd.read_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))))
161
+ if len(df[df['slot_id'] == slot_id]) > 0:
162
+ df.loc[df[df['slot_id']==slot_id]['status'].index[0], "status"] = 'Cancled'
163
+ df.to_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))), index=False)
164
+
165
+ response = f"Your slot with slot id ***{df.iloc[-1]['slot_id']}*** has been cancleled successfully."
166
+ session_state.agent_history['slot_canclelation_agent'] = []
167
+ session_state.next_agent = "general_agent"
168
+ return response
169
+
170
+ else:
171
+ response = f"We couldn't find any slot with slot id ***{slot_id}***. Please enter valid slot id."
172
+ session_state.agent_history['slot_canclelation_agent'].append({"role": "assistant", "content": response})
173
+ return response
174
+
175
+ except Exception as error:
176
+ print(error)
177
+ return error
178
+
179
+ @tool("slot-update-tool", args_schema=SlotUpdateInput, return_direct=True)
180
+ def update_slot(slot_id,address,tyre_counts) -> str:
181
+ """this function can be used update booked slot details like address or tyre count.
182
+
183
+ Args:
184
+ slot_id (string): Slot id to cancle a slot. Slot id must be in formate 'SLOT-*',
185
+ address (string): Address to pickup the tyres
186
+ tyre_counts (int): Number of the tyres to pickup
187
+
188
+ Returns:
189
+ string: final responce after slot updation.
190
+ """
191
+
192
+ try:
193
+ session_state = session_manager.get_session_state()
194
+ session_state.last_tool = "slot-update-tool"
195
+ if "slot_update_agent" in session_state.agent_history:
196
+ session_state.agent_history['slot_update_agent'].append({"role": "user", "content": session_state.last_query})
197
+ else:
198
+ session_state.agent_history['slot_update_agent'] = [{"role": "user", "content": session_state.last_query}]
199
+
200
+ session_state.next_agent = "slot_update_agent"
201
+
202
+ slot_id = None
203
+ for message in reversed(session_state.agent_history['slot_update_agent']):
204
+ if message['role'] == 'user':
205
+ match = re.search(SLOT_ID_PATTERN, message['content'])
206
+ if match:
207
+ slot_id = match.group(0)
208
+ break
209
+
210
+ df = pd.read_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))))
211
+
212
+ if slot_id is None or len(df[df['slot_id']==slot_id])==0:
213
+ response = "We will need a valid Slot id to update a slot."
214
+ session_state.agent_history['slot_update_agent'].append({"role": "assistant", "content": response})
215
+ return response
216
+
217
+ day = random.randint(1, 10)
218
+ pickup_time = datetime.now() + timedelta(days=day)
219
+
220
+ if df.loc[df[df['slot_id']==slot_id]['status'].index[0], "status"] != 'Booked':
221
+ response = "You can not update this slot because this slot is already " + str(df.loc[df[df['slot_id']==slot_id]['status'].index[0], "status"])+ "."
222
+ session_state.agent_history['slot_update_agent'] = []
223
+ session_state.next_agent = "general_agent"
224
+ return response
225
+
226
+ try:
227
+ tyre_counts = int(tyre_counts)
228
+ except Exception as error:
229
+ tyre_counts = None
230
+ print(error)
231
+
232
+ words = ['provide', 'give me ', 'address', 'need', 'want', 'needs', 'wants']
233
+ is_valid_address = True
234
+ for word in words:
235
+ if word in address.lower():
236
+ is_valid_address = False
237
+ break
238
+
239
+ if (not address or not is_valid_address) and not tyre_counts:
240
+ response = "We will need your address or number of tyres to pick up for update a slot. also you can type **CANCLE** to cancle ongoing process of slot scheduling."
241
+ session_state.agent_history['slot_update_agent'].append({"role": "assistant", "content": response})
242
+ return response
243
+
244
+ if len(df[df['slot_id'] == slot_id]) > 0 :
245
+
246
+ if address and is_valid_address:
247
+ # update address
248
+ df.loc[df[df['slot_id']==slot_id]['address'].index[0], "address"] = address
249
+
250
+ if tyre_counts:
251
+ # update tyre count
252
+ df.loc[df[df['slot_id']==slot_id]['num_of_tyres'].index[0], "num_of_tyres"] = tyre_counts
253
+
254
+ df.loc[df[df['slot_id']==slot_id]['pickup_date'].index[0], "pickup_date"] = pickup_time.strftime('%d-%m-%Y')
255
+ df.loc[df[df['slot_id']==slot_id]['status'].index[0], "status"] = 'Booked'
256
+
257
+ df.to_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))), index=False)
258
+
259
+ response = f"We have updated your slot with ***{slot_id}***. Now your address is ***{df[df['slot_id']==slot_id]['address'].iloc[0]}***. Number of tyres is ***{df[df['slot_id']==slot_id]['num_of_tyres'].iloc[0]}*** and new pickup time is ***{pickup_time.strftime('%d-%m-%Y')}***"
260
+
261
+ session_state.agent_history['slot_update_agent'] = []
262
+ session_state.next_agent = "general_agent"
263
+ return response
264
+ else:
265
+ response = f"We couldn't find any slot with slot id ***{slot_id}***. Please enter valid slot id."
266
+ session_state.agent_history['slot_update_agent'].append({"role": "assistant", "content": response})
267
+ return response
268
+
269
+ except Exception as error:
270
+ print(error)
271
+ return error
272
+
273
+
274
+ @tool("slot-fetching-tool", return_direct=True)
275
+ def get_slot_details(inp = None) -> str:
276
+ """this function can be used to get details of slots.
277
+
278
+ Returns:
279
+ pandas.core.frame.DataFrame: Dataframe which contains user slot details.
280
+ """
281
+
282
+ try:
283
+ session_state = session_manager.get_session_state()
284
+ session_state.last_tool = "slot-fetching-tool"
285
+ df = pd.read_csv(os.path.join(ROOT_DIR,str(os.getenv('SLOT_DETAILS_PATH'))))
286
+ num_of_tyres = df[df['status']=='Booked']['num_of_tyres'].sum()
287
+ return {"df": df, "num_of_tyres": num_of_tyres}
288
+
289
+ except Exception as error:
290
+ print(error)
291
+ return error
292
+
293
+
294
+ @tool("get-invoice-tool", return_direct=True)
295
+ def get_invoice(inp = None) -> str:
296
+ """this function can be used to get Invoice.
297
+
298
+ Returns:
299
+ string: final invoice.
300
+ """
301
+
302
+ try:
303
+ session_state = session_manager.get_session_state()
304
+ session_state.last_tool = "get-invoice-tool"
305
+ if "get_invoice_agent" in session_state.agent_history:
306
+ session_state.agent_history['get_invoice_agent'].append({"role": "user", "content": session_state.last_query})
307
+ else:
308
+ session_state.agent_history['get_invoice_agent'] = [{"role": "user", "content": session_state.last_query}]
309
+
310
+ session_state.next_agent = "get_invoice_agent"
311
+
312
+ invoice_num = None
313
+ print(session_state.agent_history['get_invoice_agent'])
314
+
315
+ for message in reversed(session_state.agent_history['get_invoice_agent']):
316
+ if message['role'] == 'user':
317
+ print()
318
+ print(message['content'])
319
+ match = re.search(INVOICE_NUM_PATTERN, message['content'])
320
+ print(match)
321
+ if match:
322
+ invoice_num = match.group(0)
323
+ break
324
+
325
+ if invoice_num is None:
326
+ response = "We will need a valid Invoice Number to get Invoice."
327
+ session_state.agent_history['get_invoice_agent'].append({"role": "assistant", "content": response})
328
+ return response
329
+ with open(os.path.join(ROOT_DIR,str(os.getenv('INVOICE_DETAILS_PATH'))),"r") as fp:
330
+ invoice_data = json.load(fp=fp)
331
+
332
+ if invoice_num in invoice_data:
333
+ data = invoice_data[invoice_num]
334
+ # Extract the necessary information from the JSON data
335
+ date = data["Date"]
336
+ time = data["Time"]
337
+ company_name = data["Company Name"]
338
+ items = data["items"]
339
+
340
+ # Create the HTML string
341
+ part_1 = f"""
342
+ <html>
343
+ <head>
344
+ <style>
345
+ .invoice-container {{
346
+ width: 100%;
347
+ padding: 20px;
348
+ }}
349
+ .invoice-header {{
350
+ text-align: center;
351
+ margin-bottom: 20px;
352
+ }}
353
+ .invoice-header h1 {{
354
+ margin: 0;
355
+ }}
356
+ .invoice-details, .invoice-footer {{
357
+ margin-bottom: 20px;
358
+ }}
359
+ .invoice-items {{
360
+ display: flex;
361
+ flex-direction: column;
362
+ }}
363
+ .invoice-item {{
364
+ display: grid;
365
+ grid-template-columns: 1fr 1fr 1fr 1fr;
366
+ align-content: center;
367
+ padding: 10px;
368
+ border-bottom: 1px solid #ddd;
369
+ }}
370
+ .item-header {{
371
+ font-weight: bold;
372
+ }}
373
+
374
+ </style>
375
+ </head>
376
+ <body>
377
+ <div class="invoice-container">
378
+ <div class="invoice-header">
379
+ <h1>INVOICE</h1>
380
+ <p><strong>Date:</strong> {date}</p>
381
+ <p><strong>Time:</strong> {time}</p>
382
+ <p><strong>Company Name:</strong> {company_name}</p>
383
+ </div>
384
+ <div class="invoice-details">
385
+ <div class="invoice-items">
386
+ <div class="invoice-item item-header">
387
+ <div>Category</div>
388
+ <div>Quality</div>
389
+ <div>Quantity</div>
390
+ <div>Price per Unit</div>
391
+ </div>
392
+ """
393
+
394
+ part_2 = ""
395
+ for item in items:
396
+ category = item["Category"]
397
+ quality = item["Qulity"]
398
+ quantity = item["Quntity"]
399
+ price_per_unit = item["price_per_unit"]
400
+ part_2 += (
401
+ f"<div class='invoice-item'>"
402
+ f"<div>{category}</div>"
403
+ f"<div>{quality}</div>"
404
+ f"<div>{quantity}</div>"
405
+ f"<div>${price_per_unit}</div>"
406
+ f"</div>"
407
+ )
408
+ part_3 = """
409
+ </div>
410
+ </div>
411
+ <div class="invoice-footer">
412
+ <p><strong>Thank you for recycling tyres with us!</strong></p>
413
+ </div>
414
+ </div>
415
+ </body>
416
+ </html>
417
+ """
418
+
419
+ # Display the HTML invoice using Streamlit
420
+ session_state.agent_history['get_invoice_agent'] = []
421
+ session_state.next_agent = "general_agent"
422
+ return f"""{part_1}
423
+ {part_2}
424
+ {part_3}"""
425
+
426
+ else:
427
+ response = f"We couldn't find any invoice with invoice number ***{invoice_num}***. Please enter valid invoice number."
428
+ session_state.agent_history['get_invoice_agent'].append({"role": "assistant", "content": response})
429
+ return response
430
+
431
+ except Exception as error:
432
+ print(error)
433
+ return error
434
+
435
+
436
+ @tool("price-estimation-tool", return_direct=True)
437
+ def price_estimation(inp = None) -> str:
438
+ """this function can be used to estimate price of the tyre.
439
+
440
+ Returns:
441
+ string: response which contains estimated price of tyre.
442
+ """
443
+
444
+ try:
445
+ session_state = session_manager.get_session_state()
446
+ session_state.last_tool = "price-estimation-tool"
447
+ if "price_estimation_agent" in session_state.agent_history:
448
+ session_state.agent_history['price_estimation_agent'].append({"role": "user", "content": session_state.last_query})
449
+ else:
450
+ session_state.agent_history['price_estimation_agent'] = [{"role": "user", "content": session_state.last_query}]
451
+
452
+ session_state.next_agent = "price_estimation_agent"
453
+
454
+ is_valid_file = Path("Tyre.png").is_file()
455
+
456
+ category = None
457
+ for message in reversed(session_state.agent_history['price_estimation_agent']):
458
+ if message['role'] == 'user':
459
+ for word in ['bike', 'car', 'truck']:
460
+ if word in message['content'].lower():
461
+ category = word
462
+ break
463
+
464
+ if not is_valid_file and not category:
465
+ response = "Please provide valid image of tyre and category of tyre. Category of tyre must be from car, bike or truck. Let me know once you uploaded a image of tyre."
466
+ session_state.agent_history['price_estimation_agent'].append({"role": "assistant", "content": response})
467
+ return response
468
+
469
+ elif not category:
470
+ response = "Please provide valid category of tyre. Category of tyre must be from car, bike or truck."
471
+ session_state.agent_history['price_estimation_agent'].append({"role": "assistant", "content": response})
472
+ return response
473
+
474
+ elif not is_valid_file:
475
+ response = "Plesase provide a image of tyre and let me know once you upload an image."
476
+ session_state.agent_history['price_estimation_agent'].append({"role": "assistant", "content": response})
477
+ return response
478
+
479
+ tyre_quality = predict_class(os.path.join(ROOT_DIR,str(os.getenv('QULITY_PREDICT_MODEL_PATH'))), 'Tyre.png')
480
+ print(tyre_quality)
481
+ tyre_price = waste_tyre_price(tyre_quality, category.lower())
482
+ print(tyre_price)
483
+
484
+ session_state.agent_history['price_estimation_agent'] = []
485
+ session_state.next_agent = "general_agent"
486
+ return f"Your tyre quality is {tyre_quality} and estimated price of your tyre is {tyre_price}"
487
+
488
+ except Exception as error:
489
+ print(error)
490
+ return error
491
+
492
+
493
+ @tool("process-canclelation-tool", return_direct=True)
494
+ def cancle_ongoing_process(inp = None) -> str:
495
+ """This function can be used to cancle any ongoing process.
496
+
497
+ Returns:
498
+ str: response after canclelation.
499
+ """
500
+ session_state = session_manager.get_session_state()
501
+ cancle_response = ""
502
+ if session_state.next_agent != "general_agent":
503
+ session_state.next_agent = "general_agent"
504
+ cancle_response = "Your ongoing process got cancleled."
505
+ else:
506
+ cancle_response = "You don't have any ongoing process to cancle."
507
+
508
+ session_state.agent_history = {}
509
+
510
+ return cancle_response
utils/__pycache__/functions.cpython-310.pyc ADDED
Binary file (1.5 kB). View file
 
utils/__pycache__/schemas.cpython-310.pyc ADDED
Binary file (1.83 kB). View file
 
utils/functions.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tiktoken
2
+ from langchain_text_splitters import RecursiveCharacterTextSplitter
3
+ from langchain_chroma import Chroma
4
+ from langchain_community.embeddings import HuggingFaceBgeEmbeddings
5
+
6
+ from app_config import VECTOR_MAX_TOKENS, VECTORS_TOKEN_OVERLAP_SIZE,ROOT_DIR
7
+ from dotenv import load_dotenv
8
+ from pathlib import Path
9
+ import os
10
+ env_path = Path('.') / '.env'
11
+ load_dotenv(dotenv_path=env_path)
12
+ tokenizer = tiktoken.get_encoding('cl100k_base')
13
+
14
+ # create the length function
15
+ def tiktoken_len(text):
16
+ tokens = tokenizer.encode(
17
+ text,
18
+ disallowed_special=()
19
+ )
20
+ return len(tokens)
21
+
22
+ def get_vectorstore():
23
+ model_name = "BAAI/bge-small-en"
24
+ model_kwargs = {"device": "cpu"}
25
+ encode_kwargs = {"normalize_embeddings": True}
26
+ hf = HuggingFaceBgeEmbeddings(
27
+ model_name=model_name, model_kwargs=model_kwargs, encode_kwargs=encode_kwargs
28
+ )
29
+
30
+ f = open(os.path.join(ROOT_DIR,str(os.getenv('TYREX_DATA_PATH'))), "r")
31
+ data = f.read()
32
+ text_splitter = RecursiveCharacterTextSplitter(
33
+ chunk_size=VECTOR_MAX_TOKENS,
34
+ chunk_overlap=VECTORS_TOKEN_OVERLAP_SIZE,
35
+ length_function=tiktoken_len,
36
+ separators=["\n\n\n","\n\n", "\n", " ", ""]
37
+ )
38
+
39
+ all_splits = text_splitter.split_text(data)
40
+
41
+ vectorstore = Chroma.from_texts(texts=all_splits ,embedding=hf)
42
+ return vectorstore
utils/schemas.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.pydantic_v1 import BaseModel, Field
2
+
3
+ class ChatBotInput(BaseModel):
4
+ prompt: str = Field(description="should be a user query")
5
+
6
+ class SlotScheduleInput(BaseModel):
7
+ address: str = Field(description="Address to pickup the tyres")
8
+ tyre_counts: str = Field(description="Number of the tyres to pickup")
9
+
10
+ class SlotDeleteInput(BaseModel):
11
+ slot_id: str = Field(description="Slot id to delete a slot. Slot id must be in formate 'SLOT-int', where int is any positive integer greater or equal to 0")
12
+
13
+
14
+ class SlotUpdateInput(BaseModel):
15
+ slot_id: str = Field(description="Slot id to delete a slot. Slot id must be in formate 'SLOT-int', where int is any positive integer greater or equal to 0")
16
+ address: str = Field(description="Address to pickup the tyres")
17
+ tyre_counts: str = Field(description="Number of the tyres to pickup")
18
+
19
+ class InvoiceGenInput(BaseModel):
20
+ invoice_num: str = Field(description="Invoice Number to generate the invoice. invoice number must be number between 10000 to 99999.")
21
+
22
+
23
+ class PriceEstimationInput(BaseModel):
24
+ category: str = Field(description="Category of the tyre. It must be from ['bike', 'car', 'truck']")
25
+