@@ -7,11 +7,12 @@ ANSIBLE_CHATBOT_VLLM_URL ?=
7
7
ANSIBLE_CHATBOT_VLLM_API_TOKEN ?=
8
8
ANSIBLE_CHATBOT_INFERENCE_MODEL ?=
9
9
ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER ?=
10
- AAP_GATEWAY_TOKEN ?=
11
10
LLAMA_STACK_PORT ?= 8321
12
11
LOCAL_DB_PATH ?= .
13
12
CONTAINER_DB_PATH ?= /.llama/data/distributions/ansible-chatbot
14
- RAG_CONTENT_IMAGE ?= quay.io/ansible/aap-rag-content:latest
13
+ # quay.io/ansible/aap-rag-content:latest does not work with lightspeed-stack:latest
14
+ # aap-rag-content uses llama-stack:0.2.14 whereas lightspeed-stack:latest uses 0.2.13.
15
+ RAG_CONTENT_IMAGE ?= quay.io/ansible/aap-rag-content:1.0.1751985495
15
16
# Colors for terminal output
16
17
RED := \033[0;31m
17
18
NC := \033[0m # No Color
@@ -20,9 +21,6 @@ NC := \033[0m # No Color
20
21
21
22
.EXPORT_ALL_VARIABLES :
22
23
23
- PYPI_VERSION =$(shell cat requirements.txt | grep llama-stack== | cut -c 14-)
24
- LLAMA_STACK_VERSION =$(PYPI_VERSION )
25
- LLAMA_STACK_LOGGING="server=debug;core =info"
26
24
UV_HTTP_TIMEOUT =120
27
25
28
26
help :
@@ -32,38 +30,31 @@ help:
32
30
@echo " all - Run all steps (setup, build, build-custom)"
33
31
@echo " setup - Sets up llama-stack and the external lightspeed providers"
34
32
@echo " setup-vector-db - Sets up vector DB and embedding model"
35
- @echo " build - Build the base Ansible Chatbot Stack image"
36
- @echo " build-custom - Build the customized Ansible Chatbot Stack image"
37
- @echo " build-lsc - Build the customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack"
38
- @echo " run - Run the Ansible Chatbot Stack container"
33
+ @echo " build - Build the customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack"
34
+ @echo " run - Run the Ansible Chatbot Stack container built with 'build-lsc'"
35
+ @echo " run-test - Run some sanity checks for the Ansible Chatbot Stack container built with 'build-lsc'"
39
36
@echo " run-local-db - Run the Ansible Chatbot Stack container with local DB mapped to conatiner DB"
40
- @echo " run-lsc - Run the Ansible Chatbot Stack container built with 'build-lsc'"
41
- @echo " run-test-lsc - Run some sanity checks for the Ansible Chatbot Stack container built with 'build-lsc'"
42
37
@echo " clean - Clean up generated files and Docker images"
43
38
@echo " deploy-k8s - Deploy to Kubernetes cluster"
44
39
@echo " shell - Get a shell in the container"
45
40
@echo " tag-and-push - Tag and push the container image to quay.io"
46
41
@echo " "
47
42
@echo " Required Environment variables:"
48
- @echo " ANSIBLE_CHATBOT_VERSION - Version tag for the image (default: $( ANSIBLE_CHATBOT_VERSION) )"
49
- @echo " ANSIBLE_CHATBOT_VLLM_URL - URL for the vLLM inference provider"
50
- @echo " ANSIBLE_CHATBOT_VLLM_API_TOKEN - API token for the vLLM inference provider"
51
- @echo " ANSIBLE_CHATBOT_INFERENCE_MODEL - Inference model to use"
43
+ @echo " ANSIBLE_CHATBOT_VERSION - Version tag for the image (default: $( ANSIBLE_CHATBOT_VERSION) )"
44
+ @echo " ANSIBLE_CHATBOT_VLLM_URL - URL for the vLLM inference provider"
45
+ @echo " ANSIBLE_CHATBOT_VLLM_API_TOKEN - API token for the vLLM inference provider"
46
+ @echo " ANSIBLE_CHATBOT_INFERENCE_MODEL - Inference model to use"
52
47
@echo " ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER - Inference model to use for tools filtering"
53
- @echo " AAP_GATEWAY_TOKEN - API toke for the AAP Gateway"
54
- @echo " CONTAINER_DB_PATH - Path to the container database (default: $( CONTAINER_DB_PATH) )"
55
- @echo " LOCAL_DB_PATH - Path to the local database (default: $( LOCAL_DB_PATH) )"
56
- @echo " LLAMA_STACK_PORT - Port to expose (default: $( LLAMA_STACK_PORT) )"
57
- @echo " QUAY_ORG - Quay organization name (default: $( QUAY_ORG) )"
48
+ @echo " CONTAINER_DB_PATH - Path to the container database (default: $( CONTAINER_DB_PATH) )"
49
+ @echo " LOCAL_DB_PATH - Path to the local database (default: $( LOCAL_DB_PATH) )"
50
+ @echo " LLAMA_STACK_PORT - Port to expose (default: $( LLAMA_STACK_PORT) )"
51
+ @echo " QUAY_ORG - Quay organization name (default: $( QUAY_ORG) )"
58
52
59
53
setup : setup-vector-db
60
54
@echo " Setting up environment..."
61
- python3 -m venv venv
62
- . venv/bin/activate && pip install -r requirements.txt
55
+ uv sync
63
56
mkdir -p llama-stack/providers.d/inline/agents/
64
- mkdir -p llama-stack/providers.d/remote/tool_runtime/
65
57
curl -o llama-stack/providers.d/inline/agents/lightspeed_inline_agent.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed-providers/refs/heads/main/resources/external_providers/inline/agents/lightspeed_inline_agent.yaml
66
- curl -o llama-stack/providers.d/remote/tool_runtime/lightspeed.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed-providers/refs/heads/main/resources/external_providers/remote/tool_runtime/lightspeed.yaml
67
58
@echo " Environment setup complete."
68
59
69
60
setup-vector-db :
@@ -76,36 +67,16 @@ setup-vector-db:
76
67
docker kill rag-content
77
68
gzip -d ./vector_db/aap_faiss_store.db.gz
78
69
79
- build :
80
- @echo " Building base Ansible Chatbot Stack image..."
81
- . venv/bin/activate && \
82
- llama stack build --config ansible-chatbot-build.yaml --image-type container
83
- @printf " Base image $( RED) ansible-chatbot-stack-base$( NC) built successfully.\n"
84
-
85
- # Pre-check required environment variables for build-custom
86
- check-env-build-custom :
87
- @if [ -z " $( ANSIBLE_CHATBOT_VERSION) " ]; then \
88
- printf " $( RED) Error: ANSIBLE_CHATBOT_VERSION is required but not set$( NC) \n" ; \
89
- exit 1; \
90
- fi
91
-
92
- build-custom : check-env-build-custom
93
- @echo " Building customized Ansible Chatbot Stack image..."
94
- docker build -f Containerfile -t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION ) \
95
- --build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION ) \
96
- --build-arg LLAMA_STACK_VERSION=$(LLAMA_STACK_VERSION ) .
97
- @printf " Custom image $( RED) ansible-chatbot-stack:$( ANSIBLE_CHATBOT_VERSION) $( NC) built successfully.\n"
98
-
99
- # Pre-check required environment variables for build-lsc
100
- check-env-build-lsc :
70
+ # Pre-check required environment variables for build
71
+ check-env-build :
101
72
@if [ -z " $( ANSIBLE_CHATBOT_VERSION) " ]; then \
102
73
printf " $( RED) Error: ANSIBLE_CHATBOT_VERSION is required but not set$( NC) \n" ; \
103
74
exit 1; \
104
75
fi
105
76
106
- build-lsc : check-env-build-lsc
77
+ build : check-env-build
107
78
@echo " Building customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack..."
108
- docker build -f ./lightspeed-stack/ Containerfile.lsc \
79
+ docker build -f ./Containerfile \
109
80
--build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION ) \
110
81
-t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION ) .
111
82
@printf " Custom image $( RED) ansible-chatbot-stack:$( ANSIBLE_CHATBOT_VERSION) $( NC) built successfully.\n"
@@ -128,42 +99,22 @@ check-env-run:
128
99
printf " $( RED) Error: ANSIBLE_CHATBOT_VERSION is required but not set$( NC) \n" ; \
129
100
exit 1; \
130
101
fi
131
- @if [ -z " $( AAP_GATEWAY_TOKEN) " ]; then \
132
- printf " $( RED) Error: AAP_GATEWAY_TOKEN is required but not set$( NC) \n" ; \
133
- exit 1; \
134
- fi
135
102
136
103
run : check-env-run
137
- @echo " Running Ansible Chatbot Stack container..."
138
- @echo " Using vLLM URL: $( ANSIBLE_CHATBOT_VLLM_URL) "
139
- @echo " Using inference model: $( ANSIBLE_CHATBOT_INFERENCE_MODEL) "
140
- docker run --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :$(LLAMA_STACK_PORT ) \
141
- -v ./embeddings_model:/app/embeddings_model \
142
- -v ./vector_db/aap_faiss_store.db:$(CONTAINER_DB_PATH ) /aap_faiss_store.db \
143
- --env LLAMA_STACK_PORT=$(LLAMA_STACK_PORT ) \
144
- --env VLLM_URL=$(ANSIBLE_CHATBOT_VLLM_URL ) \
145
- --env VLLM_API_TOKEN=$(ANSIBLE_CHATBOT_VLLM_API_TOKEN ) \
146
- --env INFERENCE_MODEL=$(ANSIBLE_CHATBOT_INFERENCE_MODEL ) \
147
- --env INFERENCE_MODEL_FILTER=$(ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER ) \
148
- --env AAP_GATEWAY_TOKEN=$(AAP_GATEWAY_TOKEN ) \
149
- ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
150
-
151
- run-lsc : check-env-run
152
104
@echo " Running Ansible Chatbot Stack container..."
153
105
@echo " Using vLLM URL: $( ANSIBLE_CHATBOT_VLLM_URL) "
154
106
@echo " Using inference model: $( ANSIBLE_CHATBOT_INFERENCE_MODEL) "
155
107
docker run --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
156
108
-v ./embeddings_model:/.llama/data/embeddings_model \
157
109
-v ./vector_db/aap_faiss_store.db:$(CONTAINER_DB_PATH ) /aap_faiss_store.db \
158
- -v ./lightspeed-stack/lightspeed-stack .yaml:/.llama/data/lightspeed-stack.yaml \
110
+ -v ./lightspeed-stack.yaml:/.llama/data/lightspeed-stack.yaml \
159
111
--env VLLM_URL=$(ANSIBLE_CHATBOT_VLLM_URL ) \
160
112
--env VLLM_API_TOKEN=$(ANSIBLE_CHATBOT_VLLM_API_TOKEN ) \
161
113
--env INFERENCE_MODEL=$(ANSIBLE_CHATBOT_INFERENCE_MODEL ) \
162
114
--env INFERENCE_MODEL_FILTER=$(ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER ) \
163
- --env AAP_GATEWAY_TOKEN=$(AAP_GATEWAY_TOKEN ) \
164
115
ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
165
116
166
- run-test-lsc :
117
+ run-test :
167
118
@echo " Running test query against lightspeed-core/lightspeed-stack's /config endpoint..."
168
119
curl -X GET http://localhost:$(LLAMA_STACK_PORT ) /v1/config | jq .
169
120
@echo " Running test query against lightspeed-core/lightspeed-stack's /models endpoint..."
@@ -188,16 +139,15 @@ run-local-db: check-env-run-local-db
188
139
@echo " Using inference model: $( ANSIBLE_CHATBOT_INFERENCE_MODEL) "
189
140
@echo " Using inference model for tools filtering : $( ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER) "
190
141
@echo " Mapping local DB from $( LOCAL_DB_PATH) to $( CONTAINER_DB_PATH) "
191
- docker run --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :$( LLAMA_STACK_PORT ) \
142
+ docker run --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
192
143
-v $(LOCAL_DB_PATH ) :$(CONTAINER_DB_PATH ) \
193
144
-v ./embeddings_model:/app/embeddings_model \
194
145
-v ./vector_db/aap_faiss_store.db:$(CONTAINER_DB_PATH ) /aap_faiss_store.db \
195
- --env LLAMA_STACK_PORT= $( LLAMA_STACK_PORT ) \
146
+ -v ./lightspeed-stack.yaml:/.llama/data/lightspeed-stack.yaml \
196
147
--env VLLM_URL=$(ANSIBLE_CHATBOT_VLLM_URL ) \
197
148
--env VLLM_API_TOKEN=$(ANSIBLE_CHATBOT_VLLM_API_TOKEN ) \
198
149
--env INFERENCE_MODEL=$(ANSIBLE_CHATBOT_INFERENCE_MODEL ) \
199
150
--env INFERENCE_MODEL_FILTER=$(ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER ) \
200
- --env AAP_GATEWAY_TOKEN=$(AAP_GATEWAY_TOKEN ) \
201
151
ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
202
152
203
153
clean :
@@ -207,9 +157,7 @@ clean:
207
157
rm -rf providers.d/
208
158
@echo " Removing ansible-chatbot-stack images..."
209
159
docker rmi -f $$(docker images -a -q --filter reference=ansible-chatbot-stack ) || true
210
- @echo " Removing ansible-chatbot-stack-base image..."
211
- docker rmi -f $$(docker images -a -q --filter reference=ansible-chatbot-stack-base ) || true
212
- @echo " Removing ansible-chatbot-stack-base containers..."
160
+ @echo " Removing ansible-chatbot-stack containers..."
213
161
docker rm -f $$(docker ps -a -q --filter ancestor=ansible-chatbot-stack ) || true
214
162
@echo " Clean-up complete."
215
163
0 commit comments