Skip to main content

在LangChain中流畅地使用讯飞星火大模型

Project description

🦜️🔗✨ LangChain-xfyun

⚡ 在LangChain中流畅地使用讯飞星火大模型 ⚡

Release Notes License: MIT Open in Dev Containers Open in GitHub Codespaces GitHub star chart Open Issues

⏩ 快速安装

pip install langchain-xfyun

🤔 这是什么?

大型语言模型(LLM)正在成为一种变革性技术,它使开发人员能够构建以前无法构建的应用程序。然而,孤立地使用这些 LLM 通常不足以创建真正强大的应用程序,只有将它们与其他计算或知识来源相结合,才能发挥真正的威力。

  • Fork from langchain

  • 添加了讯飞星火大模型的支持,让你可以在langchain中使用SparkLLM

  • [TODO] 修改langchain内置prompt以适应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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_xfyun-0.0.275b2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

langchain_xfyun-0.0.275b2-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

Details for the file langchain_xfyun-0.0.275b2.tar.gz.

File metadata

  • Download URL: langchain_xfyun-0.0.275b2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.4.0

File hashes

Hashes for langchain_xfyun-0.0.275b2.tar.gz
Algorithm Hash digest
SHA256 2cc0e9a0dd00ce3cbf1ead3f1a176bee340d508ea039daf4cd624fc1096d0cb9
MD5 ae5523615ac34b8f69866f8c7e2f2bb4
BLAKE2b-256 0493abf62c6118ae2bd289d204b5975cf6384bc836eab4bf3bd31442074cfaf5

See more details on using hashes here.

File details

Details for the file langchain_xfyun-0.0.275b2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_xfyun-0.0.275b2-py3-none-any.whl
Algorithm Hash digest
SHA256 8815290baa509869f17dde79b13dcee252051ddd39115717f840f6f18e710041
MD5 dc0eea1260a8030c6eecf26161d60dd4
BLAKE2b-256 2e0e6e17a1286a12e5b2db5f87dd4312a247f0cb11957ed4de019cff5dcab0a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page