TeradataAI Class | Teradata Package for Generative AI - TeradataAI Class - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798
This class offers convenient access to the extensive large language model endpoints provided by the following for inference.
  • AWS Bedrock
  • Azure AI
  • Google Gemini
  • Hugging Face models brought into Vantage
  • NVIDIA NIM
  • ONNX models brought into Vantage

Azure, AWS, NIM, and Google

Teradata's In-Database TextAnalytics AI features enables seamless access to models provided by AWS, Azure, and Google. The TeradataAI class manages all credentials and model selection. When initializing the teradataAI class, you must provide the necessary credentials along with the api_type. See Examples: How to use TeradataAI.

Use one of the following methods to provide the required authorization information:
  • Explicitly pass the authorization information to each argument of the function.
  • Set the environment variables related to the authorization arguments.
  • Supply the authorization information via a configuration file.
  • Pass an existing database authorization object containing the credentials using the authorization parameter.

Hugging Face Models

Teradata’s Bring Your Own (BYO) LLM offering seamlessly integrates Hugging Face models into Vantage. With the teradatagenai package, the entire process of downloading and installing the model is efficiently managed through the TeradataAI class.

Use one of the following options to integrate Hugging Face models:
  • Default environment: Utilize the pre-configured environment called "td_gen_ai_test" provided by Teradata, which simplifies the setup process.
  • Custom user environment: Provide an existing environment during initialization. You are responsible for installing the required packages and scripts required for the model to function correctly. Refer to "Required Software on Client" in Teradata Package for Generative AI System Requirements.

ONNX models

Use Teradata’s Bring Your Own Model (BYOM) offering to seamlessly integrate ONNX embeddings into Vantage. The TeradataAI class can utilize the ONNX embedding type models to generate text embeddings using an existing model or installing a new one. Use cases follow.

Storing Model and Tokenizer

  • Case 1: Basic Storage with Automatic ID Assignment
    • Provide 'model_id', 'model_path', and 'tokenizer_path'.
    • Both model and tokenizer components are saved to in default tables ('td_genai_byom_models' and 'td_genai_byom_tokenizers').
  • Case 2: Storage with Separate IDs
    • Provide 'model_id', 'tokenizer_id', 'model_path', and 'tokenizer_path'.
    • Model and tokenizer are stored in their default tables with the respective ids provided.
    When storing externally trained ONNX models and tokenizers in Vantage, both the model and tokenizer tables must include specific column names. Each table must contain at least the following columns:
    • 'model_id' (type: 'VARCHAR')
    • 'model' (type: 'BLOB')
  • Case 3: Custom Table Storage
    • Provide 'model_id', 'tokenizer_id', 'model_path', 'tokenizer_path', 'model_table_name', and 'tokenizer_table_name'.
    • Model and tokenizer are saved in user-specified tables with their respective IDs.
Attempting to use the legacy single table approach with separate model and tokenizer paths will result in an error. The system cannot infer separate storage tables from a single table name when dealing with distinct model and tokenizer components.
Retrieving Model and Tokenizer
  • Case 1: Simple Retrieval by Model ID
    • Provide only 'model_id' and optionally 'tokenizer_id'.
    • Retrieve model and tokenizer from default tables using their IDs.
    • If 'tokenizer_id' is not specified, it defaults to 'model_id'.
  • Case 2: Retrieval with Separate IDs
    • Provide only 'model_id' and 'tokenizer_id'.
    • Retrieve model and tokenizer from default tables using their IDs.
  • Case 3: Custom Table Retrieval
    • Provide 'model_id', model_table_name', 'tokenizer_id', and 'tokenizer_table_name'.
    • Retrieve model and tokenizer from specified tables.
    • If a model is not found in the new default table structure, the system automatically falls back to searching the legacy default table where both model and tokenizer were stored together.
    • For direct access to legacy tables where model and tokenizer were stored together, you can specify the legacy table name explicitly using table_name.

    To initialize the TeradataAI class, it's essential to understand the required input parameters. TeradataAI Parameters outlines the various parameters needed for integration with platforms such as Hugging Face, ONNX, Azure, AWS, NIM or GCP.