在LangChain中流畅地使用讯飞星火大模型
Project description
🦜️🔗✨ LangChain-xfyun
⚡ 在LangChain中流畅地使用讯飞星火大模型 ⚡
⏩ 快速安装
pip install langchain-xfyun
🤔 这是什么?
大型语言模型(LLM)正在成为一种变革性技术,它使开发人员能够构建以前无法构建的应用程序。然而,孤立地使用这些 LLM 通常不足以创建真正强大的应用程序,只有将它们与其他计算或知识来源相结合,才能发挥真正的威力。
-
Fork from langchain
-
添加了讯飞星火大模型的支持,让你可以在langchain中使用SparkLLM
-
其它关于langchain的信息可以参考 LangChain's original README.md
❓ 如何使用
from langchain_xfyun.chat_models import ChatSpark
from langchain_xfyun.prompts import ChatPromptTemplate
from langchain_xfyun.chains import LLMChain
llm = ChatSpark(app_id="your_app_id", api_key="your_api_key",
api_secret="your_api_secret")
prompt = ChatPromptTemplate.from_template(
"我有一个生产[{product}]商品的公司,请帮我取一个最合适的公司名称。只输出答案本身"
)
chain = LLMChain(llm=llm, prompt=prompt, verbose=True)
product = "魔方"
ans = chain.run(product)
print(ans)
-
像以前一样使用chat model,现在你可以使用
ChatSpark
而不是ChatOpenAI
-
更详细的内容请参考langchain 官方文档
💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see here.
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
Built Distribution
Close
Hashes for langchain_xfyun-0.0.275b1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 230bd596bce6447930a0ae3c1d3baeb34ba6d7a213fce0461f9b7800560f394c |
|
MD5 | 2bd83b691295552f1bcdf991c78dd179 |
|
BLAKE2b-256 | d3da7013f7ab06cb024683ec0dfa5fd20da5649aaddda145aedac444439a2008 |
Close
Hashes for langchain_xfyun-0.0.275b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8f5e9b494b5043c29189c69ca83664dc96d4deed50f9e72d8a5c5c9a8eceeac |
|
MD5 | 2c844f9347986524e35e8cb30d0e0b4c |
|
BLAKE2b-256 | 46925c8ff031c1f36547047a74b2ce9c860e572049e4f643c483574ff9634997 |