diff --git a/genai/vector_database/qdrant_vdb.py b/genai/vector_database/qdrant_vdb.py index 1573191..00f3e60 100644 --- a/genai/vector_database/qdrant_vdb.py +++ b/genai/vector_database/qdrant_vdb.py @@ -1,14 +1,14 @@ import logging -from .base_vdb import BaseVDB from qdrant_client import QdrantClient from qdrant_client.models import VectorParams, Distance +from qdrant_client.http.models import Filter, FieldCondition, MatchValue + from langchain_qdrant import QdrantVectorStore from langchain_openai import OpenAIEmbeddings -from qdrant_client.http.models import Filter, FieldCondition, MatchValue - -from config import Config +from genai.config import Config +from .base_vdb import BaseVDB # Set Logging logging.getLogger().setLevel(logging.INFO) @@ -71,7 +71,7 @@ def create_and_get_vector_storage(self, collection_name: str): def delete_collection(self, collection_name: str): """Deletes the given collection in the vector storage.""" - if not self.client.check_collection(collection_name): + if not self.client.collection_exists(collection_name): logging.info("Collection %s does not exist, nothing to delete.", collection_name) return diff --git a/recipai-chart/templates/qdrant-deployment.yml b/recipai-chart/templates/qdrant-deployment.yml new file mode 100644 index 0000000..3a7774a --- /dev/null +++ b/recipai-chart/templates/qdrant-deployment.yml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: qdrant +spec: + selector: + matchLabels: + app: qdrant + template: + metadata: + labels: + app: qdrant + spec: + containers: + - name: qdrant + image: qdrant/qdrant:latest + imagePullPolicy: IfNotPresent + ports: + - containerPort: 6333 + volumeMounts: + - name: qdrant-storage + mountPath: /qdrant/storage + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "500m" + volumes: + - name: qdrant-storage + persistentVolumeClaim: + claimName: qdrant-pvc \ No newline at end of file diff --git a/recipai-chart/templates/qdrant-pvc.yml b/recipai-chart/templates/qdrant-pvc.yml new file mode 100644 index 0000000..25e4a24 --- /dev/null +++ b/recipai-chart/templates/qdrant-pvc.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: qdrant-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.vdb.storage }} \ No newline at end of file diff --git a/recipai-chart/templates/qdrant-service.yml b/recipai-chart/templates/qdrant-service.yml new file mode 100644 index 0000000..7e88e79 --- /dev/null +++ b/recipai-chart/templates/qdrant-service.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.services.qdrant }} +spec: + selector: + app: qdrant + ports: + - protocol: TCP + port: 6333 + targetPort: 6333 \ No newline at end of file diff --git a/recipai-chart/values.yaml b/recipai-chart/values.yaml index 4dee9f0..f46e66a 100644 --- a/recipai-chart/values.yaml +++ b/recipai-chart/values.yaml @@ -30,11 +30,16 @@ services: server: server-service genai: genai-service mongodb: mongodb-service + qdrant: qdrant-service db: adminUsername: admin storage: 4Gi +# qdrant vector db +vdb: + storage: 1Gi + # will be overridden secrets: gitlabClientSecret: "set in CI pipeline"