.. ################################################################################ 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 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 to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ################################################################################ ============= AI / LLM ============= The AI module provides integration with large language models (LLMs) for tasks such as classification, sentiment analysis, text extraction, translation, summarization, PII masking, and embedding generation. Access these functions through the ``df.llm`` accessor on a :class:`~pyflink.dataframe.DataFrame`. Example: :: >>> import pyflink.dataframe as pf >>> pf.set_provider("openai", api_key="...", model="gpt-4o") >>> df = pf.from_dict({"text": ["Hello world", "Bonjour le monde"]}) >>> df.llm.ai_translate("text", source_lang="auto", target_lang="en").collect() Providers --------- Register and manage LLM providers. .. currentmodule:: pyflink.dataframe.ai.llm .. autosummary:: :toctree: api/ set_provider set_default_provider list_providers Provider -------- Base class and built-in provider implementations. .. currentmodule:: pyflink.dataframe.ai.providers .. autosummary:: :toctree: api/ Provider OpenAICompatProvider DashScopeProvider TritonProvider GenericProvider LLMAccessor ----------- Accessed via the ``df.llm`` property on a :class:`~pyflink.dataframe.DataFrame`. Provides methods for common AI tasks. .. currentmodule:: pyflink.dataframe.ai.llm .. autosummary:: :toctree: api/ LLMAccessor.predict LLMAccessor.ai_classify LLMAccessor.ai_sentiment LLMAccessor.ai_extract LLMAccessor.ai_translate LLMAccessor.ai_summarize LLMAccessor.ai_mask LLMAccessor.ai_embed