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

相关推荐
dllmayday1 天前
Milvus在LangChain中使用方法
人工智能·ai·langchain·milvus
倦王1 天前
langchain 尚硅谷day4-5 Tool工具调用部分(function calling)
langchain
小陈的进阶之路1 天前
LangChain/LangGraph对比
langchain
Flittly1 天前
【LangGraph新手村系列】(3)PostgreSQL 持久化检查点:让状态跨越进程与重启
人工智能·python·langchain
JAVA面经实录9171 天前
企业级java+LangChain4j-RAG系统 限流熔断降级
java·开发语言·分布式·langchain
Mr_sst1 天前
infra-ai模块宏观设计解析:业务与模型之间的中间层核心架构
大数据·人工智能·ai·llama
hjxu20161 天前
【LangGraph入门 3】精细控制之图的运行时配置和map-reduce
langchain·langgraph
hrhcode1 天前
【LangGraph】二.State 和 Node 的设计细节
python·ai·langchain·langgraph·ai框架
Trouvaille ~1 天前
零基础入门 LangChain 与 LangGraph(八):真正让 Agent“活起来”——持久化、记忆、人机交互与时间旅行
langchain·人机交互·agent·python3.11·持久化机制·langgraph·ai应用开发
abigale031 天前
LangChain:自定义模型・RAG 检索・Agent 原理笔记
langchain·llm·prompt·agent·rag·lcel