mpgreg commented on code in PR #34891:
URL: https://github.com/apache/airflow/pull/34891#discussion_r1365231569


##########
airflow/providers/postgres/operators/postgres.py:
##########
@@ -80,3 +86,60 @@ def __init__(
             AirflowProviderDeprecationWarning,
             stacklevel=2,
         )
+
+
+class PgVectorIngestOperator(BaseOperator):
+    """
+    Operator for ingesting text and embeddings into a PostgreSQL database 
using the pgvector library.
+
+    :param conn_id: The connection ID for the postgresql database.
+    :param input_data: Tuple containing the string input content and 
corresponding list of float vector
+        embeddings.
+    :param input_callable: A callable that returns a tuple containing the 
string input content and
+        corresponding  list of float vector embeddings, if ``input_data`` is 
not provided.
+    :param input_callable_args: Positional arguments for the 'input_callable'.
+    :param input_callable_kwargs: Keyword arguments for the 'input_callable'.
+    :param kwargs: Additional keyword arguments for the BaseOperator.
+    """
+
+    def __init__(
+        self,
+        conn_id: str,
+        input_data: tuple[str, list[float]] | None = None,
+        input_callable: Callable[[Any], Any] | None = None,
+        input_callable_args: Collection[Any] | None = None,
+        input_callable_kwargs: Mapping[str, Any] | None = None,

Review Comment:
   Why not just have an `@task.pgvector_import()` decorator which provides a 
cleaner UX for instantiating the hook and passing params?  Conceptually like 
https://github.com/astronomer/ask-astro/blob/00cfbd7a48aafe5603b1ef49342f1dd68c148156/airflow/dags/ingestion/ask-astro-load-blogs.py#L167



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to