Skip to content

Commit

Permalink
Merge pull request #162 from sallyom/dan-rag
Browse files Browse the repository at this point in the history
update rag bootc
  • Loading branch information
rhatdan authored Apr 5, 2024
2 parents 9d63c26 + eebf20b commit 90beb0d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 25 deletions.
13 changes: 7 additions & 6 deletions recipes/natural_language_processing/rag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,28 @@ build:
podman build -f builds/Containerfile -t ${APPIMAGE} .

.PHONY: bootc
bootc:
podman build --cap-add SYS_ADMIN --build-arg "SSHPUBKEY=$(SSHPUBKEY)" -f bootc/Containerfile -t ${BOOTCIMAGE} .
bootc: quadlet
sed -i '' -e "s|$(HOSTDATADIR)|/usr/share/rag/data|g" bootc/build/${APP}.yaml
podman build --cap-add SYS_ADMIN --build-arg "HOSTDATADIR=${HOSTDATADIR}" --build-arg "SSHPUBKEY=$(SSHPUBKEY)" -f bootc/Containerfile -t ${BOOTCIMAGE} .

.PHONY: quadlet
quadlet:
# Modify quadlet files to match the server, model and app image
mkdir -p build
mkdir -p bootc/build
sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \
-e "s|APPIMAGE|${APPIMAGE}|g" \
-e "s|MODELIMAGE|${MODELIMAGE}|g" \
-e "s|CHROMADBIMAGE|${CHROMADBIMAGE}|g" \
quadlet/${APP}.image \
> build/${APP}.image
> bootc/build/${APP}.image
sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \
-e "s|APPIMAGE|${APPIMAGE}|g" \
-e "s|MODELIMAGE|${MODELIMAGE}|g" \
-e "s|CHROMADBIMAGE|${CHROMADBIMAGE}|g" \
-e "s|HOSTDATADIR|${HOSTDATADIR}|g" \
quadlet/${APP}.yaml \
> build/${APP}.yaml
cp quadlet/${APP}.kube build/${APP}.kube
> bootc/build/${APP}.yaml
cp quadlet/${APP}.kube bootc/build/${APP}.kube

.PHONY: install
install:
Expand Down
32 changes: 13 additions & 19 deletions recipes/natural_language_processing/rag/bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,31 @@
# public key into the image, allowing root access via ssh.

FROM quay.io/centos-bootc/centos-bootc:stream9

ARG SSHPUBKEY
ARG HOSTDATADIR

RUN mkdir /usr/etc-system && \
echo 'AuthorizedKeysFile /usr/etc-system/%u.keys' >> /etc/ssh/sshd_config.d/30-auth-system.conf && \
echo ${SSHPUBKEY} > /usr/etc-system/root.keys && chmod 0600 /usr/etc-system/root.keys

# pre-pull workload images:
# Comment the pull commands to keep bootc image smaller.
# The quadlet .image file added above pulls following images on boot if not
# pre-pulled here

ARG RECIPE=rag
ARG MODELIMAGE=quay.io/ai-lab/mistral-7b-instruct:latest
ARG APPIMAGE=quay.io/ai-lab/${RECIPE}:latest
ARG SERVERIMAGE=quay.io/ai-lab/llamacpp-python:latest
ARG CHROMADBImage=quay.io/ai-lab/chromadb

# Add quadlet files to setup system to automatically run AI application on boot
COPY quadlet/${RECIPE}.kube quadlet/${RECIPE}.yaml /usr/share/containers/systemd
# Create RAG data directory
RUN mkdir -p ${HOSTDATADIR} && mkdir -p /usr/share/rag/data
# populate with sample data for testing application
COPY sample-data ${HOSTDATADIR}
RUN cp ${HOSTDATADIR}/* /usr/share/rag/data/.

# Modify quadlet files to match the server, model and app image
RUN sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \
-e "s|APPIMAGE|${APPIMAGE}|g" \
-e "s|MODELIMAGE|${MODELIMAGE}|g" \
-i \
/usr/share/containers/systemd/${RECIPE}.yaml
# Add quadlet files to setup system to automatically run AI application on boot
COPY bootc/build/${RECIPE}.kube bootc/build/${RECIPE}.yaml /usr/share/containers/systemd

# Because images are prepulled, no need for .image quadlet
# COPY quadlet/${RECIPE}.image /usr/share/containers/systemd
# RUN sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \
# -e "s|APPIMAGE|${APPIMAGE}|g" \
# -e "s|MODELIMAGE|${MODELIMAGE}|g" \
# -i \
# /usr/share/containers/systemd/${RECIPE}.image
# COPY build/${RECIPE}.image /usr/share/containers/systemd

# Setup /usr/lib/containers/storage as an additional store for images.
# Remove once the base images have this set by default.
Expand All @@ -51,6 +42,9 @@ RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \
VOLUME /var/lib/containers

# Prepull the model, model_server & application images to populate the system.
# Comment the pull commands and uncomment the .image file COPY to keep bootc image smaller.
# The quadlet .image file added above pulls following images on boot if not
# pre-pulled here
RUN podman pull --root /usr/lib/containers/storage ${SERVERIMAGE}
RUN podman pull --root /usr/lib/containers/storage ${APPIMAGE}
RUN podman pull --root /usr/lib/containers/storage ${MODELIMAGE}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[The scene is set in a luxurious conference room with the three executives seated around a large oak table. The room is well-lit and the atmosphere is professional and cordial.]
Executive 1: "Good morning, everyone. Thank you for joining me today to discuss our exciting new AI business venture."
Executive 2: "Of course, John. I'm thrilled to be here. This is a game-changer for our college and I can't wait to see it come to fruition."
Executive 3: "Indeed. As you know, AI is becoming increasingly important in various industries, and we believe that our venture will provide significant benefits to both our students and the business world as a whole."
Executive 1: "That's right. Our AI platform will offer personalized learning experiences for our students, tailored to their individual needs and goals. And for the business world, it will provide cutting-edge insights and predictions based on vast amounts of data, giving them a competitive edge in today's fast-paced marketplace."
Executive 2: "I see. So how do you plan to monetize this platform?"
Executive 3: "That's a great question. We plan to offer subscription-based services to businesses, as well as generate revenue through partnerships and collaborations with industry leaders. Additionally, we will also explore opportunities for licensing our AI technology to other organizations."
Executive 1: "Excellent. And what about security and privacy concerns? How do you plan to address those?"
Executive 2: "Absolutely. We understand the importance of protecting sensitive data, and we will implement robust security measures to ensure that our platform is secure and compliant with all relevant regulations."
Executive 3: "Yes, and we will also have strict data privacy policies in place to safeguard the personal information of our students and clients. Transparency and trust are key components of any successful AI venture, and we take those seriously."
Executive 1: "I couldn't agree more. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
[The three executives nod in agreement and begin brainstorming strategies for promoting their AI platform.]
Executive 1: "Absolutely. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
Executive 2: "Agreed. We should start by reaching out to industry leaders and thought leaders in the field of AI and education. They will be key in helping us spread the word and build momentum for our platform."
Executive 3: "Excellent idea. And we should also consider partnering with some of the leading AI research institutions and universities. They will be able to provide valuable insights and expertise that will help us refine and improve our platform."
Executive 1: "That's a great point. Partnerships are key in any successful venture, and we want to make sure that we're working with the best of the best in this field."
Executive 2: "Definitely. And once we have a solid proof of concept, we can start reaching out to potential clients and showcasing the value of our platform. I think we'll find a lot of interest from companies looking for innovative ways to improve their operations and stay ahead of the competition."
Executive 3: "I agree. And as we continue to develop and refine our platform, we can also start exploring new markets and applications for AI in education. There are so many possibilities here, and I'm excited to see where this journey takes us."
Certainly! Here is a continuation of the dialogue:
Executive 1: "Absolutely. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
Executive 2: "Agreed. We should start by reaching out to industry leaders and thought leaders in the field of AI and education. They will be key in helping us spread the word and build momentum for our platform."
Executive 3: "Excellent idea. And we should also consider partnering with some of the leading AI research institutions and universities. They will be able to provide valuable insights and expertise that will help us refine and improve our platform."
Executive 1: "That's a great point. Partnerships are key in any successful venture, and we want to make sure that we're working with the best of the best in this field."
Executive 2: "Definitely. And once we have a solid proof of concept, we can start reaching out to potential clients and showcasing the value of our platform. I think we'll find a lot of interest from companies looking for innovative ways to improve their operations and stay ahead of the competition."
Executive 3: "I agree. And as we continue to develop and refine our platform, we can also start exploring new markets and applications for AI in education. There are so many possibilities here, and I'm excited to see where this journey takes us."
Executive 1: "Absolutely. And speaking of markets, let's not forget about the potential for international expansion. We could be looking at a global market opportunity here, and we don't want to miss out on that."
Executive 2: "Agreed. We should definitely consider how we can tailor our platform to meet the unique needs of different cultures and regions around the world."
Executive 3: "Excellent point. And as we continue to grow and expand, we'll need to make sure that we have the right infrastructure in place to support our global ambitions."
[The three executives nod in agreement and begin brainstorming strategies for promoting their AI platform on a global scale.]

0 comments on commit 90beb0d

Please sign in to comment.