Launch the consumer agent chatbot¶
Two cells — once the business dictionary is populated and the LLM /
embedding settings are in .env:
import teradataml as tdml, tdfs4ds, os
from dotenv import load_dotenv
load_dotenv()
tdml.create_context(host=os.getenv('TDML_HOST'),
user=os.getenv('TDML_USERNAME'),
password=os.getenv('TDML_PASSWORD'))
tdfs4ds.connect(database=os.getenv('TDML_DATABASE'), create_if_missing=True)
tdfs4ds.select_data_domain('MY_PROJECT')
from tdfs4ds.agent import launch_chatbot_with_index
demo = launch_chatbot_with_index(port=7860, force_rebuild=False)
# Opens http://localhost:7860 with the Gradio chatbot + agent trace panel
If the dictionary is empty, fix it first:
from tdfs4ds.genai import document_feature_store_incremental
document_feature_store_incremental(language='English', upload=True)
then re-call launch_chatbot_with_index. The function is idempotent — it
detects an existing index, rebuilds incrementally, and reuses an existing
chatbot if one is already running.