langchain-idemcore
LangChain chat model for the Idemcore API. Every answer
comes with a signed, independently verifiable, bit-exact receipt, stored on
AIMessage.response_metadata.
Private package. Do not publish to PyPI without explicit approval.
Install (local)
pip install -e /workspace/idemcore-integrations/packages/langchain-idemcore
export IDEMCORE_API_KEY=ick_...
Requires idemcore>=0.3 (r2 receipts) and idemcore-verify>=0.3.6.
Quickstart
from langchain_core.messages import HumanMessage
from langchain_idemcore import ChatIdemcore, IdemcoreReceiptHandler, verify_langchain_receipt
llm = ChatIdemcore(model="your-model-id", max_tokens=64)
handler = IdemcoreReceiptHandler()
msg = llm.invoke(
[HumanMessage(content="Name the three primary colours.")],
config={"callbacks": [handler]},
)
print(msg.content)
print(msg.response_metadata["receipt_id"]) # rcpt_...
print(handler.to_jsonl())
# Local check of the signed receipt (and of a public token log, if you have one):
# bundle = verify_langchain_receipt(msg, log_text=log_text)
# print(bundle.ok, bundle.verification.levels)
Streaming works the same way: text arrives in chunks, and the receipt is
attached to a later chunk's response_metadata once the answer is complete.
Merging the AIMessageChunks (or using IdemcoreReceiptHandler) preserves it.
for chunk in llm.stream([HumanMessage(content="Write one short sentence.")]):
print(chunk.content, end="")
Receipt metadata
AIMessage.response_metadata (and ChatResult.llm_output) contains:
receipt_id,receipt(the full signed r2 receipt)salt(forhash_onlyreceipts; store it with the conversation)privacy,model,finish_reason,id,usage
IdemcoreReceiptHandler collects those payloads for a whole run and can write
them as JSONL.
verify_langchain_receipt runs idemcore.verify_receipt (signature, optional
token-log chain, optional prompt/answer commitments). When log_text is
given it also runs the open idemcore-verify log check.
Sampling
Idemcore decoding is greedy: temperature is fixed at 0. Passing any other
temperature, or sampling settings such as top_p, top_k, penalties, seed,
n, or stop sequences, raises an error before a request is made. Tool and
function calling are not supported.
max_tokens must be a whole number from 1 to 2048. privacy is hash_only
(default) or full. Auth is IDEMCORE_API_KEY (or api_key=). Billing is
measured server-side in tokens.
Tests
pip install -e ".[dev]"
pytest
Unit tests mock the SDK. A live smoke test runs only when IDEMCORE_API_KEY
is set in the environment.
Metadata
Release files for langchain-idemcore 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_idemcore-0.1.0.tar.gz | 12.0 kB | Without provenance | Details for langchain_idemcore-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_idemcore-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_idemcore-0.1.0-py3-none-any.whl |
Total release size: 22.6 kB
Release files / langchain_idemcore-0.1.0.tar.gz
| Download URL | langchain_idemcore-0.1.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a435ad22cd58495c7cd7bbe21e4650e32b45b2f47a3be5119ae5f7dfa4c4c868
|
|
BLAKE2b-256 checksum How to use checksums |
2a94f283061189250596ee818f6434cfaf89f59f58019ed9e99437f6ba1352af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / langchain_idemcore-0.1.0-py3-none-any.whl
| Download URL | langchain_idemcore-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86b2047d13386ad4dbc3a136038ce7c10450227b966d693174aed9dc463ff336
|
|
BLAKE2b-256 checksum How to use checksums |
e41aacc6f065b2f6b8defd0a5aa14eca170ad8315a2f943594d99c0fe259a74c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for langchain-idemcore 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.