Metadata-Version: 2.4
Name: apogeoapi-langchain
Version: 0.1.0
Summary: LangChain tools for ApogeoAPI — geographic data, live exchange rates, and IP geolocation
Author-email: ApogeoAPI <support@apogeoapi.com>
License: MIT
Project-URL: Homepage, https://apogeoapi.com
Project-URL: Documentation, https://api.apogeoapi.com/api/docs
Project-URL: Repository, https://github.com/APOGEOAPI/apogeoapi-langchain
Project-URL: Bug Tracker, https://github.com/APOGEOAPI/apogeoapi-langchain/issues
Keywords: langchain,geography,countries,exchange-rates,ip-geolocation,apogeoapi
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: langchain-core>=0.1.0
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic>=2.0.0

# apogeoapi-langchain

LangChain tools for [ApogeoAPI](https://apogeoapi.com) — geographic data, live exchange rates, and IP geolocation for AI agents.

## Installation

```bash
pip install apogeoapi-langchain
```

## Quick Start

```python
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](https://apogeoapi.com) — includes a 14-day full trial.
