No project description provided
Project description
langchain-wenxin - Langchain Baidu WENXINWORKSHOP wrapper
Table of Contents
Installation
pip install langchain-wenxin
Document
WENXINWORKSHOP API: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/flfmc9do2
How to use
export BAIDU_API_KEY="xxxxx"
export BAIDU_SECRET_KEY="xxxxx"
from langchain_wenxin.llms import Wenxin
# Wenxin model
llm = Wenxin(model="ernie-bot-turbo")
print(llm("你好"))
# stream call
for i in llm.stream("你好"):
print(i)
# async call
import asyncio
print(asyncio.run(llm._acall("你好")))
# Wenxin chat model
from langchain_wenxin.chat_models import ChatWenxin
from langchain.schema import HumanMessage
llm = ChatWenxin()
print(llm([HumanMessage(content="你好")]))
Support models:
- ernie-bot: Standard model, https://cloud.baidu.com/doc/WENXINWORKSHOP/s/jlil56u11
- Also named
wenxin
for compatibility.
- Also named
- ernie-bot-turbo: Fast model, https://cloud.baidu.com/doc/WENXINWORKSHOP/s/4lilb2lpf
- Also named
eb-instant
for compatibility.
- Also named
Development
# Create virtual environment
hatch env create
# Activate virtual environment
hatch shell
# Run test
export BAIDU_API_KEY="xxxxxxxx"
export BAIDU_SECRET_KEY="xxxxxxxx"
hatch run test
License
langchain-wenxin
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
langchain_wenxin-0.6.0.tar.gz
(12.7 kB
view hashes)
Built Distribution
Close
Hashes for langchain_wenxin-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c0ede792ba6154f0590cb753c2c7de96ef6c03b68ecc0bf5a042752a82284a6 |
|
MD5 | 23fcbbd72fd5735d669b263709ba1e5f |
|
BLAKE2b-256 | 30b70882d9d20859ed7fe43df9d679f855b0b6e4012b53db2660c9ee8b4d1075 |