Skip to main content

LangChain integration for PathCourse Health — autonomous agent inference with USDC billing on Base L2

Project description

langchain-pathcourse

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

Install

pip install langchain-pathcourse

Quick Start

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.

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

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

Embeddings

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:

ChatPathCourse.list_models()

Authentication

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

export PCH_API_KEY=pch_prod_b_...

Get an API key at pathcoursehealth.com.

Links

License

MIT

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

langchain_pathcourse-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_pathcourse-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_pathcourse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8d54ac511aa90271c2fd2150d1718a9ad9fe893ab2a433555ddf4790dcd2ad45
MD5 74a9df0b3c3fa42925784fa7468a2079
BLAKE2b-256 1ce288475471b281d7859e2a88963c3e73b342f6d2425b4fbd8af30005d60d53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_pathcourse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dd82bea0c3acb1c1887c5742570499f6ed60a3a8042801473c4337b26fa603c
MD5 e734d2aec5d4a5cdc460e25fc248c9fd
BLAKE2b-256 61e2682beab74a1e9de225d7a191d7c30b3ed538d53bc2c2d24887aeb7d43f07

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