| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- /*
- Copyright 2026 LocoStack.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- package locostack
- import (
- "fmt"
- "github.com/LocoStack/loco-operator/api/v1alpha1"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/utils/ptr"
- )
- const (
- DOCUMENT_MOUNT_PATH = "/data"
- )
- var LocoContextTemplate = v1alpha1.Template{
- Name: "loco-context",
- Spec: v1alpha1.TemplateSpec{
- Runtime: v1alpha1.RuntimeSpec{
- Name: "loco-simple-rag",
- Image: "locostack.com/loco-simple-rag:latest",
- Env: []corev1.EnvVar{
- {Name: "PORT", Value: "$(spec.runtime.port)"},
- {Name: "QDRANT_COLLECTION", Value: "$(metadata.name)"},
- },
- EnvFrom: []corev1.EnvFromSource{
- {
- SecretRef: &corev1.SecretEnvSource{
- LocalObjectReference: corev1.LocalObjectReference{
- Name: "$(metadata.name)-env",
- },
- Optional: ptr.To(true),
- },
- },
- },
- Port: 8000,
- },
- },
- }
- var LocoSimpleRAGIngestionTemplate = v1alpha1.Template{
- Name: "loco-context-ingestion",
- Spec: v1alpha1.TemplateSpec{
- Runtime: v1alpha1.RuntimeSpec{
- Name: "loco-simple-rag",
- Image: "locostack.com/loco-simple-rag:latest",
- Args: []string{
- "ingest",
- fmt.Sprintf("%s/$(spec.filePath)", DOCUMENT_MOUNT_PATH),
- "--id",
- "$(spec.docId)",
- "--strategy",
- "$(spec.chunkingStrategy.strategy)",
- "--chunk-size",
- "$(spec.chunkingStrategy.chunkSize)",
- "--chunk-overlap",
- "$(spec.chunkingStrategy.chunkOverlap)",
- "--separators",
- "$(spec.chunkingStrategy.separators)",
- },
- Env: []corev1.EnvVar{
- {Name: "KB_ENDPOINT", Value: "$(spec.kbEndpoint)"},
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "documents",
- MountPath: DOCUMENT_MOUNT_PATH,
- },
- },
- },
- Volumes: []corev1.Volume{
- {
- Name: "documents",
- VolumeSource: corev1.VolumeSource{
- PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
- ClaimName: "$(spec.runtime.pvc)",
- },
- },
- },
- },
- },
- }
- var LocoSimpleRAGEgestionTemplate = v1alpha1.Template{
- Name: "loco-context-egestion",
- Spec: v1alpha1.TemplateSpec{
- Runtime: v1alpha1.RuntimeSpec{
- Name: "loco-simple-rag",
- Image: "locostack.com/loco-simple-rag:latest",
- Args: []string{
- "egest",
- "$(spec.docId)",
- },
- Env: []corev1.EnvVar{
- {Name: "KB_ENDPOINT", Value: "$(spec.kbEndpoint)"},
- },
- },
- },
- }
|