Sign inĐăng nhậpGet startedBắt đầu miễn phíSign upBắt đầuOpen consoleVào Console

HomeTrang chủ · IntegrationsTích hợp · LangChainLangChain

Install guideHướng dẫn cài đặt
Available nowCó ngay

Idemcore for LangChainIdemcore cho LangChain

A LangChain chat model that attaches a signed, bit-exact receipt to every answer.Mô hình chat LangChain, mỗi câu trả lời kèm biên nhận khớp từng bit, có chữ ký.

langchain-idemcore is a LangChain chat model for the Idemcore API. Every answer includes a signed, independently verifiable receipt on the message metadata.langchain-idemcore là mô hình chat LangChain cho API Idemcore. Mỗi câu trả lời kèm biên nhận có chữ ký, kiểm chứng được độc lập, nằm trong metadata của tin nhắn.

Install stepsCác bước cài đặt

  1. 1
    Install Python 3.9 or newer.Cài Python 3.9 trở lên.
  2. 2
    Run pip install langchain-idemcore.Chạy pip install langchain-idemcore.
  3. 3
    Export IDEMCORE_API_KEY and call ChatIdemcore, as in the example below.Xuất IDEMCORE_API_KEY và gọi ChatIdemcore, như ví dụ bên dưới.
  4. 4
    Check the receipt on your machine with verify_langchain_receipt.Kiểm biên nhận trên máy bạn bằng verify_langchain_receipt.

PrerequisitesĐiều kiện cần

  • Python 3.9 or newer.
  • pip, and a virtual environment if you use one.
  • An Idemcore API key in IDEMCORE_API_KEY.
  • The package depends on idemcore 0.3 or newer and idemcore-verify 0.3.6 or newer (installed automatically).
  • Python 3.9 trở lên.
  • pip, và môi trường ảo nếu bạn dùng.
  • Khóa API Idemcore trong IDEMCORE_API_KEY.
  • Gói phụ thuộc idemcore 0.3 trở lên và idemcore-verify 0.3.6 trở lên (được cài kèm).

A minimal working exampleVí dụ tối thiểu chạy được

A short chat that also checks the signed receipt on your machine:Một cuộc chat ngắn, đồng thời kiểm biên nhận có chữ ký ngay trên máy bạn:

import os
from langchain_core.messages import HumanMessage
from langchain_idemcore import ChatIdemcore, IdemcoreReceiptHandler, verify_langchain_receipt

# export IDEMCORE_API_KEY=ick_…
llm = ChatIdemcore(model="qwen3.8-27b-idna", 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"])
bundle = verify_langchain_receipt(msg)
print(bundle.ok)

Options and configurationTùy chọn và cấu hình

Receipt fields live on AIMessage.response_metadata (and ChatResult.llm_output): receipt_id, receipt, salt (store it with the conversation when privacy is hash_only), privacy, model, finish_reason, and usage.

  • IdemcoreReceiptHandler collects receipts for a whole run and can write them as JSONL.
  • verify_langchain_receipt checks the signature and, when you pass a token log, the open verifier log check.
  • Decoding is greedy: temperature is fixed at 0. Other sampling settings are rejected. max_tokens must be from 1 to 2048. privacy is hash_only (default) or full.
  • Tool and function calling are not supported. Streaming works; the receipt is attached once the answer is complete.

Các trường biên nhận nằm trên AIMessage.response_metadata (và ChatResult.llm_output): receipt_id, receipt, salt (hãy lưu cùng cuộc hội thoại khi privacy là hash_only), privacy, model, finish_reason và usage.

  • IdemcoreReceiptHandler thu thập biên nhận cho cả lượt chạy và có thể ghi chúng dạng JSONL.
  • verify_langchain_receipt kiểm chữ ký và, khi bạn đưa log token, cả bước kiểm log của công cụ kiểm chứng mở.
  • Giải mã là greedy: temperature được cố định ở 0. Các thiết lập lấy mẫu khác bị từ chối. max_tokens từ 1 đến 2048. privacy là hash_only (mặc định) hoặc full.
  • Không hỗ trợ gọi công cụ hay hàm. Streaming vẫn chạy; biên nhận được gắn khi câu trả lời hoàn tất.

TroubleshootingXử lý sự cố

ImportError or the package is not found.ImportError hoặc không thấy gói.

Install from PyPI with pip install langchain-idemcore and confirm you are in the same environment you run the script in.Cài từ PyPI bằng pip install langchain-idemcore và chắc bạn đang ở đúng môi trường dùng để chạy script.

The model rejects temperature or top_p.Mô hình từ chối temperature hoặc top_p.

Idemcore decoding is greedy, so temperature stays at 0. Leave those settings unset.Giải mã Idemcore là greedy, nên temperature luôn là 0. Hãy để trống các thiết lập đó.

bundle.ok is false.bundle.ok là false.

Confirm the receipt object was not trimmed, and pass the token log if you are checking the log chain. You can also open a public share on the receipt page.Hãy chắc đối tượng biên nhận không bị cắt, và đưa log token nếu bạn đang kiểm chuỗi log. Bạn cũng có thể mở bản chia sẻ công khai trên trang biên nhận.

Version and changelogPhiên bản và nhật ký thay đổi

Current published version: 0.1.0.Phiên bản đang phát hành: 0.1.0.

See the version on PyPI, and the site changelog.Xem phiên bản trên PyPI, và nhật ký thay đổi trên site.

SupportHỗ trợ

Questions about install, API keys or receipts: support@idemcore.net. Security reports: security@idemcore.net. Sales and pilots: dev@idemcore.net.Câu hỏi về cài đặt, khóa API hoặc biên nhận: support@idemcore.net. Báo cáo bảo mật: security@idemcore.net. Bán hàng và thí điểm: dev@idemcore.net.

support@idemcore.net · Contact page →Trang liên hệ →

Package registryKho gói

View on PyPI →Xem trên PyPI →

How to get an API keyCách lấy khóa API

The chat model reads IDEMCORE_API_KEY. Checking a saved receipt with verify_langchain_receipt does not send the key.Mô hình chat đọc IDEMCORE_API_KEY. Việc kiểm biên nhận đã lưu bằng verify_langchain_receipt không gửi khóa.

To create a key, sign in to the console and create an API key. It starts with ick_ and is shown once, so keep it on your server. Then set IDEMCORE_API_KEY in the environment.Để tạo khóa, đăng nhập console và tạo khóa API. Khóa bắt đầu bằng ick_ và chỉ hiện một lần, hãy giữ nó ở phía máy chủ. Sau đó đặt IDEMCORE_API_KEY trong biến môi trường.

Get a key on this site →Lấy khóa trên trang này → Open the console →Mở console →

How to check a receiptCách kiểm biên nhận

Call verify_langchain_receipt on the message, or open a public share on the receipt page at idemcore.net/r/.Gọi verify_langchain_receipt trên tin nhắn, hoặc mở bản chia sẻ công khai trên trang biên nhận tại idemcore.net/r/.

You can also open a public share on the receipt page, or use the check page on this site.Bạn cũng có thể mở bản chia sẻ công khai trên trang biên nhận, hoặc dùng trang kiểm trên site này.

Receipt page →Trang biên nhận → Check a receipt →Kiểm một biên nhận →