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.7.0.tar.gz
(18.5 kB
view hashes)
Built Distribution
Close
Hashes for langchain_wenxin-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62e0a74f0d92538003403982d2d9431fd15cf941c96f1160227e30281dd7a642 |
|
MD5 | 39e0234dd467b0c8df99c9a87b44718f |
|
BLAKE2b-256 | 4eee89859fb0cedcff2a22cd5f7e181f7992d98614295da204824ca6d5fbe33a |