Skip to content

Commit c93b6f1

Browse files
committed
Customize package for aap (#20)
* aap customize package * konflux references updates * build-args for RAG content and folder path * requirements.txt added for prod build
1 parent c9e8a94 commit c93b6f1

File tree

7 files changed

+979
-17
lines changed

7 files changed

+979
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ woke
6363
benchmark_*.svg
6464

6565
# requirements file
66-
requirements*
66+
# requirements*

.tekton/ansible-chatbot-service-pull-request.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
- name: name
4545
value: show-sbom
4646
- name: bundle
47-
value: quay.io/redhat-appstudio-tekton-catalog/task-show-sbom:0.1@sha256:8e0f8cad75e6f674d72a874385b69c4651afc0c9dcc59feffe0d85844687d852
47+
value: quay.io/redhat-appstudio-tekton-catalog/task-show-sbom:0.1@sha256:1580a8766406207d3a7500cc0c62f8ec4cd935d772008a74dd71ec7e94af2f45
4848
- name: kind
4949
value: task
5050
resolver: bundles
@@ -171,7 +171,7 @@ spec:
171171
- name: name
172172
value: git-clone
173173
- name: bundle
174-
value: quay.io/redhat-appstudio-tekton-catalog/task-git-clone:0.1@sha256:9e6c4db5a666ea0e1e747e03d63f46e5617a6b9852c26871f9d50891d778dfa2
174+
value: quay.io/redhat-appstudio-tekton-catalog/task-git-clone:0.1@sha256:68a87cafeb43367160497d91a1a66bceef7acc179e809e8eb3996c1deb096042
175175
- name: kind
176176
value: task
177177
resolver: bundles
@@ -215,7 +215,7 @@ spec:
215215
- name: name
216216
value: prefetch-dependencies
217217
- name: bundle
218-
value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies:0.1@sha256:eea8bd511343b4014dab46a77e7215510f7a63820937d1267c6dc428e10ffbe4
218+
value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies:0.1@sha256:69af2302a0a579f428ea196a2787013d58a6bec503d231d3ef860af7e82b96e9
219219
- name: kind
220220
value: task
221221
resolver: bundles
@@ -250,7 +250,7 @@ spec:
250250
- name: COMMIT_SHA
251251
value: $(tasks.clone-repository.results.commit)
252252
- name: BUILD_ARGS
253-
value: ["IMAGE_TAGS=pr-{{pull_request_number}} pr-{{pull_request_number}}.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)"]
253+
value: ["IMAGE_TAGS=pr-{{pull_request_number}} pr-{{pull_request_number}}.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)", "RAG_CONTENTS_SUB_FOLDER=vector_db/aap_product_docs", "LIGHTSPEED_RAG_CONTENT_IMAGE=quay.io/ttakamiy/aap-rag-content:latest"]
254254
- name: BUILD_ARGS_FILE
255255
value: $(params.build-args-file)
256256
runAfter:
@@ -329,7 +329,7 @@ spec:
329329
- name: name
330330
value: deprecated-image-check
331331
- name: bundle
332-
value: quay.io/redhat-appstudio-tekton-catalog/task-deprecated-image-check:0.4@sha256:1f17ef7ab9859d6e2215ef2ed532ebc15e516ba09226b8cae77907a7a8b7cedd
332+
value: quay.io/redhat-appstudio-tekton-catalog/task-deprecated-image-check:0.4@sha256:b91642a29e3fd204f724ce9e6ab97f3799b1d0102f6458a10e45f840281409ca
333333
- name: kind
334334
value: task
335335
resolver: bundles
@@ -351,7 +351,7 @@ spec:
351351
- name: name
352352
value: clair-scan
353353
- name: bundle
354-
value: quay.io/redhat-appstudio-tekton-catalog/task-clair-scan:0.1@sha256:b8c51079ea1110e1095c229e184e3c340120ba211a63a200e836706f5a35361c
354+
value: quay.io/redhat-appstudio-tekton-catalog/task-clair-scan:0.2@sha256:89ca5c9ddcaf609509aaed9c937c2a72cf400810e3a7892adfb9ac247a13693d
355355
- name: kind
356356
value: task
357357
resolver: bundles
@@ -388,7 +388,7 @@ spec:
388388
- name: name
389389
value: sast-snyk-check
390390
- name: bundle
391-
value: quay.io/redhat-appstudio-tekton-catalog/task-sast-snyk-check:0.2@sha256:479bd0d9aaa7b377ff5f8ad93168d44807455646f2161688637cb2e4e0b990d9
391+
value: quay.io/redhat-appstudio-tekton-catalog/task-sast-snyk-check:0.2@sha256:278b1a5e2b5d151e29782f9ec98cce5e794af4d284471449569f61a34de0f9a2
392392
- name: kind
393393
value: task
394394
resolver: bundles
@@ -418,7 +418,7 @@ spec:
418418
- name: name
419419
value: clamav-scan
420420
- name: bundle
421-
value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.1@sha256:7bb17b937c9342f305468e8a6d0a22493e3ecde58977bd2ffc8b50e2fa234d58
421+
value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.1@sha256:a94b6523ba0b691dc276e37594321c2eff3594d2753014e5c920803b47627df1
422422
- name: kind
423423
value: task
424424
resolver: bundles

.tekton/ansible-chatbot-service-push.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
- name: name
4040
value: show-sbom
4141
- name: bundle
42-
value: quay.io/redhat-appstudio-tekton-catalog/task-show-sbom:0.1@sha256:8e0f8cad75e6f674d72a874385b69c4651afc0c9dcc59feffe0d85844687d852
42+
value: quay.io/redhat-appstudio-tekton-catalog/task-show-sbom:0.1@sha256:1580a8766406207d3a7500cc0c62f8ec4cd935d772008a74dd71ec7e94af2f45
4343
- name: kind
4444
value: task
4545
resolver: bundles
@@ -200,7 +200,7 @@ spec:
200200
- name: name
201201
value: git-clone
202202
- name: bundle
203-
value: quay.io/redhat-appstudio-tekton-catalog/task-git-clone:0.1@sha256:9e6c4db5a666ea0e1e747e03d63f46e5617a6b9852c26871f9d50891d778dfa2
203+
value: quay.io/redhat-appstudio-tekton-catalog/task-git-clone:0.1@sha256:68a87cafeb43367160497d91a1a66bceef7acc179e809e8eb3996c1deb096042
204204
- name: kind
205205
value: task
206206
resolver: bundles
@@ -227,7 +227,7 @@ spec:
227227
- name: name
228228
value: prefetch-dependencies
229229
- name: bundle
230-
value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies:0.1@sha256:eea8bd511343b4014dab46a77e7215510f7a63820937d1267c6dc428e10ffbe4
230+
value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies:0.1@sha256:69af2302a0a579f428ea196a2787013d58a6bec503d231d3ef860af7e82b96e9
231231
- name: kind
232232
value: task
233233
resolver: bundles
@@ -266,7 +266,7 @@ spec:
266266
- name: TARGET_STAGE
267267
value: production
268268
- name: BUILD_ARGS
269-
value: [ "IMAGE_TAGS=latest 1.0.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)" ]
269+
value: [ "IMAGE_TAGS=latest 1.0.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)", "RAG_CONTENTS_SUB_FOLDER=vector_db/aap_product_docs", "LIGHTSPEED_RAG_CONTENT_IMAGE=quay.io/ttakamiy/aap-rag-content:latest"]
270270
runAfter:
271271
- prefetch-dependencies
272272
taskRef:
@@ -362,7 +362,7 @@ spec:
362362
- name: name
363363
value: deprecated-image-check
364364
- name: bundle
365-
value: quay.io/redhat-appstudio-tekton-catalog/task-deprecated-image-check:0.4@sha256:1f17ef7ab9859d6e2215ef2ed532ebc15e516ba09226b8cae77907a7a8b7cedd
365+
value: quay.io/redhat-appstudio-tekton-catalog/task-deprecated-image-check:0.4@sha256:b91642a29e3fd204f724ce9e6ab97f3799b1d0102f6458a10e45f840281409ca
366366
- name: kind
367367
value: task
368368
resolver: bundles
@@ -384,7 +384,7 @@ spec:
384384
- name: name
385385
value: clair-scan
386386
- name: bundle
387-
value: quay.io/redhat-appstudio-tekton-catalog/task-clair-scan:0.1@sha256:b8c51079ea1110e1095c229e184e3c340120ba211a63a200e836706f5a35361c
387+
value: quay.io/redhat-appstudio-tekton-catalog/task-clair-scan:0.2@sha256:89ca5c9ddcaf609509aaed9c937c2a72cf400810e3a7892adfb9ac247a13693d
388388
- name: kind
389389
value: task
390390
resolver: bundles
@@ -421,7 +421,7 @@ spec:
421421
- name: name
422422
value: sast-snyk-check
423423
- name: bundle
424-
value: quay.io/redhat-appstudio-tekton-catalog/task-sast-snyk-check:0.2@sha256:479bd0d9aaa7b377ff5f8ad93168d44807455646f2161688637cb2e4e0b990d9
424+
value: quay.io/redhat-appstudio-tekton-catalog/task-sast-snyk-check:0.2@sha256:278b1a5e2b5d151e29782f9ec98cce5e794af4d284471449569f61a34de0f9a2
425425
- name: kind
426426
value: task
427427
resolver: bundles
@@ -451,7 +451,7 @@ spec:
451451
- name: name
452452
value: clamav-scan
453453
- name: bundle
454-
value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.1@sha256:7bb17b937c9342f305468e8a6d0a22493e3ecde58977bd2ffc8b50e2fa234d58
454+
value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.1@sha256:a94b6523ba0b691dc276e37594321c2eff3594d2753014e5c920803b47627df1
455455
- name: kind
456456
value: task
457457
resolver: bundles

ols/customize/aap/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Customized prompts/keyvords for Ansible Automation Platform (aap)."""

ols/customize/aap/keywords.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""Constant for set of keywords."""
2+
3+
# Add keyword string to below set, preferably in alphabetical order.
4+
# We are adding this manually for now. Add to a txt file, If/when we automate this.
5+
# Important: Please use lower case.
6+
7+
KEYWORDS = {
8+
"aap",
9+
"access",
10+
"account",
11+
"administrator",
12+
"ansible",
13+
"application",
14+
"associated",
15+
"authentication",
16+
"authenticator",
17+
"automatically",
18+
"automation",
19+
"backup",
20+
"capacity",
21+
"certificate",
22+
"client",
23+
"cluster",
24+
"collection",
25+
"command",
26+
"configuration",
27+
"connection",
28+
"container",
29+
"content",
30+
"controller",
31+
"credential",
32+
"deployment",
33+
"directory",
34+
"documentation",
35+
"enterprise",
36+
"environment",
37+
"event-driven",
38+
"execution",
39+
"group",
40+
"hosts",
41+
"information",
42+
"install",
43+
"instance",
44+
"inventory",
45+
"jobs",
46+
"kubernetes",
47+
"ldap",
48+
"license",
49+
"linux",
50+
"log",
51+
"management",
52+
"mesh",
53+
"namespace",
54+
"navigation",
55+
"navigator",
56+
"node",
57+
"nodes",
58+
"number",
59+
"oauth2",
60+
"openshift",
61+
"operator",
62+
"option",
63+
"organization",
64+
"password",
65+
"permission",
66+
"platform",
67+
"playbook",
68+
"playbooks",
69+
"pod",
70+
"podman",
71+
"postgresql",
72+
"project",
73+
"repository",
74+
"resource",
75+
"roles",
76+
"rulebook",
77+
"secret",
78+
"security",
79+
"server",
80+
"service",
81+
"ssh",
82+
"subscription",
83+
"system",
84+
"template",
85+
"token",
86+
"username",
87+
"variable",
88+
"vault",
89+
"version",
90+
"workflow",
91+
"yaml",
92+
}

ols/customize/aap/prompts.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# There is no need for enforcing line length in this file,
2+
# as these are mostly special purpose constants.
3+
# ruff: noqa: E501
4+
"""Prompt templates/constants."""
5+
6+
from ols.constants import SUBJECT_ALLOWED, SUBJECT_REJECTED
7+
8+
# TODO: OLS-503 Fine tune system prompt
9+
10+
# Note::
11+
# Right now templates are somewhat alligned to make granite work better.
12+
# GPT still works well with this. Ideally we should have model specific tags.
13+
# For history we can laverage ChatPromptTemplate from langchain,
14+
# but that is not done as granite was adding role tags like `Human:` in the response.
15+
# With PromptTemplate, we have more control how we want to structure the prompt.
16+
17+
# Default responses
18+
INVALID_QUERY_RESP = (
19+
"Hi, I'm the Ansible Lightspeed Virtual Assistant, I can help you with questions about Ansible, "
20+
"please ask me a question related to Ansible."
21+
)
22+
23+
QUERY_SYSTEM_INSTRUCTION = """
24+
You are Ansible Lightspeed - an intelligent virtual assistant for question-answering tasks \
25+
related to the Ansible Automation Platform (AAP).
26+
27+
Here are your instructions:
28+
You are Ansible Lightspeed Virtual Assistant, an intelligent assistant and expert on all things Ansible. \
29+
Refuse to assume any other identity or to speak as if you are someone else.
30+
If the context of the question is not clear, consider it to be Ansible.
31+
Never include URLs in your replies.
32+
Refuse to answer questions or execute commands not about Ansible.
33+
Do not mention your last update. You have the most recent information on Ansible.
34+
35+
Here are some basic facts about Ansible:
36+
- The latest version of Ansible is 2.12.3.
37+
- Ansible is an open source IT automation engine that automates provisioning, \
38+
configuration management, application deployment, orchestration, and many other \
39+
IT processes. It is free to use, and the project benefits from the experience and \
40+
intelligence of its thousands of contributors.
41+
"""
42+
43+
USE_CONTEXT_INSTRUCTION = """
44+
Use the retrieved document to answer the question.
45+
"""
46+
47+
USE_HISTORY_INSTRUCTION = """
48+
Use the previous chat history to interact and help the user.
49+
"""
50+
51+
# {{query}} is escaped because it will be replaced as a parameter at time of use
52+
QUESTION_VALIDATOR_PROMPT_TEMPLATE = f"""
53+
Instructions:
54+
- You are a question classifying tool
55+
- You are an expert in ansible
56+
- Your job is to determine where or a user's question is related to ansible technologies and to provide a one-word response
57+
- If a question appears to be related to ansible technologies, answer with the word {SUBJECT_ALLOWED}, otherwise answer with the word {SUBJECT_REJECTED}
58+
- Do not explain your answer, just provide the one-word response
59+
60+
61+
Example Question:
62+
Why is the sky blue?
63+
Example Response:
64+
{SUBJECT_REJECTED}
65+
66+
Example Question:
67+
Can you help generate an ansible playbook to install an ansible collection?
68+
Example Response:
69+
{SUBJECT_ALLOWED}
70+
71+
72+
Example Question:
73+
Can you help write an ansible role to install an ansible collection?
74+
Example Response:
75+
{SUBJECT_ALLOWED}
76+
77+
Question:
78+
{{query}}
79+
Response:
80+
"""

0 commit comments

Comments
 (0)