Generic avatar

Updated

Integrate a generic avatar provider into Conversational AI Engine.

The generic avatar vendor allows you to integrate a custom avatar provider into the Conversational AI Engine.

Info

This integration is fully supported for use with Conversational AI Engine. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.

Sample configuration

The following examples show how to configure a generic avatar provider when starting a conversational AI agent.

from agora_agent import Agent
from agora_agent.agentkit.vendors import GenericAvatar

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(...)  # configure your STT vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
    .with_avatar(GenericAvatar(
        api_key='<AVATAR_API_KEY>',
        api_base_url='<AVATAR_API_BASE_URL>',
        avatar_id='<AVATAR_ID>',
        agora_uid='<AGORA_UID>',
    ))
)
import { Agent, GenericAvatar } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your STT vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */)
  .withAvatar(new GenericAvatar({
    apiKey: '<AVATAR_API_KEY>',
    apiBaseUrl: '<AVATAR_API_BASE_URL>',
    avatarId: '<AVATAR_ID>',
    agoraUid: '<AGORA_UID>',
  }));
import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
  WithLlm(/* configure your LLM vendor */).
  WithTts(/* configure your TTS vendor */).
  WithAvatar(
    vendors.NewGenericAvatar(vendors.GenericAvatarOptions{
        APIKey:     "<AVATAR_API_KEY>",
        APIBaseURL: "<AVATAR_API_BASE_URL>",
        AvatarID:   "<AVATAR_ID>",
        AgoraUID:   "<AGORA_UID>",
    }),
)

Use the following avatar configuration in your request:

"avatar": {
  "vendor": "generic",
  "params": {
    "api_key": "<AVATAR_API_KEY>",
    "api_base_url": "<AVATAR_API_BASE_URL>",
    "avatar_id": "<AVATAR_ID>",
    "agora_token": "<AGORA_TOKEN>",
    "agora_uid": "<AGORA_UID>"
  }
}

Key parameters

paramsrequired
api_keystring
required

The API key used for authentication with the avatar provider.

api_base_urlstring
required

The base URL of the avatar provider's API endpoint.

avatar_idstring
required

The unique identifier for the avatar to use.

agora_tokenstring
optional

The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials.

agora_uidstring
required

The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel.