I’m trying to follow this guide and I keep getting the same error.
It says To get started, create a free account with the NVIDIA API catalog and follow these steps:
Select any model.
Choose Python, Get API Key.
Save the generated key as NVIDIA_API_KEY.
From there, you should have access to the endpoints.
This is exactly what I do and I keep getting this error:
Exception: [401] Unauthorized
invalid response from UAM
Please check or regenerate your API key.
When I run the provided sample code:
from langchain_nvidia_ai_endpoints import ChatNVIDIA
client = ChatNVIDIA(
model="meta/llama-3.1-405b-instruct",
api_key=api_key,
temperature=0.2,
top_p=0.7,
max_tokens=1024,
)
for chunk in client.stream([{"role":"user","content":"Write a limerick about the wonders of GPU computing."}]):
print(chunk.content, end="")
Is it not becasue of the varible misnaming (at least appears to be)? it looks as if you name the api key variable “NVIDIA_API_KEY” whern you make the key, then it looks like you are calling it in like “api_key=api_key,”
?
try maybe api_key=NVIDIA_API_KEY ?