langchain 课程笔记
时间: 2023-08-19 09:04:44 浏览: 316
您可以在以下地址找到langchain的课程笔记:https://learn.deeplearning.ai/langchain-chat-with-your-data/lesson/1/introduction [1。在开始之前,您需要创建一个名为langchain的虚拟环境,并安装langchain和openai的包。首先,使用以下命令创建虚拟环境:conda create -n langchain python。然后激活该虚拟环境:conda activate langchain。接下来,安装langchain和openai的包:pip install langchain和pip install openai -i https://pypi.tuna.tsinghua.edu.cn/simple [2。在笔记中,您还需要调用llm的api。您可以使用以下代码进行调用:
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from langchain.llms import OpenAI
from langchain.chat_models import ChatOpenAI
from langchain.chains.conversation.memory import ConversationBufferWindowMemory
OPENAI_API_KEY = '***********'
llm = ChatOpenAI(openai_api_key=OPENAI_API_KEY, temperature=0, model_name="gpt-3.5-turbo") [3。
通过这些步骤,您将能够开始学习langchain课程并使用llm的api进行聊天。祝您学习愉快!<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [吴恩达ChatGPT《LangChain Chat with Your Data》笔记](https://blog.csdn.net/weixin_39653948/article/details/131874862)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Langchain学习笔记](https://blog.csdn.net/weixin_38226321/article/details/131062424)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文