Press Release Chat Bot

A shared folder with AI prompts and code snippets

From workspace: Nvidia

Team: Main

Total snippets: 5

Nvidia

Press Release Chat Bot

5 snippets

Step 2 - Ask with Knowledge Base

Sends the same prompt but with retrieval from the knowledge base (use_knowledge_base = true).

data = { "messages": [ { "role": "user", "content": "how many cores are on the nvidia grace superchip?" } ], "use_knowledge_base": "true", "max_tokens": 50 } url =...

Step 2 - Ask without Knowledge Base

Sends a prompt to the LLM without using the knowledge base (use_knowledge_base = false).

import time import json data = { "messages": [ { "role": "user", "content": "how many cores are on the nvidia grace superchip?" } ], "use_knowledge_base": "false", "max_tokens": 256 } url =...

Step 1 - Upload PDFs

Uploads a maximum of 100 PDF documents to the FastAPI endpoint.

import time start_time = time.time() NUM_DOCS_TO_UPLOAD = 100 upload_pdf_files("dataset", "http://chain-server:8081/documents", NUM_DOCS_TO_UPLOAD) print(f"--- {time.time() - start_time} seconds ---")

Step 1 - Define Upload Functions

Defines helper functions to upload PDF documents to a FastAPI endpoint (using Milvus vector DB).

import os import requests import mimetypes def upload_document(file_path, url): headers = { 'accept': 'application/json' } mime_type, _ = mimetypes.guess_type(file_path) files = { 'file': (file_path,...

Step 1 - Unzip Dataset

Unzips a dataset archive containing NVIDIA blog PDFs.

%capture !unzip dataset.zip

Nvidia - Press Release Chat Bot - AI Prompts & Code Snippets | Snippets AI