forked from ishai-rosenberg/hands-on-llms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (69 loc) · 3.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# === Install ===
install:
@echo "Installing financial bot..."
poetry env use $(shell which python3.10) && \
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install && \
poetry run pip install torch==2.0.1
install_dev: install
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install --only dev
install_only_dev:
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install --only dev
add:
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry add $(package)
add_dev:
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry add --group dev $(package)
# === Run ===
run:
@echo "Running financial_bot..."
poetry run python -m tools.bot \
--about_me "I am a student and I have some money that I want to invest." \
--question "Should I consider investing in stocks from the Tech Sector?" \
--history "[[\"What is your opinion on investing in startup companies?\", \"Startup investments can be very lucrative, but they also come with a high degree of risk. It is important to do your due diligence and research the company thoroughly before investing.\"]]" \
--debug False
run_dev:
@echo "Running financial_bot [Dev Mode]..."
poetry run python -m tools.bot \
--about_me "I am a student and I have some money that I want to invest." \
--question "Should I consider investing in stocks from the Tech Sector?" \
--history "[[\"What is your opinion on investing in startup companies?\", \"Startup investments can be very lucrative, but they also come with a high degree of risk. It is important to do your due diligence and research the company thoroughly before investing.\"]]" \
--debug True
run_ui:
@echo "Running financial_bot UI..."
poetry run python -m tools.ui
run_ui_dev:
@echo "Running financial_bot UI [Dev Mode]..."
poetry run gradio tools/ui.py --debug
# === Beam ===
export_requirements:
@echo "Exporting requirements..."
if [ -f requirements.txt ]; then rm requirements.txt; fi
poetry export -f requirements.txt --output requirements.txt --without-hashes
deploy_beam: export_requirements
@echo "Deploying financial_bot on Beam..."
BEAM_IGNORE_IMPORTS_OFF=true beam deploy ./tools/bot.py:run
deploy_beam_dev: export_requirements
@echo "Deploying financial_bot on Beam [Dev Mode]..."
BEAM_IGNORE_IMPORTS_OFF=true beam deploy ./tools/bot.py:run_dev
call_restful_api:
curl -X POST \
--compressed 'https://${BEAM_DEPLOYMENT_ID}.apps.beam.cloud' \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic ${BEAM_AUTH_TOKEN}' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-d '{"about_me": "I am a student and I have some money that I want to invest.", "question": "Should I consider investing in stocks from the Tech Sector?", "history": [["What is your opinion on investing in startup companies?", "Startup investments can be very lucrative, but they also come with a high degree of risk. It is important to do your due diligence and research the company thoroughly before investing."]]}'
# === Formatting & Linting ===
# Be sure to install the dev dependencies first #
lint_check:
@echo "Checking for linting issues..."
poetry run ruff check .
lint_fix:
@echo "Fixing linting issues..."
poetry run ruff check --fix .
format_check:
@echo "Checking for formatting issues..."
poetry run black --check .
format_fix:
@echo "Formatting code..."
poetry run black .