Gemini Live API overview

رابط برنامه‌نویسی کاربردی زنده (Live API) امکان تعاملات صوتی و تصویری با تأخیر کم و به‌صورت بلادرنگ را با Gemini فراهم می‌کند. این رابط، جریان‌های مداوم صدا، تصاویر و متن را پردازش می‌کند تا پاسخ‌های گفتاری فوری و شبیه به انسان ارائه دهد و یک تجربه مکالمه طبیعی را برای کاربران شما ایجاد کند.

بررسی اجمالی API زنده

موارد استفاده

Live API can be used to build real-time voice agents for a variety of industries, including:

  • تجارت الکترونیک و خرده‌فروشی: دستیاران خرید که توصیه‌های شخصی‌سازی‌شده ارائه می‌دهند و نمایندگان پشتیبانی که مشکلات مشتری را حل می‌کنند.
  • Gaming: Interactive non-player characters (NPCs), in-game help assistants, and real-time translation of in-game content.
  • Next-gen interfaces: Voice- and video-enabled experiences in robotics, smart glasses, and vehicles.
  • Healthcare: Health companions for patient support and education.
  • Financial services: AI advisors for wealth management and investment guidance.
  • Education: AI mentors and learner companions that provide personalized instruction and feedback.

ویژگی‌های کلیدی

Live API offers a comprehensive set of features for building robust voice agents:

  • Multilingual support : Converse in 70 supported languages.
  • Barge-in : Users can interrupt the model at any time for responsive interactions.
  • Tool use : Integrates tools like function calling and Google Search for dynamic interactions.
  • Audio transcriptions : Provides text transcripts of both user input and model output.
  • Proactive audio : Lets you control when the model responds and in what contexts.
  • Affective dialog : Adapts response style and tone to match the user's input expression.

مشخصات فنی

The following table outlines the technical specifications for the Live API:

دسته بندی جزئیات
روش‌های ورودی Audio (raw 16-bit PCM audio, 16kHz, little-endian), images (JPEG <= 1FPS), text
روش‌های خروجی Audio (raw 16-bit PCM audio, 24kHz, little-endian)
پروتکل اتصال وب سوکت با وضعیت (WSS)

انتخاب رویکرد پیاده‌سازی

When integrating with Live API, you'll need to choose one of the following implementation approaches:

  • سرور به سرور : بک‌اند شما با استفاده از WebSockets به Live API متصل می‌شود. معمولاً کلاینت شما داده‌های استریم (صوت، تصویر، متن) را به سرور شما ارسال می‌کند، که سپس آن را به Live API ارسال می‌کند.
  • Client-to-server : Your frontend code connects directly to the Live API using WebSockets to stream data, bypassing your backend.

شروع کنید

Select the guide that matches your development environment:

سرور به سرور

Connect to the Gemini Live API using the GenAI SDK to build a real-time multimodal application with a Python backend.

کلاینت به سرور

Connect to the Gemini Live API using WebSockets to build a real-time multimodal application with a JavaScript frontend and ephemeral tokens.

کیت توسعه عامل

Create an agent and use the Agent Development Kit (ADK) Streaming to enable voice and video communication.

ادغام شرکا

To streamline the development of real-time audio and video apps, you can use a third-party integration that supports the Gemini Live API over WebRTC or WebSockets.