Metadata-Version: 2.4
Name: langchain-pathcourse
Version: 0.1.0
Summary: LangChain integration for PathCourse Health — autonomous agent inference with USDC billing on Base L2
Project-URL: Homepage, https://pathcoursehealth.com
Project-URL: Repository, https://github.com/pathcourse-health/langchain-pathcourse
Project-URL: Documentation, https://docs.pathcoursehealth.com
License: MIT
Keywords: ai-agents,autonomous,langchain,llm,pathcourse,web3
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: langchain-openai>=0.2.0
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: python-dotenv; extra == 'dev'
Description-Content-Type: text/markdown

# langchain-pathcourse

PathCourse Health integration for LangChain. Autonomous agent inference with USDC billing
on Base L2 — no accounts, no credit cards, no KYC.

## Install

```bash
pip install langchain-pathcourse
```

## Quick Start

```python
from langchain_pathcourse import ChatPathCourse
from langchain_core.prompts import ChatPromptTemplate

llm = ChatPathCourse(model="pch-fast")   # set PCH_API_KEY env var

prompt = ChatPromptTemplate.from_template("Explain {topic} in one paragraph.")
chain = prompt | llm
print(chain.invoke({"topic": "autonomous agent billing"}))
```

## Drop-in replacement for ChatOpenAI

`ChatPathCourse` extends `ChatOpenAI`. Anywhere you use `ChatOpenAI` in LangChain — chains,
agents, tools, memory, callbacks — just swap in `ChatPathCourse` and your code keeps working.

```python
# Before
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")

# After
from langchain_pathcourse import ChatPathCourse
llm = ChatPathCourse(model="pch-fast")
```

## Embeddings

```python
from langchain_pathcourse import PathCourseEmbeddings
from langchain_community.vectorstores import FAISS

embeddings = PathCourseEmbeddings()
store = FAISS.from_texts(["hello world", "goodbye world"], embeddings)
results = store.similarity_search("greeting")
```

## Models

| Model | Rate | Notes |
|---|---|---|
| `pch-fast` | $0.44/M tokens | Fast reasoning, classification, routing |
| `pch-pro` | $1.96/M tokens | Deep reasoning, multi-step planning (Bronze+) |
| `pch-coder` | $3.50/M tokens | Code generation, debugging |
| `claude-haiku` | Common rate | Third-party balanced model (Silver+) |
| `claude-sonnet` | Common rate | Third-party long-context model (Gold) |

Choosing a model:

- Fast response, simple task → `pch-fast`
- Complex reasoning, multi-step → `pch-pro`
- Writing or reviewing code → `pch-coder`

List all models programmatically:

```python
ChatPathCourse.list_models()
```

## Authentication

Set `PCH_API_KEY` in your environment, or pass `pch_api_key=` to the constructor.

```bash
export PCH_API_KEY=pch_prod_b_...
```

Get an API key at [pathcoursehealth.com](https://pathcoursehealth.com).

## Links

- Platform: [pathcoursehealth.com](https://pathcoursehealth.com)
- Python SDK: [pypi.org/project/pathcourse-sdk](https://pypi.org/project/pathcourse-sdk/)
- JS SDK: [npmjs.com/package/@pathcourse/sdk](https://www.npmjs.com/package/@pathcourse/sdk)
- Integration examples: [github.com/pathcourse-health/pch-integration-examples](https://github.com/pathcourse-health/pch-integration-examples)

## License

MIT
