LangChain chat model wrappers that expose reasoning/thinking content in ag-ui-langgraph compatible format
Project description
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
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
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_openai_thinking_agui-0.2.2.tar.gz.
File metadata
- Download URL: langchain_openai_thinking_agui-0.2.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a788317fcd3ef184d31726eb3bfe3f0f6c7b8e0653ba03b4bff519fa102fa276
|
|
| MD5 |
951633d705c0a3e7b7c6b800e4050893
|
|
| BLAKE2b-256 |
d12a18e795499ba357b05602329007b93f912af4dad75b3717e3e172e412593a
|
Provenance
The following attestation bundles were made for langchain_openai_thinking_agui-0.2.2.tar.gz:
Publisher:
publish.yml on ryanqduan/langchain-openai-thinking-agui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_openai_thinking_agui-0.2.2.tar.gz -
Subject digest:
a788317fcd3ef184d31726eb3bfe3f0f6c7b8e0653ba03b4bff519fa102fa276 - Sigstore transparency entry: 1027698544
- Sigstore integration time:
-
Permalink:
ryanqduan/langchain-openai-thinking-agui@9723109aa6d72f93545f3acdb429c7785eb1b70c -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ryanqduan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9723109aa6d72f93545f3acdb429c7785eb1b70c -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_openai_thinking_agui-0.2.2-py3-none-any.whl.
File metadata
- Download URL: langchain_openai_thinking_agui-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d744fcb01b7cff439c2599ba03cfb16cd75556fe7da787e2ef4fff5f5b41542
|
|
| MD5 |
7187331db7239b27a63a75922f5d6104
|
|
| BLAKE2b-256 |
f49856421d5307eaa9b35f98f58f955ae0ed4425a8af52db4740011113ed3784
|
Provenance
The following attestation bundles were made for langchain_openai_thinking_agui-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on ryanqduan/langchain-openai-thinking-agui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_openai_thinking_agui-0.2.2-py3-none-any.whl -
Subject digest:
9d744fcb01b7cff439c2599ba03cfb16cd75556fe7da787e2ef4fff5f5b41542 - Sigstore transparency entry: 1027698638
- Sigstore integration time:
-
Permalink:
ryanqduan/langchain-openai-thinking-agui@9723109aa6d72f93545f3acdb429c7785eb1b70c -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/ryanqduan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9723109aa6d72f93545f3acdb429c7785eb1b70c -
Trigger Event:
push
-
Statement type: