# anychat **Repository Path**: kin9-0rz/anychat ## Basic Information - **Project Name**: anychat - **Description**: 自定义ChatModel - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: https://pypi.org/project/anychat/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-06 - **Last Updated**: 2024-12-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # anychat 自定义任意 ChatModel。 ## 用法 ```python 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) ``` ## 参考 - [langchain_community/chat_models](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/chat_models) - [langchain_community/llms](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/llms)