Skip to main content

langchain-openai-thinking-agui

为 LangChain 的 Chat 模型补充思考内容(reasoning/thinking)提取能力,输出格式与 ag-ui-langgraph 兼容。

支持所有 OpenAI 兼容接口的思考模型,包括 DeepSeek、Kimi 等。

安装

pip install langchain-openai-thinking-agui

使用

from langchain_openai_thinking_agui import ChatOpenAIWithThinking

model = ChatOpenAIWithThinking(
    model="deepseek-reasoner",
    base_url="https://api.deepseek.com/v1",
    api_key="your-api-key",
)

res = model.invoke("解释一下天空是蓝色的")
# res.content[0]["thinking"] 是思考内容
# res.content[1]["text"]    是正式回答

输出格式

思考内容以 Anthropic content blocks 格式存放在 AIMessage.content 中,ag-ui-langgraph 可自动识别并触发 THINKING_* 事件流:

[
    {"type": "text", "thinking": "<思考过程>", "index": 0},
    {"type": "text", "text": "<正式回答>"},
]

License

MIT

Metadata

Release files for langchain-openai-thinking-agui 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-openai-thinking-agui 0.2.2
File Size Uploaded Provenance Actions
langchain_openai_thinking_agui-0.2.2.tar.gz 3.5 kB With provenance Details for langchain_openai_thinking_agui-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-openai-thinking-agui 0.2.2
File Interpreter ABI Platform Actions
langchain_openai_thinking_agui-0.2.2-py3-none-any.whl Python 3 none any Details for langchain_openai_thinking_agui-0.2.2-py3-none-any.whl

Total release size: 7.5 kB

Release files / langchain_openai_thinking_agui-0.2.2.tar.gz

Download URL langchain_openai_thinking_agui-0.2.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a788317fcd3ef184d31726eb3bfe3f0f6c7b8e0653ba03b4bff519fa102fa276
BLAKE2b-256 checksum
How to use checksums
d12a18e795499ba357b05602329007b93f912af4dad75b3717e3e172e412593a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 4, 2026.

Transparency log

Release files / langchain_openai_thinking_agui-0.2.2-py3-none-any.whl

Download URL langchain_openai_thinking_agui-0.2.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d744fcb01b7cff439c2599ba03cfb16cd75556fe7da787e2ef4fff5f5b41542
BLAKE2b-256 checksum
How to use checksums
f49856421d5307eaa9b35f98f58f955ae0ed4425a8af52db4740011113ed3784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 4, 2026.

Transparency log

Security for langchain-openai-thinking-agui 0.2.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_openai_thinking_agui-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 4, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page