A shared folder with AI prompts and code snippets
From workspace: Nvidia
Team: Main
Total snippets: 5
5 snippets
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 =...
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 =...
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 ---")
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,...
Unzips a dataset archive containing NVIDIA blog PDFs.
%capture !unzip dataset.zip