Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsChat modelsAnthropicAnthropic FunctionsAnyscaleAzureAzureML Chat Online EndpointBaichuan ChatBaidu QianfanBedrock ChatCohereERNIE-Bot ChatEverlyAIFireworksGCP Vertex AIJinaChatKonkoğŸš… LiteLLMLlama APIMiniMaxOllamaOpenAIPromptLayer ChatOpenAITongyi QwenvLLM ChatYandexGPTDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsChat modelsBaichuan ChatOn this pageBaichuan ChatBaichuan chat models API by Baichuan Intelligent Technology. For more information, see https://platform.baichuan-ai.com/docs/apifrom langchain.chat_models import ChatBaichuanfrom langchain.schema import HumanMessagechat = ChatBaichuan(    baichuan_api_key='YOUR_API_KEY',    baichuan_secret_key='YOUR_SECRET_KEY')or you can set api_key and secret_key in your environment variablesexport BAICHUAN_API_KEY=YOUR_API_KEYexport BAICHUAN_SECRET_KEY=YOUR_SECRET_KEYchat([    HumanMessage(content='æˆ‘æ—¥è–ª8å�—é’±ï¼Œè¯·é—®åœ¨é—°å¹´çš„äºŒæœˆï¼Œæˆ‘æœˆè–ªå¤šå°‘')])    AIMessage(content='é¦–å…ˆï¼Œæˆ‘ä»¬éœ€è¦�ç¡®å®šé—°å¹´çš„äºŒæœˆæœ‰å¤šå°‘å¤©ã€‚é—°å¹´çš„äºŒæœˆæœ‰29å¤©ã€‚\n\nç„¶å��ï¼Œæˆ‘ä»¬å�¯ä»¥è®¡ç®—ä½ çš„æœˆè–ªï¼š\n\næ—¥è–ª = æœˆè–ª / (å½“æœˆå¤©æ•°)\n\næ‰€ä»¥ï¼Œä½ çš„æœˆè–ª = æ—¥è–ª * å½“æœˆå¤©æ•°\n\nå°†æ•°å€¼ä»£å…¥å…¬å¼�ï¼š\n\næœˆè–ª = 8å…ƒ/å¤© * 29å¤© = 232å…ƒ\n\nå› æ­¤ï¼Œä½ åœ¨é—°å¹´çš„äºŒæœˆçš„æœˆè–ªæ˜¯232å…ƒã€‚')For ChatBaichuan with Streamingâ€‹chat = ChatBaichuan(    baichuan_api_key='YOUR_API_KEY',    baichuan_secret_key='YOUR_SECRET_KEY',    streaming=True)chat([    HumanMessage(content='æˆ‘æ—¥è–ª8å�—é’±ï¼Œè¯·é—®åœ¨é—°å¹´çš„äºŒæœˆï¼Œæˆ‘æœˆè–ªå¤šå°‘')])    AIMessageChunk(content='é¦–å…ˆï¼Œæˆ‘ä»¬éœ€è¦�ç¡®å®šé—°å¹´çš„äºŒæœˆæœ‰å¤šå°‘å¤©ã€‚é—°å¹´çš„äºŒæœˆæœ‰29å¤©ã€‚\n\nç„¶å��ï¼Œæˆ‘ä»¬å�¯ä»¥è®¡ç®—ä½ çš„æœˆè–ªï¼š\n\næ—¥è–ª = æœˆè–ª /
Baichuan chat models API by Baichuan Intelligent Technology. For more information, see https://platform.baichuan-ai.com/docs/api
Baichuan chat models API by Baichuan Intelligent Technology. For more information, see https://platform.baichuan-ai.com/docs/api ->: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsChat modelsAnthropicAnthropic FunctionsAnyscaleAzureAzureML Chat Online EndpointBaichuan ChatBaidu QianfanBedrock ChatCohereERNIE-Bot ChatEverlyAIFireworksGCP Vertex AIJinaChatKonkoğŸš… LiteLLMLlama APIMiniMaxOllamaOpenAIPromptLayer ChatOpenAITongyi QwenvLLM ChatYandexGPTDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsChat modelsBaichuan ChatOn this pageBaichuan ChatBaichuan chat models API by Baichuan Intelligent Technology. For more information, see https://platform.baichuan-ai.com/docs/apifrom langchain.chat_models import ChatBaichuanfrom langchain.schema import HumanMessagechat = ChatBaichuan(    baichuan_api_key='YOUR_API_KEY',    baichuan_secret_key='YOUR_SECRET_KEY')or you can set api_key and secret_key in your environment variablesexport BAICHUAN_API_KEY=YOUR_API_KEYexport BAICHUAN_SECRET_KEY=YOUR_SECRET_KEYchat([    HumanMessage(content='æˆ‘æ—¥è–ª8å�—é’±ï¼Œè¯·é—®åœ¨é—°å¹´çš„äºŒæœˆï¼Œæˆ‘æœˆè–ªå¤šå°‘')])    AIMessage(content='é¦–å…ˆï¼Œæˆ‘ä»¬éœ€è¦�ç¡®å®šé—°å¹´çš„äºŒæœˆæœ‰å¤šå°‘å¤©ã€‚é—°å¹´çš„äºŒæœˆæœ‰29å¤©ã€‚\n\nç„¶å��ï¼Œæˆ‘ä»¬å�¯ä»¥è®¡ç®—ä½ çš„æœˆè–ªï¼š\n\næ—¥è–ª = æœˆè–ª / (å½“æœˆå¤©æ•°)\n\næ‰€ä»¥ï¼Œä½ çš„æœˆè–ª = æ—¥è–ª * å½“æœˆå¤©æ•°\n\nå°†æ•°å€¼ä»£å…¥å…¬å¼�ï¼š\n\næœˆè–ª = 8å…ƒ/å¤© * 29å¤© = 232å…ƒ\n\nå› æ­¤ï¼Œä½ åœ¨é—°å¹´çš„äºŒæœˆçš„æœˆè–ªæ˜¯232å…ƒã€‚')For ChatBaichuan with Streamingâ€‹chat = ChatBaichuan(    baichuan_api_key='YOUR_API_KEY',    baichuan_secret_key='YOUR_SECRET_KEY',    streaming=True)chat([    HumanMessage(content='æˆ‘æ—¥è–ª8å�—é’±ï¼Œè¯·é—®åœ¨é—°å¹´çš„äºŒæœˆï¼Œæˆ‘æœˆè–ªå¤šå°‘')])    AIMessageChunk(content='é¦–å…ˆï¼Œæˆ‘ä»¬éœ€è¦�ç¡®å®šé—°å¹´çš„äºŒæœˆæœ‰å¤šå°‘å¤©ã€‚é—°å¹´çš„äºŒæœˆæœ‰29å¤©ã€‚\n\nç„¶å��ï¼Œæˆ‘ä»¬å�¯ä»¥è®¡ç®—ä½ çš„æœˆè–ªï¼š\n\næ—¥è–ª = æœˆè–ª /