Skip to main content

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("AI chip export restrictions 2025")
print(answer)

Each retrieved Document has:

  • page_content: the result description
  • metadata["title"]: page title
  • metadata["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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_ceramic-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

langchain_ceramic-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ceramic-0.1.1.tar.gz.

File metadata

  • Download URL: langchain_ceramic-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 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

Hashes for langchain_ceramic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c7ebfcb54dca837f81a67c387642677ca94c28279b8adc31ca07cedce8502460
MD5 411e6c88508e392c1e5c630de378a747
BLAKE2b-256 94e716f24a569f8eb1a001de1a11a24e234f90848218207ae4ef56a8f266c581

See more details on using hashes here.

File details

Details for the file langchain_ceramic-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: langchain_ceramic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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

Hashes for langchain_ceramic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65c3396065a67447aed47a8db62232c8376b31797bcbff2e3b8e3435890a0c43
MD5 749c0cf8e07265360d99fa7645507487
BLAKE2b-256 43ddbb1bae84d19190143cfc38b19a822366e23f2d076b1cb39fa32203d2bc9f

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