id stringlengths 15 25 | source stringclasses 1
value | chunk_index int64 0 393k | token_count int32 449 512 | content stringlengths 203 7.95k |
|---|---|---|---|---|
combine_chunk_400 | combine.txt | 400 | 512 | ape>`. Code mode is
experimental; see below.
* - Per-tool approval on ``AgentOperator`` (:doc:`tool_approval`)
- On Airflow 3.3 and later, a call to a tool marked with Pydantic AI's approval API
(``approval_required(...)`` on a toolset, or ``requires_approval=True`` on a
function tool) paus... |
combine_chunk_401 | combine.txt | 401 | 512 | model or running the tool again, as long as it matches the step
recorded at the same point; from the first step that differs, every step runs live.
The journal is kept in the task state store on Airflow 3.3 and later, and under
``[common.ai] durable_cache_path`` before. With ``durable=True``, repl... |
combine_chunk_402 | combine.txt | 402 | 512 | Reads the file at ``file_path``, or up to ``max_files`` files under a prefix,
without changing them, and sends their content to the model with the prompt in one
request: CSV, Parquet and Avro sampled to ``sample_rows`` rows, and all text cut to
``max_text_chars``. Input over ``max_file_size_bytes`... |
combine_chunk_403 | combine.txt | 403 | 512 | :`~airflow.providers.common.ai.hooks.pydantic_ai.PydanticAIHook` and its
connection types
- The connection fields documented for each type in :doc:`connections/pydantic_ai`,
:doc:`connections/pydantic_ai_bedrock`, :doc:`connections/pydantic_ai_vertex` and
:doc:`connections/pydantic_ai_azure` k... |
combine_chunk_404 | combine.txt | 404 | 512 | failing the task.
* - :class:`~airflow.providers.common.ai.toolsets.mcp.MCPToolset` and
:class:`~airflow.providers.common.ai.hooks.mcp.MCPHook`
- Exposes the tools of the MCP server configured by ``mcp_conn_id``, each named
``<tool_prefix>_<name>`` when ``tool_prefix`` is set. The connection fiel... |
combine_chunk_405 | combine.txt | 405 | 512 | ``fallback_rules``, then
the task's own retry settings. ``ErrorCategory.min_confidence`` overrides the
policy's ``min_confidence`` for that one category. ``min_confidence`` only has an
effect when the model reports a confidence, and that comes from the ``typesafe``
extra, which is still exp... |
combine_chunk_406 | combine.txt | 406 | 512 | - It is built on ``pydantic-ai-skills``, a community package. Whether it moves to
``pydantic-ai-harness``'s ``Skills`` once that loads skill resources and scripts is
still open.
* - :class:`~airflow.providers.common.ai.toolsets.sandbox.SandboxToolset` and its
backends (:doc:`sandbox/index`)
... |
combine_chunk_407 | combine.txt | 407 | 512 | - Written against Strands 1.56 and ADK 2.9.1, which change often. Strands marks its
own checkpointing experimental.
* - The Anthropic tool runner adapter (:doc:`frameworks/anthropic`)
- Built on ``tool_runner``, a beta helper of the Anthropic SDK that can change between
SDK releases.
* - The O... |
combine_chunk_408 | combine.txt | 408 | 512 | prefix on the model
name picks the vendor. Switching vendors is a connection
change, not a Dag change. Find your vendor below, install the extra, create the connection
type shown, and set the model name with that prefix.
For the exhaustive, generated-and-hand-written list of every service this provider
reaches (conne... |
combine_chunk_409 | combine.txt | 409 | 512 | dantic-ai-slim[mistral]``
- ``pydanticai``
- API key in **Password**
* - DeepSeek
- ``deepseek:``
- ``[openai]``
- ``pydanticai``
- API key in **Password**
* - :ref:`Ollama <conn-example-ollama>`, vLLM and other OpenAI-compatible servers
- ``openai:``
- ``[openai]``
- ... |
combine_chunk_410 | combine.txt | 410 | 512 | one
for them. The Snowflake entry lists one install per connection type: ``pydanticai`` uses the
``pydantic-ai-slim`` extra, while the ``pydanticai_snowflake`` type ships with the Snowflake
provider and is installed through its ``[common.ai]`` extra.
Any other vendor that `pydantic-ai supports <https://ai.pydantic.de... |
combine_chunk_411 | combine.txt | 411 | 512 | ``Agent`` or ``Model`` behind a connection
for use in a plain ``@task``. :doc:`hooks/langchain` does the same for LangChain chat and
embedding models, which have their own ``langchain`` connection type.
Pages in this section
---------------------
.. toctree::
:titlesonly:
Azure OpenAI <connections/pydantic_... |
combine_chunk_412 | combine.txt | 412 | 512 | :: /../../ai/src/airflow/providers/common/ai/example_dags/example_pydantic_ai_hook.py
:language: python
:start-after: [START howto_hook_pydantic_ai_basic]
:end-before: [END howto_hook_pydantic_ai_basic]
Overriding the model
--------------------
The model can be specified at three levels (highest priority ... |
combine_chunk_413 | combine.txt | 413 | 512 | START howto_hook_pydantic_ai_spec_file]
:end-before: [END howto_hook_pydantic_ai_spec_file]
The spec file's ``model`` is the last resort: ``model_id`` and the connection's
``model`` extra both take precedence over it, in the
:ref:`order the connection page lists <pydanticai-model-resolution>`. Passing
``instructio... |
combine_chunk_414 | combine.txt | 414 | 512 |
under the License.
.. _howto/hook:mcp:
``MCPHook``
===========
Use :class:`~airflow.providers.common.ai.hooks.mcp.MCPHook` to connect a Dag
task to an `MCP (Model Context Protocol) <https://modelcontextprotocol.io/>`__
server. The hook manages the server's connection configuration -- transport
type, URL or subp... |
combine_chunk_415 | combine.txt | 415 | 512 | ofastmcp.com/>`__ transport:
- ``http`` (default): ``fastmcp.client.transports.StreamableHttpTransport``
- ``sse``: ``fastmcp.client.transports.SSETransport``
- ``stdio``: ``fastmcp.client.transports.StdioTransport``
When ``tool_prefix`` is set, the returned toolset is wrapped so every tool
name gets that prefix (e.g... |
combine_chunk_416 | combine.txt | 416 | 512 | dex:
Using LlamaIndex directly: ``LlamaIndexHook``
=============================================
.. note::
Experimental: this can change or be removed in a minor release of this provider.
See :ref:`howto/stability`.
Use :class:`~airflow.providers.common.ai.hooks.llamaindex.LlamaIndexHook` to
bridge an Airfl... |
combine_chunk_417 | combine.txt | 417 | 512 | from the connection.
- ``hook.get_llm()`` returns an ``OpenAI`` LLM configured from the
connection.
For other vendors (Cohere, Bedrock, Vertex AI, HuggingFace, ...),
instantiate the LlamaIndex class directly in a ``@task`` and pass it to
the operator's ``embed_model=`` / ``llm=`` parameter -- both
:class:`~airflow.... |
combine_chunk_418 | combine.txt | 418 | 512 | ``llm_conn_id``)
- Optional separate Airflow connection ID for the embedding provider.
* - ``embed_model``
- ``None`` (falls back to ``extra["embed_model"]``)
- Embedding model name, e.g. ``text-embedding-3-small``.
* - ``embedding_kwargs``
- ``None``
- Additional keyword arguments passe... |
combine_chunk_419 | combine.txt | 419 | 512 | additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.... |
combine_chunk_420 | combine.txt | 420 | 512 | _models.init_chat_model <https://python.langchain.com/api_reference/langchain/chat_models/langchain.chat_models.base.init_chat_model.html>`__
works when the provider's chat class accepts ``api_key`` and ``base_url``.
Common identifiers:
- ``openai:gpt-5``, ``openai:gpt-5-mini`` -- requires ``langchain-openai``
- ``ant... |
combine_chunk_421 | combine.txt | 421 | 512 | :<model>`` against an OpenAI-compatible endpoint (point ``host`` at
Ollama / vLLM / LM Studio) -- requires ``langchain-openai``
``init_embeddings`` advertises more providers (Cohere, Mistral AI, HuggingFace,
Bedrock, Vertex AI, Azure OpenAI, ...), but their embedding classes expect
provider-specific credential kwarg... |
combine_chunk_422 | combine.txt | 422 | 512 | and the hook reuses ``llm_conn_id``.
* - ``llm_model``
- ``None`` (falls back to ``extra["model"]`` on the connection)
- Chat model identifier in ``provider:name`` form, e.g. ``openai:gpt-5``.
Only required when calling ``get_chat_model()``.
* - ``embed_model``
- ``None`` (falls back to ``e... |
combine_chunk_423 | combine.txt | 423 | 512 | |>airflow/providers/common/ai/docs/configurations-ref.rst
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you un... |
combine_chunk_424 | combine.txt | 424 | 512 | it already made, and a run can pause for a person to
approve an output or a tool call without holding a worker. :doc:`why_common_ai` compares
this with a plain ``@task``.
Start here
----------
- :doc:`why_common_ai`: what this provider handles that an agent in a plain ``@task``
leaves to you, and when a plain task... |
combine_chunk_425 | combine.txt | 425 | 512 | )
- The vendor's own provider
- e.g. :doc:`apache-airflow-providers-openai:index`,
:doc:`apache-airflow-providers-anthropic:index`,
:doc:`apache-airflow-providers-cohere:index`
* - A vendor-managed, server-side agent session (e.g. Anthropic Managed Agents)
- The vendor's own provider
... |
combine_chunk_426 | combine.txt | 426 | 512 | viders-from-sources>
.. THE REMAINDER OF THE FILE IS AUTOMATICALLY GENERATED. IT WILL BE OVERWRITTEN AT RELEASE TIME!
.. toctree::
:hidden:
:maxdepth: 1
:caption: Commits
Detailed list of commits <commits>
apache-airflow-providers-common-ai package
-------------------------------------------------... |
combine_chunk_427 | combine.txt | 427 | 512 | ``modal``
============================================================================================================ ==============
Optional dependencies
---------------------
These extras install optional third-party libraries that enable additional features of the provider.
Install them when installi... |
combine_chunk_428 | combine.txt | 428 | 512 | 2.2.0``, ``sqlglot>=30.0.0``
``common.sql`` ``apache-airflow-providers-common-sql>=2.2.0``
``langchain`` ``langchain>=1.0.0``
``llamaindex`` ``dataclasses-json>=0.6.7``, ``llama-index-core>=0.14.5``, ``llama-index-embeddings-openai>=0.6.0``, ``llama-index-llms-openai>=0.6.8``
``pdf`` ... |
combine_chunk_429 | combine.txt | 429 | 512 | ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed t... |
combine_chunk_430 | combine.txt | 430 | 512 | new connection, read another connection's credentials, or
run a shell command unless a tool you registered exposes that capability.
The corollary is that every tool you add widens the blast radius, and a custom
toolset is only as safe as you make it. A tool that returns ``os.environ`` or
runs shell commands hands the... |
combine_chunk_431 | combine.txt | 431 | 512 | validating
a tool's arguments or the agent's output, what an output function (``ToolOutput``
or a function ``output_type``) returns or raises, a result a capability returns
in place of running the tool, tools the model provider runs itself (native ``WebSearch``,
``WebFetch`` or ``ImageGener... |
combine_chunk_432 | combine.txt | 432 | 512 | a function check, but it rejects only functions
sqlglot cannot type; typed syntax such as T-SQL ``NEXT VALUE FOR`` or Snowflake
``seq.nextval`` still passes. Use a least-privilege role and, where the database
supports it, a read-only default for that role or session (for example
``ALTER ROL... |
combine_chunk_433 | combine.txt | 433 | 512 | - Connects the agent to tools exposed by an MCP server, authenticated
through an Airflow connection.
- Does **not** constrain what those tools do. An MCP server can expose
shell, filesystem, or network access. Run only trusted servers and
audit the tools they expose.
* - **SandboxTools... |
combine_chunk_434 | combine.txt | 434 | 512 | TEs, JOINs, set operations (``UNION`` etc.),
``DESCRIBE``, catalog views such as ``information_schema``, and DML. CTE
references are excluded by lexical scope, so a same-named CTE in another scope
cannot hide a real table, and the database/catalog is part of the match, so a
cross-database reference like ``other... |
combine_chunk_435 | combine.txt | 435 | 512 | differently from sqlglot is a residual gap, and ``allowed_functions`` is a trust
decision you own. **Always** point the connection at a least-privilege database
role -- that is the boundary that holds even when the parser cannot see through a
function, and it is what actually keeps an agent (which may b... |
combine_chunk_436 | combine.txt | 436 | 512 | bytes. Lower it for wide tables
)
**Agents that need to modify data** (use with caution):
.. code-block:: python
SQLToolset(
db_conn_id="app_db",
allowed_tables=["user_preferences"],
allow_writes=True, # Disables SQL validation; agent can INSERT/UPDATE
max_rows=100,
)
.... |
combine_chunk_437 | combine.txt | 437 | 512 | Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in ... |
combine_chunk_438 | combine.txt | 438 | 512 | The operator polls
XCom with ``time.sleep``; it does not defer. With a 10-second poll interval
and review times of 30+ minutes, the worker is occupied for the duration.
**Why the operator does not defer**: the agent state (message history, tool
results) lives in the worker process. Polling XCom with ``time.slee... |
combine_chunk_439 | combine.txt | 439 | 512 | Operator
from airflow.providers.common.ai.toolsets.sql import SQLToolset
from datetime import timedelta
AgentOperator(
task_id="summarize",
prompt="Summarize the sales data",
llm_conn_id="openai",
toolsets=[SQLToolset(db_conn_id="postgres")],
enable_hitl_review=True,... |
combine_chunk_440 | combine.txt | 440 | 512 | ``: Task ID.
- ``map_index``: Map index for mapped tasks. Use ``-1`` for non-mapped tasks or index for dynamic mapping.
- ``region_id`` and ``region_index``: Select one loop pass or one mapped slot. Use the ``region_id`` and
``region_index`` of the task instance as returned by the public task instance endpoints. Send... |
combine_chunk_441 | combine.txt | 441 | 512 | keys use the prefix ``airflow_hitl_review_``.
.. list-table::
:header-rows: 1
:widths: 35 15 50
* - Key
- Writer
- Value
* - ``airflow_hitl_review_agent_session``
- Worker
- ``AgentSessionData``: status, iteration, prompt, current_output
* - ``airflow_hitl_review_human_action``
... |
combine_chunk_442 | combine.txt | 442 | 512 | for the
specific language governing permissions and limitations
under the License.
.. _howto/why-common-ai:
Why Common AI
=============
You can call a model from Airflow without this provider: put an agent framework or a
vendor SDK in a ``@task`` and it runs. The trouble starts when the agent does real work... |
combine_chunk_443 | combine.txt | 443 | 512 | to the agent
as Pydantic AI ``instructions``:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_why_common_ai.py
:language: python
:start-after: [START example_why_common_ai]
:end-before: [END example_why_common_ai]
Both need an LLM connection or key, a ``warehouse`` conn... |
combine_chunk_444 | combine.txt | 444 | 512 | task leaves to you
-------------------------------
.. list-table::
:header-rows: 1
:widths: 28 40 32
* - When this happens
- What this provider does
- Where it is documented
* - The task retries after the agent has already made model and tool calls.
- ``durable=True`` on ``AgentOper... |
combine_chunk_445 | combine.txt | 445 | 512 | a single approve or reject of an agent's answer, put
the standard provider's ``ApprovalOperator`` after the agent task instead; it
waits without a worker slot.
- :doc:`hitl_review`
* - The agent needs your databases, object storage or an API you already have a
hook for.
- ``SQLT... |
combine_chunk_446 | combine.txt | 446 | 512 | ``. Both need Airflow 3.3 or later. See :doc:`retry_policies`.
When a plain task is enough
---------------------------
- One model call with no tools, where running it again on retry costs little.
- An agent you already run in another framework, where you need none of the above. You
can still give it this provider'... |
combine_chunk_447 | combine.txt | 447 | 512 | , or PDFs with one prompt
- :class:`~airflow.providers.common.ai.operators.llm_file_analysis.LLMFileAnalysisOperator`
- ``@task.llm_file_analysis``
* - LLM picks which downstream task runs
- :class:`~airflow.providers.common.ai.operators.llm_branch.LLMBranchOperator`
- ``@task.llm_branch``
* -... |
combine_chunk_448 | combine.txt | 448 | 512 | over file contents or multimodal attachments already chosen
by the Dag author. The operator resolves files via ``ObjectStoragePath`` and keeps the interaction
read-only.
**AgentOperator / @task.agent**: multi-turn tool-calling loop. The model decides which tools to
invoke and when to stop. Use this when the LLM needs... |
combine_chunk_449 | combine.txt | 449 | 512 |
loop (see :doc:`agent`).
* **Analyzing files or comparing schemas with an LLM**:
:doc:`LLMFileAnalysisOperator <llm_file_analysis>` reads a file (object storage or
local) into a prompt; :doc:`LLMSchemaCompareOperator <llm_schema_compare>` diffs
schemas across systems and flags drift a plain equality check woul... |
combine_chunk_450 | combine.txt | 450 | 512 | .. _howto/operator:llm_sql_query:
Natural language to SQL: ``LLMSQLQueryOperator`` and ``@task.llm_sql``
======================================================================
Use :class:`~airflow.providers.common.ai.operators.llm_sql.LLMSQLQueryOperator` to generate
SQL queries from natural language using an LLM.
T... |
combine_chunk_451 | combine.txt | 451 | 512 | viders-common-sql[datafusion]"``. ``common.sql`` pins
``datafusion`` below 52 because the DataFusion 52 crate is not supported with
``iceberg-core``.
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_sql.py
:language: python
:start-after: [START howto_operator_llm_s... |
combine_chunk_452 | combine.txt | 452 | 512 | include:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_sql.py
:language: python
:start-after: [START howto_operator_llm_sql_expand]
:end-before: [END howto_operator_llm_sql_expand]
Usage Limits
------------
``usage_limits`` caps the request count, token usage, tool calls, or cost of ... |
combine_chunk_453 | combine.txt | 453 | 512 | uncated to 500 characters). See :ref:`AgentOperator logging <howto/operator:agent>`
for details on the log format.
Like :doc:`llm`, the operator also pushes ``usage``, ``run_id`` and the model name to
XCom, on a failed run too. See :doc:`../observability`.
<|file|>airflow/providers/common/ai/docs/operators/llm.rst
.... |
combine_chunk_454 | combine.txt | 454 | 512 | a list of types (``[MyModel, int]``) the model is pushed as a ``dict`` instead.
:doc:`../structured_output` explains the XCom deserialization rules, the cross-Dag gap and
``serialize_output``.
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm.py
:language: python
:start-af... |
combine_chunk_455 | combine.txt | 455 | 512 | ``, ``capabilities`` or ``spec_file`` in ``agent_params``: use
``AgentOperator`` or ``@task.agent``, which keep ``agent_params``.
.. _howto/operator:llm_usage_limits:
Usage limits
------------
Set ``usage_limits`` to a
`pydantic-ai UsageLimits <https://ai.pydantic.dev/api/usage/#pydantic_ai.usage.UsageLimits>`__
t... |
combine_chunk_456 | combine.txt | 456 | 512 | dict form ``{"input_tokens_limit": 4_000}``) silently inherits that
50-request cap. Set ``request_limit=None`` explicitly when you only want a
token cap. On Airflow >= 3.3 with ``usage_limits`` set, the ``LLM*`` operators and
``AgentOperator`` count this (including the ``50`` default) across the whole task
ins... |
combine_chunk_457 | combine.txt | 457 | 512 | cost_limit`` only caps the operator's own LLM calls --
the meta-agent that ``LLMRetryPolicy`` runs to classify a failed task is a separate,
uncapped LLM call; see :doc:`../retry_policies`. It counts model spend only, so
compute billed by a ``SandboxToolset`` backend is outside it; see
:ref:`sandbox-cost`.
When... |
combine_chunk_458 | combine.txt | 458 | 512 | a limit bounds a
single agent *run*, not the task. ``LLMBatchOperator`` has no ``usage_limits``.
TaskFlow decorator
------------------
The ``@task.llm`` decorator wraps ``LLMOperator``. The function returns the
prompt string; all other parameters are passed to the operator:
.. exampleinclude:: /../../ai/src/airflow... |
combine_chunk_459 | combine.txt | 459 | 512 | . With ``require_approval=True``, the review shows the
prompt's text and a placeholder such as ``[image/png, 2048 bytes]`` for each
non-text part.
Classification with ``Literal``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set ``output_type`` to a ``Literal`` to constrain the LLM to a fixed set of
labels, useful for classificati... |
combine_chunk_460 | combine.txt | 460 | 512 | `` disables a chain configured there. See :doc:`../provider_fallback`.
- ``model_id``: Model identifier (e.g. ``"openai:gpt-5"``). Overrides the connection's extra field.
- ``system_prompt``: System-level instructions for the agent. Supports Jinja templating.
- ``output_type``: Expected output type (default: ``str``). ... |
combine_chunk_461 | combine.txt | 461 | 512 | ``approval_timeout``.
- ``allow_modifications``: If ``True``, the reviewer can edit the output before
approving. For a type pydantic can validate, an edit that does not validate
fails the task with ``ReviewedOutputValidationError``; a retry runs the model
again. Default ``False``.
- ``approval_notifiers``: Not... |
combine_chunk_462 | combine.txt | 462 | 512 | Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file e... |
combine_chunk_463 | combine.txt | 463 | 512 | _strategy="full"``). Set
``context_strategy="basic"`` to send column names and types only, which shortens the
prompt for tables with many indexes and constraints, or when the comparison is about
columns alone:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_schema_compare.py
... |
combine_chunk_464 | combine.txt | 464 | 512 | PT,
LLMSchemaCompareOperator,
)
LLMSchemaCompareOperator(
task_id="compare_with_custom_rules",
prompt="Compare schemas and flag breaking changes",
llm_conn_id="pydanticai_default",
db_conn_ids=["postgres_source", "snowflake_target"],
table_names=["customers"],
... |
combine_chunk_465 | combine.txt | 465 | 512 | ``@task.branch`` to gate downstream ETL on schema compatibility:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_schema_compare.py
:language: python
:start-after: [START howto_operator_llm_schema_compare_conditional]
:end-before: [END howto_operator_llm_schema_compare... |
combine_chunk_466 | combine.txt | 466 | 512 | ``dict`` of
the same fields) enforced on the run; the task fails when a budget is exceeded.
Default ``None``. See :ref:`Usage Limits <howto/operator:llm_usage_limits>`.
- ``db_conn_ids``: List of database connection IDs to compare. Each must resolve
to a ``DbApiHook``.
- ``table_names``: Tables to introspect fro... |
combine_chunk_467 | combine.txt | 467 | 512 | a failed run too. See :doc:`../observability`.
<|file|>airflow/providers/common/ai/docs/operators/llamaindex_retrieval.rst
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regar... |
combine_chunk_468 | combine.txt | 468 | 512 | IndexEmbeddingOperator.persist_dir``. Pass ``persist_conn_id`` to point at
the Airflow connection that holds cloud credentials. The operator raises
``FileNotFoundError`` with a clear "did you run LlamaIndexEmbeddingOperator first?"
message when the path is missing.
Bring-your-own embedding model
----------------------... |
combine_chunk_469 | combine.txt | 469 | 512 | to return (default 5).
.. seealso::
`llama_index.embeddings.openai.OpenAIEmbedding <https://developers.llamaindex.ai/python/framework-api-reference/embeddings/openai/>`__
for valid ``embedding_kwargs`` keys.
Output
------
Returns a dict with::
{
"query": str,
"chunks": [
{
... |
combine_chunk_470 | combine.txt | 470 | 512 | -after: [START howto_operator_document_loader_basic]
:end-before: [END howto_operator_document_loader_basic]
CSV files produce one document per row, with empty cells skipped. JSON files
with a top-level array produce one document per element; a single JSON object
produces one document. By default each dict is flat... |
combine_chunk_471 | combine.txt | 471 | 512 | are skipped
with a warning rather than crashing the operator. A glob pattern that
matches an unknown extension is treated as intentional and parsed via
the explicit ``parser`` argument.
Loading from bytes
------------------
When upstream tasks produce file content as bytes (S3, GCS, HTTP, etc.),
pass them via ... |
combine_chunk_472 | combine.txt | 472 | 512 | ...).
Formats without a built-in parser
---------------------------------
The built-in dispatch covers ``.txt``, ``.md``, ``.csv``, ``.json``, ``.jsonl``, ``.pdf``
and ``.docx``. There is no built-in parser for ``.pptx`` (``python-pptx``), ``.epub``
(``ebooklib``), ``.xlsx`` (``openpyxl``), ``.html`` (``beautifulsoup... |
combine_chunk_473 | combine.txt | 473 | 512 | _default``, ``google_cloud_default``, ...). For
single-file URIs, ``source_conn_id`` works the same way.
If you'd rather download the file with a dedicated provider operator
first (e.g. to get retry semantics specific to that storage), the
download-then-parse pattern still works:
.. code-block:: python
from airf... |
combine_chunk_474 | combine.txt | 474 | 512 | -storage credentials used by
``ObjectStoragePath`` (``aws_default``, ``google_cloud_default``,
...). Ignored for local paths.
* - ``source_bytes``
- Raw file bytes from XCom. Requires ``file_type``. Mutually exclusive
with ``source_path``. Not a template field (bytes don't survive Jinja).
... |
combine_chunk_475 | combine.txt | 475 | 512 | in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
K... |
combine_chunk_476 | combine.txt | 476 | 512 | , HuggingFace, etc.:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llamaindex_hook.py
:language: python
:start-after: [START howto_hook_llamaindex_byo_embed_model]
:end-before: [END howto_hook_llamaindex_byo_embed_model]
Persisting to cloud storage
--------------------... |
combine_chunk_477 | combine.txt | 477 | 512 | `` in the retrieval
operator's ``embedding_kwargs``. Values are forwarded without filtering.
Connection credentials take precedence at the top level, but nested
options supported by the underlying library can override hook-provided
request values, including credentials, the model, and the in... |
combine_chunk_478 | combine.txt | 478 | 512 | :
Analyze files and images: ``LLMFileAnalysisOperator`` and ``@task.llm_file_analysis``
=====================================================================================
Use :class:`~airflow.providers.common.ai.operators.llm_file_analysis.LLMFileAnalysisOperator`
or the ``@task.llm_file_analysis`` decorator to an... |
combine_chunk_479 | combine.txt | 479 | 512 | ``output_type`` to a Pydantic ``BaseModel`` when you want a typed response
back from the LLM instead of a plain string. The model instance is pushed to
XCom unchanged so downstream tasks can type-hint the class directly. Inside a
list of types (``[MyModel, int]``) the model is pushed as a ``dict`` instead. The
declare... |
combine_chunk_480 | combine.txt | 480 | 512 | reviewer to approve the output before it is returned.
When ``allow_modifications=True``, the reviewer can also edit the output:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_file_analysis.py
:language: python
:start-after: [START howto_operator_llm_file_analysis_approv... |
combine_chunk_481 | combine.txt | 481 | 512 | ``: How many times the model is asked again when its output fails
validation. Default ``None`` (Pydantic AI's default).
- ``usage_limits``: Optional pydantic-ai ``UsageLimits`` (or a templated ``dict`` of
the same fields) enforced on the run; the task fails when a budget is exceeded.
Default ``None``. See :ref:`U... |
combine_chunk_482 | combine.txt | 482 | 512 | , but any
data after a point that does not start a valid stream (for example ``xz``
Stream Padding between streams, or trailing garbage) is silently ignored,
so only the content up to that point is analyzed. ``gzip`` rejects such
files instead (``BadGzipFile``).
Parquet and Avro readers require their correspon... |
combine_chunk_483 | combine.txt | 483 | 512 | selects the OpenAI or Anthropic adapter; ``llm_conn_id`` must be a ``pydanticai`` connection.
.. seealso::
:ref:`Connection configuration <howto/connection:pydanticai>`
Results never go to XCom
-------------------------
This is the most important way ``LLMBatchOperator`` differs from ``LLMOperator``: results are... |
combine_chunk_484 | combine.txt | 484 | 512 | .
* - ``duplicate_result_count``, ``out_of_range_result_count``
- Anomalies the provider stream contained and the merge dropped. Normally zero.
The result rows
^^^^^^^^^^^^^^^
Every request gets exactly one JSONL row with the same keys:
.. code-block:: json
{"custom_id": "3f9c...-0", "index": 0, "status... |
combine_chunk_485 | combine.txt | 485 | 512 | and ``counts.invalid_output`` is separate from ``counts.errored`` so you can tell
"the model produced output that doesn't match the schema" apart from "the request never even
succeeded". A response with no content at all (a refusal, or a reasoning model that spent its
whole ``max_tokens`` budget before producing visib... |
combine_chunk_486 | combine.txt | 486 | 512 |
cap and (for structured output) the schema directive, and translates those per provider:
``max_tokens`` is sent as ``max_completion_tokens`` to OpenAI and as ``max_tokens`` to Anthropic,
and ``output_type`` becomes ``response_format`` on OpenAI and a forced tool on Anthropic.
Everything else the provider's chat endpo... |
combine_chunk_487 | combine.txt | 487 | 512 | / ``params``
- Merged as-is, managed keys win
- Merged as-is, managed keys win
* - ``completion_window``
- Batch-level ``completion_window`` (``"24h"``)
- Ignored
Per-request overrides
-----------------------
A request dict may carry ``system_prompt``, ``max_tokens``, ``params`` (extra body pa... |
combine_chunk_488 | combine.txt | 488 | 512 | the prompts, the model, or the ``output_type``
schema (even just a field description) and clearing the task is treated as a different batch,
never silently re-attached to results produced under the old input. ``on_stale_state`` controls
what happens: ``"cancel_and_resubmit"`` (default) cancels the stale batch through ... |
combine_chunk_489 | combine.txt | 489 | 512 | provider is unreachable), the attempt raises ``LLMBatchOrphanLookupError`` rather than
guess; the retry checks again.
**Anthropic offers no such lookup.** The SDK's batch-create call has no ``metadata`` parameter
and batches cannot be listed by ``custom_id``, so an Anthropic orphan falls through to
``on_orphaned_inte... |
combine_chunk_490 | combine.txt | 490 | 512 | and in a request's ``model``. That is the path to take
today for a provider ``@task.llm_batch`` has no adapter for yet; the error message for a
``pydanticai_azure``, ``pydanticai_bedrock`` or ``pydanticai_vertex`` connection says so.
``LLMBatchOperator`` or the vendor batch operators?
--------------------------------... |
combine_chunk_491 | combine.txt | 491 | 512 | WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. _howto/operator:llm_branch:
Branch on an answer: ``LLMBranchOperator`` and ``@task.llm_branch``
=========================================... |
combine_chunk_492 | combine.txt | 492 | 512 | being classified.
``system_prompt`` is the decision to make and the rules that apply across all
options, including how to break ties. Each ``branches`` entry is what
selecting that option means: its scope and its boundary cases. A rule that
applies to one branch belongs in that branch's description; a rule that
applie... |
combine_chunk_493 | combine.txt | 493 | 512 | _llm_branch_multi]
TaskFlow Decorator
------------------
The ``@task.llm_branch`` decorator wraps ``LLMBranchOperator``. The function
returns the prompt string; all other parameters are passed to the operator:
.. exampleinclude:: /../../ai/src/airflow/providers/common/ai/example_dags/example_llm_branch.py
:langu... |
combine_chunk_494 | combine.txt | 494 | 512 | , so a task whose trigger rule would still run it is
skipped too. Letting ``approval_timeout`` expire fails the task
(``HITLTimeoutError``) unless ``on_approval_timeout`` answers the review for
you; a timeout-driven rejection then skips downstream like any other rejection.
Apart from ``fail_on_reject``, which defaults... |
combine_chunk_495 | combine.txt | 495 | 512 | =True`` the strictest bar among the picked branches
applies.
Four situations, each with a defined outcome:
- **Confidence at or above the bar**: the operator branches, as today.
- **Confidence below the bar**: ``on_uncertain`` applies. With ``"review"``
the pick goes to a person: approve to branch on it, change it ... |
combine_chunk_496 | combine.txt | 496 | 512 |
``do_xcom_push=False`` like any other):
.. code-block:: json
{
"model": "jev-1.13.0",
"proposed": "page_oncall",
"action": "rerun",
"confidence": {"response": 0.52},
"probabilities": {"response": {"page_oncall": 0.52, "rerun": 0.46, "ignore": 0.02}},
"min_confidence": 0.9,
... |
combine_chunk_497 | combine.txt | 497 | 512 | to the proposed pick. The task finalizes the record from that
copy when it resumes, so an XCom that was edited or deleted while the review was
open does not change what is recorded. The XCom is for reading; the paused task
carries its own state.
How It Works
------------
At execution time, the operator:
1. Reads ``... |
combine_chunk_498 | combine.txt | 498 | 512 | a downstream task ID fails the task before the model call. Descriptions support
Jinja templating. Default ``None``.
- ``allow_multiple_branches``: When ``False`` (default) the LLM returns a single
task ID. When ``True`` the LLM may return one or more task IDs.
- ``model_settings``: Pydantic AI ``ModelSettings`` fo... |
combine_chunk_499 | combine.txt | 499 | 512 | approval_notifiers``: Notifier, or list of notifiers, called once the review
is open. Default ``None``.
- ``approval_assigned_users``: Users allowed to answer the review. ``None``
(default) lets any user with the permission respond. Needs Airflow 3.1+.
- ``fail_on_reject``: If ``True``, a rejected review fails t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.