Skip to main content

Azure OpenAI LLM

The Azure OpenAI LLM provider enables your agent to use Azure OpenAI's language models (like GPT-4o) for text-based conversations and processing. It also supports vision input capabilities, allowing your agent to analyze and respond to images alongside text with the supported models.

Installation

Install the Azure OpenAI-enabled VideoSDK Agents package:

pip install "videosdk-plugins-openai"

Importing

from videosdk.plugins.openai import OpenAILLM

Authentication

The Azure OpenAI plugin requires either an Azure OpenAI API key.

Set AZURE_OPENAI_API_KEY , AZURE_OPENAI_ENDPOINT and OPENAI_API_VERSION in your .env file.

Example Usage

from videosdk.plugins.openai import OpenAILLM
from videosdk.agents import CascadingPipeline

# Initialize the Azure OpenAI LLM model
llm = OpenAILLM.azure(
azure_deployment="gpt-4o",
temperature=0.7,
)

# Add llm to cascading pipeline
pipeline = CascadingPipeline(llm=llm)
note

When using .env file for credentials, don't pass them as arguments to model instances or context objects. The SDK automatically reads environment variables, so omit api_key, videosdk_auth, and other credential parameters from your code.

Configuration Options

  • azure_deployment: The OpenAI deployment ID to use (by default it is model name: e.g., "gpt-4o", "gpt-4o-mini")
  • api_key: Your Azure OpenAI API key (can also be set via environment variable)
  • azure_endpoint: Your Azure OpenAI Deployment Endpoint URL (can also be set via environment variable)
  • api_version: Your Azure OpenAI API version (can also be set via environment variable)
  • temperature: (float) Sampling temperature for response randomness (0.0 to 2.0, default: 0.7)
  • tool_choice: Tool selection mode (e.g., "auto", "none", or specific tool)
  • max_completion_tokens: (int) Maximum number of tokens in the completion response

Additional Resources

The following resources provide more information about using OpenAI with VideoSDK Agents SDK.

Got a Question? Ask us on discord