airflow.providers.common.ai.example_dags.example_llm

Example DAGs demonstrating LLMOperator and @task.llm usage.

Classes

Entities

Named entities extracted from a text.

LogNotifier

BaseNotifier class for sending notifications.

Functions

example_llm_operator()

example_llm_operator_structured()

example_llm_operator_agent_params()

example_llm_decorator()

example_llm_decorator_structured()

example_llm_operator_usage_limits()

example_llm_operator_templated_usage_limits()

example_llm_operator_approval()

Module Contents

class airflow.providers.common.ai.example_dags.example_llm.Entities(/, **data)[source]

Bases: pydantic.BaseModel

Named entities extracted from a text.

names: list[str][source]
locations: list[str][source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_operator()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_operator_structured()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_operator_agent_params()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_decorator()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_decorator_structured()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_operator_usage_limits()[source]
airflow.providers.common.ai.example_dags.example_llm.example_llm_operator_templated_usage_limits()[source]
class airflow.providers.common.ai.example_dags.example_llm.LogNotifier(message)[source]

Bases: airflow.providers.common.compat.notifier.BaseNotifier

BaseNotifier class for sending notifications.

It can be used asynchronously (preferred) if async_notify`is implemented and/or synchronously if `notify is implemented.

Currently, the Dag/Task state change callbacks run on the Dag Processor and only support sync usage.

Usage::

# Asynchronous usage await Notifier(context)

# Synchronous usage notifier = Notifier() notifier(context)

template_fields = ('message',)[source]
message[source]
notify(context)[source]

Send a notification (sync).

Implementing this is a requirement for running this notifier in the Dag processor, which is where the on_success_callback and on_failure_callback run.

Parameters:

context – The airflow context

airflow.providers.common.ai.example_dags.example_llm.example_llm_operator_approval()[source]

Was this entry helpful?