Skip to main content

Tableau tools for Agentic use cases with Langchain

Project description

langchain-tableau

PyPI version GitHub Repo

This package provides Langchain integrations for Tableau, enabling you to build Agentic tools using Tableau's capabilities within the Langchain and LangGraph frameworks.

Use these tools to bridge the gap between your organization's Tableau data assets and the natural language queries of your users, empowering them to get answers directly from data through conversational AI agents.

Tableau Logo

Installation

pip install langchain-tableau

Quick Start

Here's a basic example of using the simple_datasource_qa tool to query a Tableau Published Datasource with a Langgraph agent:

# --- Core Langchain/LangGraph Imports ---
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

# --- langchain-tableau Imports ---
from langchain_tableau.tools.simple_datasource_qa import initialize_simple_datasource_qa

# 1. Initialize your preferred LLM
llm = ChatOpenAI(model='gpt-4o-mini', temperature=0) # Example using OpenAI

# 2. Initialize the Tableau Datasource Query tool
# Replace placeholders with your Tableau environment details
analyze_datasource = initialize_simple_datasource_qa(
    domain='[https://your-tableau-cloud-or-server.com](https://your-tableau-cloud-or-server.com)',
    site='YourTableauSiteName', # The site content URL, not the display name
    jwt_client_id='YOUR_CONNECTED_APP_CLIENT_ID',
    jwt_secret_id='YOUR_CONNECTED_APP_SECRET_ID',
    jwt_secret='YOUR_CONNECTED_APP_SECRET_VALUE',
    tableau_api_version='3.22', # Or your target REST API version
    tableau_user='user@example.com', # User context for the query
    datasource_luid='YOUR_DATASOURCE_LUID', # LUID of the Published Datasource
    tooling_llm_model='gpt-4o-mini' # LLM used internally by the tool
)

# 3. Create a list of tools for your agent
tools = [ analyze_datasource ]

# 4. Build the Agent
# This example uses a prebuilt ReAct agent from LangGraph
tableauAgent = create_react_agent(llm, tools)

# 5. Run the Agent with a question
question = 'Which states sell the most? Are those the same states with the most profits?'
messages = tableauAgent.invoke({"messages": [("human", question)]})

# Process and display the agent's response
print(messages['messages'][-1].content)

Available Tools

This package currently offers the following production-ready tools:

  1. simple_datasource_qa:
    • Allows users to query a Tableau Published Datasource using natural language.
    • Leverages the analytical power of Tableau's VizQL Data Service engine for aggregation, filtering (and soon, calculations!).
    • Ensures security by interacting via Tableau's API layer, preventing direct SQL injection risks. Authentication is handled via Tableau Connected Apps (JWT).

Learn More & Contribute

  • Full Documentation & Examples: For detailed usage, advanced examples (including Jupyter Notebooks), contribution guidelines, and information about the experimental sandbox where new features are developed, please visit our GitHub Repository.
  • Live Demos: See agents using Tableau in action at EmbedTableau.com (GitHub).

We welcome contributions! Whether it's improving existing tools, adding new ones, or enhancing documentation, please check out the Contribution Guidelines on GitHub.

Let's increase the flow of data and help people get answers!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_tableau-0.4.39.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

langchain_tableau-0.4.39-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_tableau-0.4.39.tar.gz.

File metadata

  • Download URL: langchain_tableau-0.4.39.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for langchain_tableau-0.4.39.tar.gz
Algorithm Hash digest
SHA256 a163b7cc996a458c9e4f810dc4ceb067cd18f6b1065ec6e782bc553ad11eb460
MD5 8fd9f96af1ef6be38eabb15ee9687438
BLAKE2b-256 ba2b374c3c3c8c74f2e28a9ae725521cc850e77c9ff51220878bd552f342b1e0

See more details on using hashes here.

File details

Details for the file langchain_tableau-0.4.39-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_tableau-0.4.39-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a63baa39a9fd03471706090a830bcd61d25e805d6db19c971ca3fe6730387d
MD5 01b4d73235811e338b49092522f734cd
BLAKE2b-256 4c958ef41e0dbbcfc3e0eabda193140181ebfb6600337e238d09bd00a6503581

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page