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.6.tar.gz (63.4 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.6-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lightdash_ai_tools-0.0.6.tar.gz
Algorithm Hash digest
SHA256 53b8b7e0d9dbf0c758009c534f1266e0f3f94c5f1fe9ffda1fd6667b7f83df6c
MD5 91b90f36bd74069d6d510c160a009a38
BLAKE2b-256 c6431c50cee7a08cf565d687c558324229afa397e3836bef4b196468d719c614

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightdash_ai_tools-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 44acb2dc8866e3bac42efdc034928579e0012be5fa283ba9a2c3ece81824fdff
MD5 486171d52d3334b16c899cb647b3926c
BLAKE2b-256 4b4c531512c3a183796a1d6d6f93ad37108fcada09504aeed68154a3ade8c114

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