Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NVIDIA_BASE_URL and NVIDIA_API_KEY to control hosted vs local endpoints #897

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

mattf
Copy link
Contributor

@mattf mattf commented Jan 29, 2025

What does this PR do?

allows template distribution connect to hosted or local NIM:

use --env NVIDIA_BASE_URL=http://localhost:8000 to connect to a local NIM running at localhost:8000

use --env NVIDIA_API_KEY=blah when connecting to hosted NIM, e.g. NVIDIA_BASE_URL=https://integrate.api.nvidia.com

Test Plan

  • llama stack run ./llama_stack/templates/nvidia/run.yaml -> error, e.g. API key is required for hosted NVIDIA NIM

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_BASE_URL=https://integrate.api.nvidia.com -> error, e.g. API key is required for hosted NVIDIA NIM

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_API_KEY=REDACTED -> successful connection to NIM on https://integrate.api.nvidia.com

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_BASE_URL=https://integrate.api.nvidia.com --env NVIDIA_API_KEY=REDACTED -> successful connection to NIM running on integrate.api.nvidia.com

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_BASE_URL=http://localhost:8000 -> successful connection to NIM running on localhost:8000

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_BASE_URL=http://localhost:8000 --env NVIDIA_API_KEY=REDACTED -> successful connection to NIM running on http://localhost:8000

  • llama stack run ./llama_stack/templates/nvidia/run.yaml --env NVIDIA_BASE_URL=http://bogus -> runtime error, e.g. ConnectionError (TODO: this should be a startup error)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Ran pre-commit to handle lint / formatting issues.
  • Read the contributor guideline,
    Pull Request section?
  • Updated relevant documentation.
  • Wrote necessary unit or integration tests.

…points

 use --env NVIDIA_BASE_URL=http://localhost:8000 to connect to a local NIM running at localhost:8000

 use --env NVIDIA_API_KEY=blah when connecting to hosted NIM, e.g. NVIDIA_BASE_URL=https://integrate.api.nvidia.com
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 29, 2025
@mattf
Copy link
Contributor Author

mattf commented Jan 29, 2025

cc @cdgamarose-nv

Copy link
Contributor

@ashwinb ashwinb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@ashwinb ashwinb merged commit 11b1cdf into meta-llama:main Jan 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants