Hello,
I was using the following query to verify the api key connection to NIM:
import json
import requests # import requests module
apiEndpoint = “https://api.nvidia.com/v1/models/llama-3.1-8b-instruct” # remove indentation
apiKey = “FROM”NVIDIA NIM website # remove indentation
req = requests.get(apiEndpoint, headers={“Authorization”: "Bearer " + apiKey, “Content-Type”: “application/json”}, verify=False) # Disable SSL verification temporarily
try:
if req.status_code == 200: # access status_code attribute for response status
print(“Connected to NVIDIA Build LLaMA model”) # use print function to output to console
print(req.text) # access response body with req.text
else:
print("Error connecting to NVIDIA Build LLaMA model: " + str(req.status_code)) # use str to convert status_code to string and concatenate with +
except Exception as e: # catch exception and print error message
print("Error connecting to NVIDIA Build LLaMA model: " + str(e))
The message is below:
Error connecting to NVIDIA Build LLaMA model: 404
/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py:1100: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘api.nvidia.com’. Adding certificate verification is strongly advised. See: Advanced Usage - urllib3 2.2.3.dev38 documentation
warnings.warn(
Could you pls advise the reason?