Skip to main content

LangChain tools for ApogeoAPI — geographic data, live exchange rates, and IP geolocation

Project description

apogeoapi-langchain

LangChain tools for ApogeoAPI — geographic data, live exchange rates, and IP geolocation for AI agents.

Installation

pip install apogeoapi-langchain

Quick Start

from apogeoapi_langchain import ApogeoAPIToolkit
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_core.prompts import ChatPromptTemplate

# Get your free API key at apogeoapi.com
toolkit = ApogeoAPIToolkit(api_key="your_apogeoapi_key")
tools = toolkit.get_tools()

llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant with access to geographic and financial data."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_openai_tools_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({"input": "What's the current EUR to USD rate?"})
print(result["output"])

Available Tools

Tool Description
get_country Full data for a country by ISO code
list_countries All 250+ countries
search_countries Search by name, region, or currency
get_states States/provinces for a country
get_cities 150K+ cities with coordinates
get_currency_rate Live exchange rate for 161 currencies
geolocate_ip IP geolocation (IPv4 + IPv6)
global_search Search across countries, states, and cities

Get Your API Key

Free tier available at apogeoapi.com — includes a 14-day full trial.

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

apogeoapi_langchain-0.1.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.

apogeoapi_langchain-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file apogeoapi_langchain-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for apogeoapi_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 590de8207791b2e5afb7b1d3049a3bfaabad97c6b41fd2a88504a1ad93f91e34
MD5 a5ab134a565dd999f63993fecd4b91e5
BLAKE2b-256 2f25645dad0e9e4ac56ed15f34dc0d6037e0d13d98119a335e3fb62d4e16e159

See more details on using hashes here.

File details

Details for the file apogeoapi_langchain-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for apogeoapi_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b3d49c35ae95ad5e53a7cb93902f568f67caf60f7bf048870a807ea1ed66837
MD5 77becf9f52deed709609d5c211bd7434
BLAKE2b-256 46855d475d70b35e99c08419f67f1859cb4d6190bd9274bd00f3d0a01fe02046

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