Skip to main content

自定义ChatModel

Project description

anychat

自定义任意 ChatModel。

用法

from anychat import ChatModeCenter, AnyChat
from langchain_core.messages import HumanMessage, SystemMessage

# 方式一
model = AnyChat(model_name="ai-model-name", api_key="your-ai-api-key", base_url="your-ai-base-url")
messages = [SystemMessage(content="你好"), HumanMessage(content="你好")]
model.invoke(messages)

# 方式二
cmc = ChatModeCenter(api_key="your-ai-api-key", base_url="your-ai-base-url")
model = cmc.get_chat_model("ai-model-name")
model.invoke(messages)

参考

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anychat-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file anychat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: anychat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for anychat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22539b8d8b0c9197173cb213ad4871188f25c67770096af75dc8c2dd76456e0e
MD5 7e8c568812d45b039bfcbe26d068f82f
BLAKE2b-256 4002ec51ef1760135731bc7ac8f702b3c50f425444ca4fede275f33aae3b7168

See more details on using hashes here.

Supported by

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