An integration package connecting Ceramic and LangChain
Project description
LangChain Ceramic
LangChain integration for Ceramic — a web search API built for LLMs.
Installation
pip install langchain-ceramic
Setup
Generate an API key at platform.ceramic.ai/keys, then export it:
export CERAMIC_API_KEY="your-api-key"
Or pass it directly when constructing the retriever or tool.
Usage
CeramicRetriever in a RAG chain
from langchain_ceramic import CeramicRetriever
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
from langchain_openai import ChatOpenAI
retriever = CeramicRetriever(k=5) # reads CERAMIC_API_KEY from env
prompt = ChatPromptTemplate.from_template(
"Answer the question based only on the following context:\n\n{context}\n\nQuestion: {question}"
)
chain = (
{"context": retriever, "question": RunnablePassthrough()}
| prompt
| ChatOpenAI(model="gpt-5.5")
| StrOutputParser()
)
answer = chain.invoke("What are the latest AI chip export restrictions?")
print(answer)
Each retrieved Document has:
page_content: the result descriptionmetadata["title"]: page titlemetadata["url"]: source URL
CeramicSearch in an agent
from langchain_ceramic import CeramicSearch
from langchain_openai import ChatOpenAI
from langchain.agents import create_agent
tools = [CeramicSearch(max_results=5)]
agent = create_agent(ChatOpenAI(model="gpt-5.5"), tools=tools)
result = agent.invoke({"messages": [{"role": "user", "content": "Find recent news about GLP-1 drugs"}]})
print(result["messages"][-1].content)
Async usage
Both CeramicRetriever and CeramicSearch support async:
docs = await retriever.ainvoke("California rental laws")
API reference
CeramicRetriever
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str | None |
None |
Ceramic API key (falls back to CERAMIC_API_KEY env var) |
k |
int |
10 |
Maximum number of results to return |
CeramicSearch
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str | None |
None |
Ceramic API key (falls back to CERAMIC_API_KEY env var) |
max_results |
int |
5 |
Maximum number of results to include in the response string |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_ceramic-0.1.0.tar.gz.
File metadata
- Download URL: langchain_ceramic-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65e85719ad640aac0f2fbfa3fc6627f9c21697f04594048949c3c4a645a23ef4
|
|
| MD5 |
a369d9ed9287db7b436e415702a1f7dd
|
|
| BLAKE2b-256 |
55d104d0a65b425ac9c687033b5c40b5a1e0e17379433dc911db0078fc62b69c
|
File details
Details for the file langchain_ceramic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_ceramic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b17128681d6b83d515326090ac6c53aa88544de5157b50b672c0a7c16ac5e8b
|
|
| MD5 |
8448a184f0ed0e521de52568588cf805
|
|
| BLAKE2b-256 |
d2beca39adaac686d1c0db3c4d05d56ece80514a9f138dbc0e5a801e0fae81ce
|