feat: добавлена обработка "достоверных" документов, направляемых посредством отправления агенту "достоверных" документов, добавлен функционал добавления title в chunk content`а, обновлены configmap.yaml и values.yaml

This commit is contained in:
mike committed 2026-12-02 14:53:18 +03:00
1 parent 2b1f85bfc1
commit dd0a124e36
35 files changed
+3107 -183

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
apiVersion: v2
name: etl-service
description: "ETL-сервис: S3 → эмбеддинги → Qdrant (CSV и trusted-документы)"
type: application
version: 0.1.0
appVersion: "0.1.0"
maintainers:
- name: etl-team
+18
View File
@@ -8,6 +8,9 @@ metadata:
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
# Источник пайплайна
PIPELINE_SOURCES: {{ .Values.pipelineSources | default "csv" | quote }}
# S3 (без секретов — они в Secret)
S3_ENDPOINT_URL: {{ .Values.s3.endpointUrl | quote }}
S3_REGION: {{ .Values.s3.region | quote }}
@@ -15,10 +18,22 @@ data:
S3_PREFIX: {{ .Values.s3.prefix | quote }}
S3_PROCESSED_PREFIX: {{ .Values.s3.processedPrefix | quote }}
S3_READ_CHUNK_SIZE: {{ .Values.s3.readChunkSize | int64 | quote }}
S3_REJECTED_PREFIX: {{ .Values.s3.rejectedPrefix | quote }}
# Trusted-документы
S3_DOCUMENTS_PREFIX: {{ .Values.documents.prefix | quote }}
S3_DOCUMENTS_PROCESSED_PREFIX: {{ .Values.documents.processedPrefix | quote }}
S3_FAILED_PREFIX: {{ .Values.documents.failedPrefix | quote }}
DOCUMENT_MAX_BYTES: {{ .Values.documents.maxBytes | int64 | quote }}
DOCUMENT_MAX_UNCOMPRESSED_BYTES: {{ .Values.documents.maxUncompressedBytes | int64 | quote }}
DOCUMENT_LIBREOFFICE_BINARY: {{ .Values.documents.libreofficeBinary | quote }}
DOCUMENT_CONVERSION_TIMEOUT: {{ .Values.documents.conversionTimeout | quote }}
DOCUMENT_CHUNK_BATCH_SIZE: {{ .Values.documents.chunkBatchSize | int64 | quote }}
# Qdrant
QDRANT_URL: {{ .Values.qdrant.url | quote }}
QDRANT_COLLECTION_NAME: {{ .Values.qdrant.collectionName | quote }}
QDRANT_DOCUMENTS_COLLECTION_NAME: {{ .Values.qdrant.documentsCollectionName | quote }}
QDRANT_VECTOR_SIZE: {{ .Values.qdrant.vectorSize | quote }}
QDRANT_DISTANCE: {{ .Values.qdrant.distance | quote }}
QDRANT_TIMEOUT: {{ .Values.qdrant.timeout | quote }}
@@ -27,6 +42,7 @@ data:
EMBEDDING_PROVIDER: {{ .Values.embedding.provider | quote }}
EMBEDDING_API_URL: {{ .Values.embedding.apiUrl | quote }}
EMBEDDING_MODEL: {{ .Values.embedding.model | quote }}
EMBEDDING_TIMEOUT: {{ .Values.embedding.timeout | default 120 | quote }}
# Retry
RETRY_MAX_ATTEMPTS: {{ .Values.retry.maxAttempts | quote }}
@@ -37,6 +53,8 @@ data:
CHUNKING_STRATEGY: {{ .Values.processing.chunkingStrategy | quote }}
CHUNK_MAX_TOKENS: {{ .Values.processing.chunkMaxTokens | quote }}
CSV_MAX_FIELD_SIZE: {{ .Values.processing.csvMaxFieldSize | int64 | quote }}
PREPROCESSOR_MIN_WORDS: {{ .Values.processing.preprocessorMinWords | quote }}
TITLE_EXCLUDED_TYPE_IDS: {{ .Values.processing.titleExcludedTypeIds | quote }}
# Batching
EMBEDDING_BATCH_SIZE: {{ .Values.batching.embeddingBatchSize | quote }}
+77
View File
@@ -0,0 +1,77 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Chart.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
schedule: {{ .Values.schedule | quote }}
concurrencyPolicy: {{ .Values.concurrencyPolicy }}
successfulJobsHistoryLimit: {{ .Values.successfulJobsHistoryLimit }}
failedJobsHistoryLimit: {{ .Values.failedJobsHistoryLimit }}
{{- if .Values.startingDeadlineSeconds }}
startingDeadlineSeconds: {{ .Values.startingDeadlineSeconds }}
{{- end }}
jobTemplate:
spec:
backoffLimit: {{ .Values.backoffLimit }}
{{- if .Values.activeDeadlineSeconds }}
activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
{{- end }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
{{- if .Values.metrics.enabled }}
prometheus.io/scrape: "true"
prometheus.io/port: {{ .Values.metrics.port | default 9100 | quote }}
prometheus.io/path: "/metrics"
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 12 }}
{{- end }}
spec:
restartPolicy: {{ .Values.restartPolicy | default "OnFailure" }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.metrics.enabled }}
ports:
- name: metrics
containerPort: {{ .Values.metrics.port | default 9100 }}
protocol: TCP
{{- end }}
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-config
{{- if .Values.existingSecret }}
- secretRef:
name: {{ .Values.existingSecret | quote }}
{{- else }}
- secretRef:
name: {{ .Chart.Name }}-secret
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 16 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -1,66 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount | default 1 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.port | default 8000 }}
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.port | default 9100 }}
protocol: TCP
{{- end }}
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-config
{{- if .Values.existingSecret }}
- secretRef:
name: {{ .Values.existingSecret | quote }}
{{- else }}
- secretRef:
name: {{ .Chart.Name }}-secret
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
+3 -1
View File
@@ -1,3 +1,4 @@
{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
@@ -17,4 +18,5 @@ stringData:
QDRANT_API_KEY: {{ .Values.qdrant.apiKey | quote }}
# Embedding
EMBEDDING_API_KEY: {{ .Values.embedding.apiKey | quote }}
EMBEDDING_API_KEY: {{ .Values.embedding.apiKey | quote }}
{{- end }}
+39 -5
View File
@@ -24,23 +24,47 @@ resources:
# S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, EMBEDDING_API_KEY
existingSecret: "etl-secret"
# ──────────────────────────────────────────────
# Источники пайплайна через запятую: csv,documents
# ──────────────────────────────────────────────
pipelineSources: "csv,documents"
# ──────────────────────────────────────────────
# Trusted-документы (источник documents)
# ──────────────────────────────────────────────
documents:
prefix: "trusted/"
processedPrefix: "trusted_processed/"
failedPrefix: "trusted_failed/"
maxBytes: 52428800
maxUncompressedBytes: 209715200
libreofficeBinary: "soffice"
conversionTimeout: 120
chunkBatchSize: 256
# ──────────────────────────────────────────────
# S3
# ──────────────────────────────────────────────
s3:
# Секреты используются, только если existingSecret не задан
accessKeyId: ""
secretAccessKey: ""
endpointUrl: "https://s3.cloud.ru"
region: "ru-central-1"
bucket: "documents"
prefix: "input/"
processedPrefix: "processed/"
readChunkSize: 838860
readChunkSize: 8388608
rejectedPrefix: "_state/rejected/"
# ──────────────────────────────────────────────
# Qdrant
# ──────────────────────────────────────────────
qdrant:
apiKey: ""
url: "http://qdrant.project2.cloud:6333"
collectionName: "documents_bge_m3"
documentsCollectionName: "trusted_documents"
vectorSize: 1024
distance: "cosine"
timeout: 120
@@ -49,9 +73,11 @@ qdrant:
# Embeddings
# ──────────────────────────────────────────────
embedding:
apiKey: ""
provider: "openai"
apiUrl: "https://foundation-models.api.cloud.ru/v1"
model: "BAAI/bge-m3"
timeout: 120
# ──────────────────────────────────────────────
# Retry
@@ -68,6 +94,9 @@ processing:
chunkingStrategy: "paragraph"
chunkMaxTokens: 512
csvMaxFieldSize: 10485760
preprocessorMinWords: 20
# type_id источников, для которых title не добавляется в текст чанка (через запятую)
titleExcludedTypeIds: "2,3"
# ──────────────────────────────────────────────
# Batching
@@ -103,11 +132,16 @@ checkpoint:
s3checkpointsPrefix: "_state/checkpoints/"
# ──────────────────────────────────────────────
# Deployment
# CronJob
# ──────────────────────────────────────────────
replicaCount: 1
port: 8000
schedule: "*/5 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
startingDeadlineSeconds: 600
activeDeadlineSeconds: 3600
backoffLimit: 2
restartPolicy: OnFailure
# ──────────────────────────────────────────────
# Image Pull Secrets (для приватных registry)