Skip to main content
This example demonstrates how to create and use an Upsonic Agent with NVIDIA NIM models using the NvidiaModel class. The example shows how to leverage NVIDIA’s powerful AI models through their NIM (NVIDIA Inference Microservice) API, including models like Llama 3.1 Nemotron 70B, GPT-OSS, Mistral, and many others.

Overview

Upsonic framework provides seamless integration with NVIDIA’s AI models through the NIM API. This example showcases:
  1. NvidiaModel Integration β€” Using NVIDIA NIM API to access various AI models
  2. Agent Configuration β€” Creating an Upsonic Agent with NVIDIA models
  3. Task Execution β€” Running tasks with the configured agent
  4. FastAPI Server β€” Running the agent as a production-ready API server
The NvidiaModel class provides access to NVIDIA’s curated collection of AI models, including:
  • Llama 3.1 Nemotron 70B β€” High-performance instruction-tuned model
  • GPT-OSS models β€” OpenAI’s open-source models
  • Mistral models β€” Mistral AI’s powerful language models
  • And many more β€” Access to NVIDIA’s full model catalog

Project Structure

Environment Variables

You can configure the model using environment variables:
Getting your NVIDIA API key:
  1. Visit https://build.nvidia.com/
  2. Sign up or log in to your NVIDIA account
  3. Navigate to API Keys section
  4. Create a new API key
  5. Copy the key to your environment variables

Installation

Managing Dependencies

Sections: api, streamlit, development

Usage

Option 1: Run Directly

Runs the agent with a default test query.

Option 2: Run as API Server

Server starts at http://localhost:8000. API documentation at /docs. Example API call:

How It Works

ComponentDescription
NvidiaModelWraps NVIDIA NIM API for model access
AgentUpsonic Agent configured with NvidiaModel
TaskTask object containing user query
ExecutionAgent processes task and returns response

Example Output

Query:
Response:

Complete Implementation

main.py

upsonic_configs.json

For more information on NVIDIA NIM:

Repository

View the complete example: NVIDIA Agent Example