Skip to main content

AI tools for Lightdash

Project description

lightdash-ai-tools

AI tools for Lightdash API

Installation

# Install lightdash-ai-tools for LangChain
pip install lightdash-ai-tools[langchain]

Supported AI Frameworks

Examples

LangChain

An example of react agent with LangChain is available in the examples/langchain/agent.py file.

    # Create Lightdash client
    lightdash_url = os.getenv("LIGHTDASH_URL")
    lightdash_api_key = os.getenv("LIGHTDASH_API_KEY")
    if not lightdash_url or not lightdash_api_key:
        raise ValueError("Environment variables LIGHTDASH_URL and LIGHTDASH_API_KEY must be set.")
    client = LightdashClient(
        base_url=lightdash_url,
        token=lightdash_api_key,
    )

    # Create the agent with the tools
    llm = ChatOpenAI(model="gpt-4o")
    tools = get_all_readable_tools(lightdash_client=client)
    agent = create_react_agent(llm, tools)

    # Run the agent
    messages = [
      HumanMessage(content=question),
      ]
    events = agent.stream({"messages": messages}, stream_mode="values")
    for s in events:
        message = s["messages"][-1]
        if isinstance(message, tuple):
            print(message)
        else:
            message.pretty_print()

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

lightdash_ai_tools-0.0.7.tar.gz (83.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightdash_ai_tools-0.0.7-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file lightdash_ai_tools-0.0.7.tar.gz.

File metadata

  • Download URL: lightdash_ai_tools-0.0.7.tar.gz
  • Upload date:
  • Size: 83.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.16

File hashes

Hashes for lightdash_ai_tools-0.0.7.tar.gz
Algorithm Hash digest
SHA256 830cee4d422351a592295a12cb3e76cb5d9fa92f3eb801cd5b546cb8d589c5c9
MD5 a81227c3d40b10b567aca819256982e6
BLAKE2b-256 af9409c61216cf70e06383171b8aa7aa09fa410445e392a12143edd96ecdda47

See more details on using hashes here.

File details

Details for the file lightdash_ai_tools-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for lightdash_ai_tools-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 305b78a408804bcb3a8105e825d2580d964290a5216130f7babc0ea6bf17d04c
MD5 ba809295a268aeb0ff5de76d3f351515
BLAKE2b-256 a53b22f6132ec412ae04ca73e6f0781bb011a7456f14a5fca0876dcfa3f88c35

See more details on using hashes here.

Supported by

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