Using LangChain
The simplest way is to directly set environment variables as shown below
Download Address: https://www.langchain.com/
Note: Ensure to add /v1 at the end of openai_api_base,
langchain.chat_models import ChatOpenAI
Example code for using LLM to make predictions
The core is actually in setting the key and URL
Methods include:
- Setting using environment variables
- Passing in variables
- Manually setting environment variables
os
After running, you can see the return: