ColtenOuO commented on code in PR #72013:
URL: https://github.com/apache/airflow/pull/72013#discussion_r3842599924
##########
providers/common/ai/src/airflow/providers/common/ai/hooks/llamaindex.py:
##########
@@ -58,11 +58,27 @@ class LlamaIndexHook(BaseHook):
to LlamaIndex constructors so concurrent tasks in the same worker
don't race on shared state.
+ .. note::
+
+ ``get_llm()`` and ``get_embedding_model()`` return LlamaIndex's
+ ``OpenAI`` / ``OpenAIEmbedding`` classes, which validate ``model=``
+ client-side against LlamaIndex's OpenAI-only model-name allowlists
+ before any request is sent. Pointing **host** at an Ollama or vLLM
+ endpoint does not add support for those backends: their model names
+ (e.g. ``llama3.2``) are never in the OpenAI allowlist, so the call
+ still fails on the model name, not on connectivity.
+ ``get_embedding_model()`` raises immediately at construction;
+ ``get_llm()`` defers the error until the first call that reads
+ ``.metadata`` (``.chat()`` / ``.complete()``).
+
Connection fields:
* **password**: API key passed as ``api_key=``.
- * **host**: Optional base URL passed as ``api_base=`` (custom endpoints,
- Ollama, vLLM).
+ * **host**: Optional base URL passed as ``api_base=``. Only useful for
+ an OpenAI-compatible proxy that accepts OpenAI's exact model names
+ (e.g. an internal gateway or Azure OpenAI-compatible endpoint) -- not
Review Comment:
ditto
##########
providers/common/ai/docs/hooks/llamaindex.rst:
##########
@@ -73,8 +83,10 @@ The hook reads credentials from the Airflow connection of
type ``llamaindex``:
- **password** -- API key (passed as ``api_key`` to ``OpenAIEmbedding`` /
``OpenAI``).
-- **host** -- Optional base URL (passed as ``api_base``; useful for custom
- OpenAI-compatible endpoints, Ollama, vLLM).
+- **host** -- Optional base URL (passed as ``api_base``). Only useful for
+ an OpenAI-compatible proxy that accepts OpenAI's exact model names (e.g.
+ an internal gateway or Azure OpenAI-compatible endpoint) -- not Ollama
Review Comment:
Azure OpenAI addresses models by custom deployment names rather than
OpenAI's canonical model names, so it doesn't really fit the "accepts OpenAI's
exact model names" rule here.
Maybe just drop the Azure example and keep the internal gateway one?
--
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]