Add the API Key to the environment variable. Environment variable key should be "NVIDIA_API_KEY", and provide your API key as the value. Update the version of langchain-nvidia-ai-endpoints package to 0.3.5. This works for me with your code. Please check if it works for you.