AI Agent Note (LangChain调用通义千问大模型)
2025-12-01 00:00:00 # AI

Using LangChain to call Tongyi Qianwen

0x03、Chain calling of LLM

In previous article, we firstly get the prompt, than we use prompt to call LLM.

Here is another method to call LLM. We combine the prompt template with LLM, and name it chain.

1
2
3
# Chain calling of LLM
chain = few_shot_prompt_template | llm
print(chain)

image-20251201143909368

Than, we use chain calling.

1
2
resp = chain.stream(input={"text": "This is chain calling of LLM"})
Resp(resp)

image-20251201145827774