Integrate with the MoonshotChat LLM using LangChain Python.
Moonshot is a Chinese startup that provides LLM service for companies and individuals.This example goes over how to use LangChain to interact with Moonshot.
Copy
from langchain_community.llms.moonshot import Moonshot
Copy
import os# Generate your api key from: https://platform.moonshot.cn/console/api-keysos.environ["MOONSHOT_API_KEY"] = "MOONSHOT_API_KEY"
Copy
llm = Moonshot()# or use a specific model# Available models: https://platform.moonshot.cn/docs# llm = Moonshot(model="moonshot-v1-128k")
Copy
# Prompt the modelllm.invoke("What is the difference between panda and bear?")