NVIDIA Hands-on Lab——Building RAG Agents with LLMs

NVIDIA DLI RAG课程(Course Detail | NVIDIA ),并获得该课程证书。

1 07的ipynb文件中设定,使用这两个模型配置

embedder = NVIDIAEmbeddings(model="nvidia/nv-embed-v1", truncate="END")
# ChatNVIDIA.get_available_models()
instruct_llm = ChatNVIDIA(model="mistralai/mixtral-8x7b-instruct-v0.1")

大约会在Part3的 Task3出错,否则会早早出错。

08不用改

运行完 所有cell后,点击下面的绿色的 Link To Gradio Frontend 文字,跳转到我们服务启动的页面

35的ipynb文件脚本需要修改几处:

从07/08两个脚本中复制代码出来

从07 Part3复制如下

chat_prompt = ChatPromptTemplate.from_messages([("system",
    "You are a document chatbot. Help the user as they ask questions about documents."
    " User messaged just asked: {input}\n\n"
    " From this, we have retrieved the following potentially-useful info: "
    " Conversation History Retrieval:\n{history}\n\n"
    " Document Retrieval:\n{context}\n\n"
    " (Answer only from retrieval. Only cite sources that are used. Make your response conversational.)"
), ('user', '{input}')])


embedder = NVIDIAEmbeddings(model="nvidia/nv-embed-v1", truncate="END")

08 Part3 Task1 复制如下

from langchain_nvidia_ai_endpoints import NVIDIAEmbeddings
from langchain_community.vectorstores import FAISS

docstore = FAISS.load_local("docstore_index", embedder, allow_dangerous_deserialization=True)
docs = list(docstore.docstore._dict.values())

再手写补充如下

add_routes(
    app,
    docstore.as_retriever(),
    path="/retriever",
)


add_routes(
    app,
    chat_prompt | llm,
    path="/generator",
)

然后将 08 中的问题复制粘贴到 到输入框中,运行即可。

相关推荐
逐梦苍穹12 小时前
速通LLaMA1:《LLaMA: Open and Efficient Foundation Language Models》全文解读
人工智能·语言模型·llama
张3蜂1 天前
Ubuntu LLaMA-Factory实战
llama
逐梦苍穹1 天前
速通LLaMA2:《Llama 2: Open Foundation and Fine-Tuned Chat Models》全文解读
论文阅读·人工智能·语言模型·llama·论文笔记·llama2
telllong1 天前
使用llama.cpp 在推理MiniCPM-1.2B模型
c++·llama·llama.cpp
akhfuiigabv2 天前
探索LangChain中的最新NLP研究:创新与应用
人工智能·python·自然语言处理·langchain
人在旅途我渐行渐远2 天前
FewShotChatMessagePromptTemplate 和 FewShotPromptTemplate区别
langchain·少样本学习
akhfuiigabv2 天前
使用LangChain创建简单的语言模型应用程序【快速入门指南】
java·python·语言模型·langchain
洛阳泰山3 天前
Chainlit集成Langchain并使用通义千问AI知识库高级检索(多重查询)网页对话应用教程
人工智能·python·langchain·llm·chainlit
洛阳泰山4 天前
Chainlit集成Langchain并使用通义千问实现和数据库交互的网页对话应用增强扩展(text2sql)
数据库·python·langchain·交互·通义千问·postgres·chainlit
我爱学Python!4 天前
大模型教程:使用 Milvus、vLLM 和 Llama 3.1 搭建 RAG 应用
自然语言处理·大模型·llm·大语言模型·llama·milvus·rag