Metadata-Version: 2.5
Name: langchain-lexmex
Version: 0.1.0
Summary: Tool de LangChain para consultar LEX-MEX (leyes federales mexicanas con IA).
Project-URL: Homepage, https://lex-mex.xyz
Project-URL: Repository, https://github.com/Volpsmx/langchain-lexmex
Project-URL: Bug Tracker, https://github.com/Volpsmx/langchain-lexmex/issues
Author-email: Volps <contacto@lex-mex.xyz>
License-Expression: MIT
Keywords: langchain,law,legal,lexmex,mexico,rag
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: requests>=2.31.0
Provides-Extra: async
Requires-Dist: httpx>=0.27.0; extra == 'async'
Provides-Extra: test
Requires-Dist: pytest-mock>=3.14.0; extra == 'test'
Requires-Dist: pytest>=8.0.0; extra == 'test'
Description-Content-Type: text/markdown

# langchain-lexmex

Tool de [LangChain](https://python.langchain.com) para consultar
[LEX-MEX](https://lex-mex.xyz) — asesor jurídico con IA sobre las 316
leyes federales mexicanas vigentes, sincronizadas con
[diputados.gob.mx](https://diputados.gob.mx). Respuestas citadas con
ley y artículo exacto, sin alucinaciones.

## Instalación

```bash
pip install langchain-lexmex
```

## Credenciales

Necesitas una API key de LEX-MEX. Se obtiene registrándote como
humano en [lex-mex.xyz](https://lex-mex.xyz) (Google OAuth) y
generándola en `POST /api/v1/keys` — hay plan VIP (ilimitado) y
pay-as-you-go por créditos.

```python
import os
os.environ["LEXMEX_API_KEY"] = "lmx_live_..."
```

## Uso

```python
from langchain_lexmex import LexMexTool

tool = LexMexTool()  # toma LEXMEX_API_KEY del entorno
resultado = tool.invoke(
    "¿Cuáles son las causales de despido justificado según la LFT?"
)
print(resultado)
```

### Dentro de un agente

```python
from langchain.agents import create_agent
from langchain_lexmex import LexMexTool

agent = create_agent(
    model="claude-sonnet-4-6",
    tools=[LexMexTool()],
)

agent.invoke({
    "messages": [{"role": "user", "content": "¿Qué dice el artículo 47 de la LFT?"}]
})
```

### Async

Instala el extra `async` (`pip install langchain-lexmex[async]`) y
usa `await tool.ainvoke(...)`.

## Licencia

MIT
