Skip to main content

VAP LangChain integration - Execution control for agents calling paid APIs

Project description

VAP LangChain Tools

Execution control for LangChain agents calling paid APIs.

LangChain tools for VAP - the execution control layer. Enforce cost limits and deterministic retries when your chains generate video, music, and images.

Installation

pip install vap-langchain

Quick Start

from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from vap_langchain import VapProductionTool

# Initialize tools
vap_tool = VapProductionTool(api_key="vap_your_api_key")

# Create agent
llm = ChatOpenAI(model="gpt-4")
agent = initialize_agent(
    tools=[vap_tool],
    llm=llm,
    agent=AgentType.OPENAI_FUNCTIONS,
)

# Run
result = agent.run("Create an energetic startup launch video with upbeat music")
print(result)

Available Tools

Tool Description Cost
VapProductionTool Full production (video + music + thumbnail) $5.90
VapVideoTool Single video $1.96
VapMusicTool Single music track $0.68
VapImageTool Single image $0.18

Recommended: VapProductionTool

For most use cases, use VapProductionTool. It creates everything in one call:

from vap_langchain import VapProductionTool

tool = VapProductionTool(api_key="vap_...")

# Agent will automatically use this for any media request
result = tool.run("Cozy coffee shop morning scene with gentle acoustic vibes")
# Returns: Video URL, Music URL, Thumbnail URL

With LangGraph

from langgraph.graph import StateGraph
from vap_langchain import VapProductionTool

vap = VapProductionTool(api_key="vap_...")

def produce_media(state):
    result = vap.run(state["prompt"])
    return {"media": result}

# Add to your graph
graph.add_node("producer", produce_media)

Budget Safety

VAP uses a prepaid model - your agent can't overspend. The tool will return an error if balance is insufficient, preventing runaway costs.

Links

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

vap_langchain-0.2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

vap_langchain-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file vap_langchain-0.2.0.tar.gz.

File metadata

  • Download URL: vap_langchain-0.2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vap_langchain-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24da2ec2788816c22f1b0eaa097eb7e675e416fc3005d7368d6ed32ae9a46c6e
MD5 f221ace3a2bab039813dc2968502303a
BLAKE2b-256 694c3330af6b709b23bc14462d00180582c61576c3cc08bc5ee4b2eb95343893

See more details on using hashes here.

File details

Details for the file vap_langchain-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vap_langchain-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vap_langchain-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed7fd2c11ed33a07b2394207752af78a4c2b1fa1db9083b541797468bf1bd4d
MD5 09ab2811c1c187d1063f005fcc15ac47
BLAKE2b-256 a2c316aa62768d88c2b812d757651b1ab02a38e3d3767b1aba0761f1532b0667

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