Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- Dockerfile +13 -0
- app.py +75 -0
- chatbot.py +68 -0
- dataset.txt +99 -0
- requirements.txt +10 -0
Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:latest
|
2 |
+
|
3 |
+
WORKDIR /
|
4 |
+
|
5 |
+
COPY ./requirements.txt .
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
8 |
+
|
9 |
+
COPY . .
|
10 |
+
|
11 |
+
EXPOSE 7860
|
12 |
+
|
13 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
4 |
+
|
5 |
+
from chatbot import Chatbot
|
6 |
+
|
7 |
+
# from utils.chatbotmemory import ChatbotMemory
|
8 |
+
|
9 |
+
import logging
|
10 |
+
|
11 |
+
from langchain_core.messages import AIMessage, HumanMessage
|
12 |
+
|
13 |
+
|
14 |
+
app = FastAPI()
|
15 |
+
|
16 |
+
# Add logging
|
17 |
+
|
18 |
+
logging.basicConfig(level=logging.INFO)
|
19 |
+
|
20 |
+
logger = logging.getLogger(__name__)
|
21 |
+
|
22 |
+
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|
23 |
+
|
24 |
+
handler = logging.StreamHandler()
|
25 |
+
|
26 |
+
handler.setFormatter(formatter)
|
27 |
+
|
28 |
+
logger.addHandler(handler)
|
29 |
+
|
30 |
+
# Add CORS
|
31 |
+
|
32 |
+
origins = ["*"]
|
33 |
+
|
34 |
+
app.add_middleware(
|
35 |
+
CORSMiddleware,
|
36 |
+
allow_origins=origins,
|
37 |
+
allow_credentials=True,
|
38 |
+
allow_methods=["GET", "POST", "PUT", "DELETE"],
|
39 |
+
allow_headers=["*"],
|
40 |
+
)
|
41 |
+
|
42 |
+
bot1 = Chatbot()
|
43 |
+
# bot2 = ChatbotMemory()
|
44 |
+
|
45 |
+
@app.get("/")
|
46 |
+
|
47 |
+
def read_root():
|
48 |
+
|
49 |
+
return {
|
50 |
+
|
51 |
+
"message": "API running successfully",
|
52 |
+
|
53 |
+
"endpoints": [
|
54 |
+
|
55 |
+
"/chat/v1/",
|
56 |
+
|
57 |
+
# "/chat/v2/",
|
58 |
+
|
59 |
+
]
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
@app.post("/chat/v1/")
|
64 |
+
def chat(q: str):
|
65 |
+
logger.info(q)
|
66 |
+
answer = bot1.rag_chain.invoke(q)
|
67 |
+
return {"answer": answer}
|
68 |
+
|
69 |
+
# @app.post("/chat/v2/")
|
70 |
+
# def chatMemory(q: str):
|
71 |
+
# chat_history = []
|
72 |
+
# logger.info(q)
|
73 |
+
# ai_msg = bot2.rag_chain.invoke({"question": q, "chat_history": chat_history})
|
74 |
+
# chat_history.extend([HumanMessage(content=q), ai_msg])
|
75 |
+
# return {"answer": ai_msg}
|
chatbot.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain.text_splitter import CharacterTextSplitter
|
2 |
+
from langchain_community.document_loaders import TextLoader
|
3 |
+
from langchain.schema.runnable import RunnablePassthrough
|
4 |
+
from langchain.schema.output_parser import StrOutputParser
|
5 |
+
from langchain_pinecone import PineconeVectorStore
|
6 |
+
from langchain.prompts import PromptTemplate
|
7 |
+
from langchain_google_genai import GoogleGenerativeAI, GoogleGenerativeAIEmbeddings
|
8 |
+
from dotenv import load_dotenv, find_dotenv
|
9 |
+
import os
|
10 |
+
from pinecone import Pinecone, PodSpec
|
11 |
+
|
12 |
+
load_dotenv(find_dotenv())
|
13 |
+
|
14 |
+
class Chatbot():
|
15 |
+
|
16 |
+
loader = TextLoader('dataset.txt', autodetect_encoding=True)
|
17 |
+
documents = loader.load()
|
18 |
+
text_splitter = CharacterTextSplitter(chunk_size=512, chunk_overlap=4)
|
19 |
+
docs = text_splitter.split_documents(documents)
|
20 |
+
|
21 |
+
embeddings = GoogleGenerativeAIEmbeddings(
|
22 |
+
model="models/embedding-001", task_type="retrieval_query", google_api_key=os.getenv("GEMINI_API_KEY")
|
23 |
+
)
|
24 |
+
|
25 |
+
pinecone = Pinecone(
|
26 |
+
api_key=os.environ.get("PINECONE_API_KEY")
|
27 |
+
# host='gcp-starter'
|
28 |
+
)
|
29 |
+
|
30 |
+
index_name = "thehexatechchatbot"
|
31 |
+
|
32 |
+
if index_name not in pinecone.list_indexes().names():
|
33 |
+
pinecone.create_index(name=index_name, metric="cosine", dimension=768, spec=PodSpec(environment="gcp-starter"))
|
34 |
+
docsearch = PineconeVectorStore.from_documents(docs, embeddings, index_name=index_name)
|
35 |
+
else:
|
36 |
+
docsearch = PineconeVectorStore.from_existing_index(index_name, embeddings)
|
37 |
+
|
38 |
+
|
39 |
+
llm = GoogleGenerativeAI(model="gemini-1.5-flash-latest", google_api_key=os.getenv("GEMINI_API_KEY"))
|
40 |
+
|
41 |
+
template = """
|
42 |
+
INSTRUCTION: Act as Personal Assistant chatbot of The Hexatech, an IT Startup that provides core hexa services: design, deployment, web development, ai & ml, software. this is conversation \
|
43 |
+
to a user who wants to get his query solved about The Hexatech. Use the CONTEXT to answer in a helpful manner to the QUESTION. \
|
44 |
+
If you don't know any ANSWER, say you don't know \
|
45 |
+
Always follow general guardrails before generating any response. \
|
46 |
+
Always try to keep the conversation in context to The Hexatech. Keep your replies short \
|
47 |
+
compassionate and informative.\
|
48 |
+
Give the answer from the CONTEXT\
|
49 |
+
You should help user to get his query solved and also try to increase engagement and promoting The Hexatech & its services.\
|
50 |
+
|
51 |
+
CONTEXT: {context}
|
52 |
+
QUESTION: {question}
|
53 |
+
ANSWER:
|
54 |
+
"""
|
55 |
+
|
56 |
+
prompt = PromptTemplate(
|
57 |
+
template=template,
|
58 |
+
input_variables=["context", "question"]
|
59 |
+
)
|
60 |
+
|
61 |
+
|
62 |
+
rag_chain = (
|
63 |
+
{"context": docsearch.as_retriever(), "question": RunnablePassthrough()}
|
64 |
+
| prompt
|
65 |
+
| llm
|
66 |
+
| StrOutputParser()
|
67 |
+
)
|
68 |
+
|
dataset.txt
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Design. Develop. Dominate
|
2 |
+
Hexa Core Services For Your Business.
|
3 |
+
we build success stories for you, get your business a lucky touch
|
4 |
+
|
5 |
+
previous clients:
|
6 |
+
Viridiv
|
7 |
+
Healscure
|
8 |
+
CodeLens
|
9 |
+
Viridiv
|
10 |
+
Healscure
|
11 |
+
CodeLens
|
12 |
+
|
13 |
+
Be the Achievers of Achievers
|
14 |
+
Unlock the full potential of your business with The Hexatech, your all-in-one partner for A-Z business solutions. From stunning designs to powerful development, strategic marketing, seamless deployment, and expert SEO—we’re here to turn your vision into reality.
|
15 |
+
Let’s build your success story together.
|
16 |
+
|
17 |
+
What we offer
|
18 |
+
At The Hexatech, we provide end-to-end business solutions tailored to meet your unique goals. From building cutting-edge websites to harnessing the power of AI, we’ve got you covered. Our expert team ensures that your ideas turn into reality with seamless deployment, stunning designs, robust databases, and custom software solutions. Let us take your business to the next level with innovative technology and creative strategies.
|
19 |
+
Web Development
|
20 |
+
We create high-performance, responsive websites that are not only visually stunning but also optimized for functionality. Whether it's a corporate site or an e-commerce platform, we bring your online presence to life.
|
21 |
+
AI & Machine Learning
|
22 |
+
Unlock the future with AI and machine learning solutions that help you automate processes, analyze data, and make smarter decisions. From predictive analytics to personalized customer experiences, we’ll help you stay ahead of the curve.
|
23 |
+
Deployment & Maintenance
|
24 |
+
Leave the technicalities to us! We offer seamless deployment services, ensuring your web and software solutions are launched efficiently with ongoing maintenance to keep everything running smoothly.
|
25 |
+
Design Services
|
26 |
+
First impressions matter! Our design team crafts intuitive, eye-catching designs that resonate with your brand’s identity. From branding to UI/UX design, we make sure your product looks as good as it performs.
|
27 |
+
Database Management
|
28 |
+
Your data is your most valuable asset. We offer comprehensive database solutions, from design and setup to optimization and management, ensuring secure, scalable, and efficient data handling.
|
29 |
+
Custom Software
|
30 |
+
From concept to execution, we build tailored software solutions that address your unique business needs. Whether it’s enterprise software or mobile apps, we deliver solutions that drive efficiency and growth.
|
31 |
+
|
32 |
+
About Us
|
33 |
+
At The Hexatech, we’re more than just a service provider—we’re your strategic partner in building and scaling your business. With a passion for innovation and a commitment to excellence, we deliver A-Z business solutions that empower companies to thrive in the digital age. Founded with the mission to simplify complex processes and accelerate growth, we specialize in everything from web development and AI to design, deployment, and custom software. Whether you’re a startup launching an MVP or an established business looking to redefine your product, we tailor our solutions to meet your unique needs. Our team of expert developers, designers, and strategists work closely with you to bring your vision to life. At The Hexatech, we believe in a hands-on approach, diving deep into customer development and market analysis to ensure that every solution we deliver is not only functional but also impactful. We’re here to help you Design, Develop, Dominate—because your success is our success.
|
34 |
+
|
35 |
+
Testimonials
|
36 |
+
"I can't say enough about the quality of work I have received. I highly recommend The Hexatech for anyone looking for an exceptional web development company."
|
37 |
+
Raj Shaw
|
38 |
+
moodmeter
|
39 |
+
"The Hexatech has been a game changer for my business. Their team is incredibly skilled and responsive, and their work has been exceptional. I highly recommend The Hexatech for any web development & AI needs."
|
40 |
+
Rishi Pipaliya
|
41 |
+
Rose & Fern
|
42 |
+
"The Hexatech team has been incredibly professional and responsive. They have been able to meet our needs and exceed our expectations."
|
43 |
+
Jeet Ghosh
|
44 |
+
LumaticAI
|
45 |
+
|
46 |
+
How We Work
|
47 |
+
01
|
48 |
+
Click on quote
|
49 |
+
02
|
50 |
+
Submit the quote form
|
51 |
+
03
|
52 |
+
We get in touch through meet
|
53 |
+
04
|
54 |
+
Deal is finalized
|
55 |
+
05
|
56 |
+
Project is delivered after payment
|
57 |
+
|
58 |
+
Have a project in mind? Let's Talk
|
59 |
+
|
60 |
+
Our Location
|
61 |
+
Om Shayona Arcade, Gota, Ahmedabad, Gujarat, India, 382481
|
62 |
+
|
63 |
+
Our Company
|
64 |
+
At The Hexatech, we believe that every great business starts with a bold idea. We specialize in providing end-to-end business solutions that help entrepreneurs and businesses bring their visions to life. From designing unique digital experiences, to developing state-of-the-art software, to implementing cutting-edge AI and machine learning systems — we do it all.
|
65 |
+
Our approach is holistic. We not only build and deploy, but also support businesses throughout their entire lifecycle. Whether you are launching a new product, refining an existing one, or optimizing for scalability, we ensure that every step is handled with care and precision. Our dedicated team of experts will work with you to innovate, develop, and grow your brand to achieve sustained market success.
|
66 |
+
The Hexatech is your trusted partner for turning digital challenges into opportunities, combining creativity, technology, and business acumen to help you stay ahead of the competition. With our tailored solutions, we aim to transform your business and ensure it thrives in today’s fast-evolving digital world.
|
67 |
+
|
68 |
+
Meet Our Founders
|
69 |
+
Rohan Shaw
|
70 |
+
Co-Founder & CEO
|
71 |
+
https://instagram.com/the_rohanshaw
|
72 |
+
https://linkedin.com/in/rohan-shaw-rs
|
73 |
+
https://x.com/heyMeRohan
|
74 |
+
Sujal Merani
|
75 |
+
Co-Founder & CSO
|
76 |
+
https://instagram.com/sujal__merani
|
77 |
+
https://linkedin.com/in/sujal-merani-150316329
|
78 |
+
https://x.com/msujal_21
|
79 |
+
Fresil Patel
|
80 |
+
Co-Founder & CMO
|
81 |
+
https://instagram.com/fresil_patel
|
82 |
+
https://linkedin.com/in/fresilpatel
|
83 |
+
https://x.com/PatelFresil
|
84 |
+
|
85 |
+
Contact
|
86 |
+
Email : info@thehexatech.com
|
87 |
+
Business : connect@thehexatech.com
|
88 |
+
Phone : +91 9749525157 | +91 9727226136 | +91 8320372440
|
89 |
+
Head Office :
|
90 |
+
211, 2nd floor, Om Shayona Arcade, Gota, Ahmedabad, Gujarat, India
|
91 |
+
|
92 |
+
Get A Quote
|
93 |
+
|
94 |
+
website : https://thehexatech.com
|
95 |
+
|
96 |
+
LinkedIn: https://www.linkedin.com/company/the-hexatech/about/
|
97 |
+
Instagram: https://www.instagram.com/thehexatech/
|
98 |
+
|
99 |
+
© 2024, The Hexatech. All Rights Reserved.
|
requirements.txt
CHANGED
@@ -1 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
fastapi
|
|
|
1 |
+
langchain
|
2 |
+
langchain-community
|
3 |
+
langchain-core
|
4 |
+
langchain-unstructured
|
5 |
+
pinecone-client
|
6 |
+
python-dotenv
|
7 |
+
langchain_google_genai
|
8 |
+
langchain-pinecone
|
9 |
+
chardet
|
10 |
+
uvicorn
|
11 |
fastapi
|