[Feature Request]: Add a pgvector search enrichment handler for Postgres, AlloyDB and Cloud SQL in ml.rag
Los mantenedores suelen responder en 2 días
Evaluación
Este issue todavía no se ha evaluado.
Descripción
What would you like to happen?
apache_beam.ml.rag can write embeddings to Postgres, AlloyDB and Cloud SQL for PostgreSQL (ml/rag/ingestion/postgres.py, alloydb.py, cloudsql.py), but it can't search them. The search handlers in ml/rag/enrichment/ cover BigQuery, Milvus and Qdrant only. A pipeline that stores its vectors with pgvector has no built-in way to do the retrieval step.
CloudSQLEnrichmentHandler with a CustomQueryConfig doesn't fill the gap. _process_single_request keeps only result.first(), so a top-k query returns just the nearest row and drops the rest without an error:
query_config = CustomQueryConfig(
query_fn=lambda row: 'SELECT id, content FROM docs ORDER BY dist LIMIT 3')
# The query returns rows a, b and c; the handler returns only:
# (Row(id='q1', ...), Row(id='a', content='first'))
Proposal: a PostgresVectorSearchEnrichmentHandler in ml/rag/enrichment/postgres_search.py, used with Enrichment like the other search handlers:
- Parameters: table name, embedding column, columns to return,
neighbor_count, distance metric (cosine<=>, L2<->, inner product<#>), and an optional filter. - Queries are parameterized, and table and column names are quoted, so no input text reaches the SQL as-is.
- Each input gets its k nearest neighbors, added to the item in the same way as the existing search handlers.
- Connections work for plain Postgres, AlloyDB and Cloud SQL.
- Vectors are passed as pgvector text literals, so no new Python dependency is needed.
- Unit tests, plus an integration test on the
pgvector/pgvectorimage with testcontainers, so it can run without a cloud database.
Questions before I start:
- Is a Postgres search handler something you'd accept in
ml.rag? - Should it share connection settings with
CloudSQLEnrichmentHandler, or with the ingestion configs? - Should batched requests be in the first PR, or come as a follow-up?
I'm willing to work on this and open a PR once the design is agreed.
Version: master at 0c549fa6c8 (2.79.0.dev)
Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
Issue Components
- Component: Python SDK
- Component: Java SDK
- Component: Go SDK
- Component: Typescript SDK
- Component: IO connector
- Component: Beam YAML
- Component: Beam examples
- Component: Beam playground
- Component: Beam katas
- Component: Website
- Component: Infrastructure
- Component: Spark Runner
- Component: Flink Runner
- Component: Prism Runner
- Component: Hazelcast Jet Runner
- Component: Google Cloud Dataflow Runner
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 4.8k
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 445
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/beam
-
awaiting triage java new feature P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorPosiblemente ocupada @shikhabhadoria la tomó hace 6 días. Abiertoio P2 python
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/beam#41346 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Release notes links wrongPosiblemente ocupada @schizophrenicmaniac la tomó hace 20 días. Abiertobug P3
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
apache/beam#41197 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/beam#39624 · 2 reacciones ·
Los mantenedores suelen responder en 2 días
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizePosiblemente ocupada @1fanwang la tomó hace 98 días. Abiertobug io P3 pinned pubsub
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/beam#28011 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/beam
Issues similares
-
effort/l priority/p1 risk/high triage/core
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
iflytek/skillhub#1188 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
testng-team/testng#3675 ·
Los mantenedores suelen responder en 1 día
-
Improve readability of build file paths in the Run/Debug configuration "Build file" dropdownAbiertodesign
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OpenLiberty/liberty-tools-intellij#1869 ·
Los mantenedores suelen responder en 1 día
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPosiblemente ocupada @trivikr la tomó hoy. Abiertocli
Dificultad 2/5 1-3 horas Aptitud para principiantes 81/100
eclipse-openvsx/openvsx#2482 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día