✓ Ordered before 16:00 on a business day, shipped today ✓ Free exchange within 30 days ✓ 2-year warranty ✓ Shipped from BE/NL
Home › API › LangChain

LangChain integration

langchain-adapterspot adds two tools to your LangChain agent, backed by the AdapterSpot Power Supply Identifier API.

ToolWhat it doesQuota
AdapterSpotLabelReaderReads a power adapter label (or a device's rating plate) from a photo: voltage, current, wattage, connector, polarity, plus the power supply that fits.10 free per month
AdapterSpotPowerSupplyFinderFinds the power supply that fits, given at least two of volts, amps and watts, optionally connector and polarity.Free

Setup

Get a free API key on the API page, then install the package and set the key:

pip install langchain-adapterspot
export ADAPTERSPOT_API_KEY="as_live_..."

You can also pass api_key="..." to each tool.

Use the tools directly

from langchain_adapterspot import AdapterSpotLabelReader, AdapterSpotPowerSupplyFinder

reader = AdapterSpotLabelReader()
print(reader.invoke({"image": "adapter-label.jpg"}))  # local path, http(s) URL or data URL

finder = AdapterSpotPowerSupplyFinder()
print(finder.invoke({"voltage": 12, "current": 5, "connector": "5.5x2.1"}))

Both tools return a JSON string; see the API docs for every field. Errors such as a missing key, a used-up quota or an unreadable photo come back as a readable message instead of an exception, so the agent can react to them.

Use them in an agent

from langchain.agents import create_agent
from langchain_adapterspot import AdapterSpotLabelReader, AdapterSpotPowerSupplyFinder

agent = create_agent(
    model="anthropic:claude-sonnet-5-5",
    tools=[AdapterSpotLabelReader(), AdapterSpotPowerSupplyFinder()],
)
result = agent.invoke(
    {"messages": [{"role": "user", "content": "Which power supply do I need? The label photo is ./nas-adapter.jpg"}]}
)
print(result["messages"][-1].content)

The agent passes the image path to AdapterSpotLabelReader, gets the ratings and connector, and can answer with the power supply that fits. When the user only knows the values ("12 V, 5 A, small round plug"), it can call AdapterSpotPowerSupplyFinder instead.

Good to know