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 中的问题复制粘贴到 到输入框中,运行即可。

相关推荐
空空潍3 小时前
Spring AI与LangChain对比:组件对应关系、设计差异与选型指南
人工智能·spring·langchain
liu****5 小时前
LangChain-AI应用开发框架(二)
人工智能·python·langchain·大模型部署
码农的神经元7 小时前
从零实现 LLaMA 架构:一步步构建轻量级大语言模型
人工智能·语言模型·llama
老王熬夜敲代码8 小时前
Planner
langchain
chushiyunen10 小时前
llama-index rag框架笔记
chrome·笔记·llama
青梅煮酒与君饮10 小时前
浅谈大模型、Agent、Function Calling、MCP、Skill、Subagent、Langchain、Workflow
人工智能·python·语言模型·langchain·llama
liu****10 小时前
LangChain-AI应用开发框架(一)
c++·python·langchain·本地部署大模型
飞Link12 小时前
深入挖掘 LangChain Community 核心组件,从数据接入到企业级 RAG 实战
开发语言·python·langchain
m0_7471245313 小时前
LangChain 嵌入向量详解
python·ai·langchain
wggmrlee13 小时前
RAG基于LangChain实现
linux·langchain