Complete the following steps to perform text analytics using AI and Vantage.
- Install teradatagenai. See Installing, Uninstalling, and Upgrading Teradata Package for Generative AI.
- Import required modules: Import the necessary functions and modules from teradataml and teradatagenai.
- Connect to Vantage: Create a connection to Vantage by utilizing the create_context() function from teradataml.
- [Applicable to Hugging Face] Authenticate with CCP: Use the set_auth_token() function from teradataml to authenticate your access to the Cloud Control Panel (CCP).
- Instantiate TeradataAI: Create an instance of TeradataAI() by specifying the model's name along with the relevant arguments.
[Applicable to Hugging Face] This will download the appropriate model and set up your environment. This process utilizes Teradata’s Bring Your Own Large Language Model (BYO LLM) offering.
In case of ONNX, This will allow you to either retrieve an existing ONNX model or save a new model into the table within Vantage.
- Instantiate TextAnalyticsAI: Instantiate the TextAnalyticsAI() object using the object obtained in step 5.
- Run Text Analytics methods: Perform text analytics by calling the methods of the TextAnalyticsAI object created in step 6.
- Retrieve results: The text analytics operations returns the results in the format of a teradataml DataFrame.
- For Hugging Face, this step invokes the APPLY table operator.
- For CSPs, this step invokes in-database Text Analytics AI functions.