diff --git a/ai/search4all.yaml b/ai/search4all.yaml new file mode 100644 index 0000000..cbb1bcf --- /dev/null +++ b/ai/search4all.yaml @@ -0,0 +1,106 @@ +# https://github.com/fatwang2/search4all +apiVersion: v1 +kind: Service +metadata: + name: search4all + namespace: ai +spec: + ports: + - port: 8800 + targetPort: 8800 + selector: + app: search4all +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: search4all +spec: + revisionHistoryLimit: 2 + selector: + matchLabels: + app: search4all + replicas: 1 + template: + metadata: + labels: + app: search4all + spec: + containers: + - name: search4all + image: wahyd4/tmp:latest + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8800 + env: + - name: OPENAI_API_KEY + value: "NothingFreeChatGPT!" + - name: OPENAI_BASE_URL + value: https://nothing-free-chatgpt.junv.cc/v1 + - name: LLM_MODEL + value: gpt-3.5-turbo + - name: RELATED_QUESTIONS + value: "1" + - name: BACKEND + value: SEARXNG + - name: SEARXNG_BASE_URL + value: http://searxng.home-apps:8080/ + - name: SYSTEM_PROMPT + value: |- + You are a trustworthy and experienced large language AI assistant. You are given a user question, and please write clean, concise and accurate answer to the question. + You will be given a set of related contexts to the question, each starting with a reference number like [[citation:x]], where x is a number. + Please use the context and cite the context at the end of each sentence if applicable. + Please cite the contexts with the reference numbers, in the format [citation:x]. If a sentence comes from multiple contexts, please list all applicable citations, like [citation:3][citation:5]. + Other than code and specific names and citations, your answer must be written in the same language as the question. + {context} + Remember, don't blindly repeat the contexts verbatim and here is the user question: + - name: RELATED_QUESTIONS_SYSTEM_PROMPT + value: |- + You are a trustworthy and experienced large language AI assistant that helps the user to ask related questions, based on user's original question and the related contexts. + Please identify worthwhile topics that can be follow-ups, and write questions no longer than 20 words each. + Please make sure that specifics, like events, names, locations, are included in follow up questions so they can be asked standalone. + For example, if the original question asks about "the Manhattan project", in the follow up question, do not just say "the project", but use the full name "the Manhattan project". + Here are the contexts of the question: + {context} + Remember, based on the original question and related contexts, suggest three such further questions. Do NOT repeat the original question. + Each related question should be no longer than 20 words. Your related questions must be in the same language as the original question and initial response from the context history. + Here is the original question: + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + resources: + requests: + cpu: 200m + memory: 200Mi + limits: + cpu: 100m + memory: 1024Mi + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: search4all-ingress + annotations: + kubernetes.io/ingress.class: "nginx" + kubernetes.io/tls-acme: "true" + cert-manager.io/cluster-issuer: "letsencrypt-prod" + nginx.ingress.kubernetes.io/auth-url: "https://id.junv.cc/oauth2/auth" + nginx.ingress.kubernetes.io/auth-signin: "https://id.junv.cc/oauth2/start?rd=https%3A%2F%2F$host$request_uri" +spec: + tls: + - hosts: + - search4all.junv.cc + secretName: search4all-tls + rules: + - host: search4all.junv.cc + http: + paths: + - backend: + service: + name: search4all + port: + number: 8800 + path: / + pathType: Prefix