from langchain_openai import ChatOpenAIfrom langchain.schema import HumanMessage, SystemMessage# Create LLM instancellm = ChatOpenAI( temperature=0.7, model="glm-4.5", openai_api_key="your-Z.AI-api-key", openai_api_base="https://api.z.ai/api/paas/v4/")# Create messagesmessages = [ SystemMessage(content="You are a helpful AI assistant"), HumanMessage(content="Please introduce the development history of artificial intelligence")]# Call the modelresponse = llm(messages)print(response.content)
LangChain is a rapidly evolving framework. It is recommended to update to the latest version regularly for optimal functionality and performance. Meanwhile, Z.AI will continue to optimize integration with LangChain to ensure the best compatibility and user experience.