Skip to content

Commit

Permalink
add masterquest command
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzaizai2k committed Feb 3, 2024
1 parent 0a3bfcb commit 6732477
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ list: #List all the running bots
kill:
pkill -f "python src/stock_bot.py"

ask:
python src/llm_with_rag.py

all: install bot
1 change: 1 addition & 0 deletions config/help_command.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Available features:
- /buysellanalyze: Picture of my Buy sell for a stock (FPTS data)
- /summarynewsurl: Summary news from arbitrary url
- Summarize idea from Audio or Voice into To-Do list
- /masterquest: Answer the question with my master data in HCMUT (LLM + RAG system)
---------------

Only me features:
Expand Down
4 changes: 4 additions & 0 deletions setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ backoff==2.2.1
beautifulsoup4==4.12.2
bitsandbytes==0.41.3.post2
bleach==6.1.0
blinker==1.7.0
bottle==0.12.25
bs4==0.0.1
certifi==2023.7.22
Expand All @@ -42,6 +43,7 @@ feedfinder2==0.0.4
feedparser==6.0.11
filelock==3.13.1
filetype==1.2.0
Flask==3.0.1
fonttools==4.44.0
fqdn==1.5.1
frozenlist==1.4.0
Expand All @@ -61,6 +63,7 @@ ipython==8.14.0
ipython-genutils==0.2.0
ipywidgets==8.0.7
isoduration==20.11.0
itsdangerous==2.1.2
jedi==0.19.1
jieba3k==0.35.1
Jinja2==3.1.2
Expand Down Expand Up @@ -231,6 +234,7 @@ wcwidth==0.2.9
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.4
Werkzeug==3.0.1
widgetsnbextension==4.0.9
wrapt==1.16.0
wsproto==1.2.0
Expand Down
20 changes: 20 additions & 0 deletions src/llm_with_rag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
sys.path.append("")

import flask
from dotenv import load_dotenv
load_dotenv()

import requests

# URL for the API endpoint
api_url = 'http://localhost:8083/query'

# Input query
query = input("Enter your query: ")

# Send POST request to the API
response = requests.post(api_url, json={'query': query})

# Print the response
print(response.json())
13 changes: 13 additions & 0 deletions src/stock_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ def ask_pattern_stock(message, command):
else: # command == '/pattern':
bot.register_next_step_handler(message, find_similar_pattern, symbol)

@bot.message_handler(commands=['masterquest'])
def ask_for_question(message):
# Ask for the stock symbol
markup = types.ForceReply(selective = False)
bot.reply_to(message, "Please enter the question:", reply_markup = markup)
bot.register_next_step_handler(message, masterquest)

def masterquest(message):
query = message.text
api_url = 'http://localhost:8083/query'
response = requests.post(api_url, json={'query': query})
bot.reply_to(message, f"The answer: {response.json()['result']}")


def find_similar_pattern(message, symbol):

Expand Down

0 comments on commit 6732477

Please sign in to comment.