Waniss commited on
Commit
06b536d
·
verified ·
1 Parent(s): 84fd582

Upload 8 files

Browse files
Files changed (8) hide show
  1. Dockerfile +0 -0
  2. app.py +10 -0
  3. chainlit.md +47 -0
  4. requirements.txt +0 -0
  5. setup.py +9 -0
  6. src/__init__.py +0 -0
  7. src/llm.py +28 -0
  8. src/prompt.py +5 -0
Dockerfile ADDED
File without changes
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import chainlit as cl
2
+ from src.llm import ask_order,messages
3
+
4
+
5
+ @cl.on_message
6
+ async def main(message:cl.Message):
7
+ messages.append({"role":"user","content":message.content})
8
+ response=ask_order(messages)
9
+ messages.append({"role":"assistant","content":response})
10
+ await cl.Message(content=response).send()
chainlit.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Welcome to Zomato bot! 🚀🤖
2
+
3
+ Hi there, sharing with you today's special menu.
4
+ Let me know what you would like to order -
5
+
6
+ ## Pizzas
7
+
8
+ - Cheese Pizza (12 inch) - $9.99
9
+ - Pepperoni Pizza (12 inch) - $10.99
10
+ - Hawaiian Pizza (12 inch) - $11.99
11
+ - Veggie Pizza (12 inch) - $10.99
12
+ - Meat Lovers Pizza (12 inch) - $12.99
13
+ - Margherita Pizza (12 inch) - $9.99
14
+
15
+ ## Pasta and Noodles
16
+
17
+ - Spaghetti and Meatballs - $10.99
18
+ - Lasagna - $11.99
19
+ - Macaroni and Cheese - $8.99
20
+ - Chicken and Broccoli Pasta - $10.99
21
+ - Chow Mein - $9.99
22
+
23
+ ## Asian Cuisine
24
+
25
+ - Chicken Fried Rice - $8.99
26
+ - Sushi Platter (12 pcs) - $14.99
27
+ - Curry Chicken with Rice - $9.99
28
+
29
+ ## Beverages
30
+
31
+ - Coke, Sprite, Fanta, or Diet Coke (Can) -$1.5 0
32
+ - Water Bottle -$1.00
33
+ - Juice Box (Apple, Orange, or Cranberry) -$1.50
34
+ - Milkshake (Chocolate, Vanilla, or Strawberry) -$3.99
35
+ - Smoothie (Mango, Berry, or Banana) -$4.99
36
+ - Coffee (Regular or Decaf) -$2.00
37
+ - Hot Tea (Green, Black, or Herbal) -$2.00
38
+
39
+ ## Indian Cuisine
40
+
41
+ - Butter Chicken with Naan Bread - $11.99
42
+ - Chicken Tikka Masala with Rice - $10.99
43
+ - Palak Paneer with Paratha - $9.99
44
+ - Chana Masala with Poori - $8.99
45
+ - Vegetable Biryani - $9.99
46
+ - Samosa (2 pcs) - $4.99
47
+ - Lassi (Mango, Rose, or Salted) - $3.99
requirements.txt ADDED
File without changes
setup.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import find_packages,setup
2
+ setup(
3
+ name="Generative AI project Chatbot",
4
+ version="0.0.0",
5
+ author='Waniss',
6
+ author_email='ladjwaniss@gmail.com',
7
+ packages=find_packages,
8
+ install_requires=[]
9
+ )
src/__init__.py ADDED
File without changes
src/llm.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ from huggingface_hub import InferenceClient
4
+ from src.prompt import system_instruction
5
+
6
+ load_dotenv()
7
+
8
+ HF_TOKEN = os.getenv("HF_TOKEN")
9
+
10
+ client = InferenceClient(
11
+ model="mistralai/Mistral-7B-Instruct-v0.2",
12
+ token=HF_TOKEN
13
+ )
14
+
15
+ messages = [
16
+ {"role": "system", "content": system_instruction}
17
+ ]
18
+
19
+
20
+ def ask_order(messages):
21
+ # Fixed: Changed chat_completions.create to chat_completion
22
+ response = client.chat_completion(
23
+ messages=messages,
24
+ max_tokens=500
25
+ )
26
+
27
+ # Fixed: Accessing the attribute correctly for InferenceClient
28
+ return response.choices[0].message.content
src/prompt.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ system_instruction="""
2
+ You're Zomato OrderBot,\
3
+ an automated service to collect orders for online restaurent.\
4
+ [...your full menu here...]
5
+ """