我们已完成 1.25 亿美元的 B 轮融资,用于构建代理工程平台。阅读更多。
Python
##Installing the langchain packages needed to use the integration pip install -qU langchain-community
import os os.environ["BAICHUAN_API_KEY"] = "YOUR_API_KEY"
from langchain_community.llms import BaichuanLLM # Load the model llm = BaichuanLLM() res = llm.invoke("What's your name?") print(res)
res = llm.generate(prompts=["你好!"]) res
for res in llm.stream("Who won the second world war?"): print(res)
import asyncio async def run_aio_stream(): async for res in llm.astream("Write a poem about the sun."): print(res) asyncio.run(run_aio_stream())
此页面有帮助吗?