Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page décrit les différents types de bibliothèques clientes que l'appliance isolée Google Distributed Cloud (GDC) propose pour les API Vertex AI et explique comment les installer à partir du fichier tar.
L'appliance GDC air-gapped propose différents services Vertex AI, y compris la reconnaissance optique des caractères (OCR), Vertex AI Translation et Speech-to-Text. Chaque service fournit sa propre API, que vous pouvez installer à l'aide de bibliothèques clientes.
Les bibliothèques clientes simplifient l'accès aux API Vertex AI à partir des langages compatibles sur l'appliance GDC isolée. Bien que vous puissiez utiliser directement les API Vertex AI en envoyant des requêtes brutes au serveur, les bibliothèques clientes fournissent des simplifications qui réduisent le code requis.
Les bibliothèques clientes sont la méthode recommandée pour accéder par programmation aux API Vertex AI. Installez une bibliothèque cliente Vertex AI en extrayant le fichier de bibliothèque directement à partir du fichier tar.
Bibliothèques clientes Vertex AI
Vertex AI propose différentes versions de bibliothèques clientes pour les systèmes d'exploitation CentOS et Ubuntu.
Les conventions de dénomination des bibliothèques clientes Vertex AI dans le fichier tar sont basées sur le système d'exploitation, le nom du service et la version. Les noms de fichiers respectent le format suivant :
OS-google-cloud-SERVICE-VERSION.tar.gz
Remplacez les éléments suivants :
OS : nom de l'OS sur lequel vous souhaitez installer la bibliothèque cliente. Les valeurs autorisées sont centos et ubuntu.
SERVICE : nom du service Vertex AI à partir duquel vous souhaitez télécharger la bibliothèque cliente. Voici les valeurs autorisées :
aiplatform : bibliothèque cliente Vertex AI Platform.
speech : bibliothèque cliente Speech-to-Text.
translate : bibliothèque cliente Vertex AI Translation.
vision : bibliothèque cliente OCR.
VERSION : numéro de version de la bibliothèque cliente, tel que 3.8.0.
Le tableau suivant contient les bibliothèques clientes Vertex AI compatibles avec l'appliance GDC isolée du réseau :
Pour savoir comment vous authentifier auprès de votre fournisseur d'identité configuré, consultez l'authentification gcloud CLI.
Attribuez le rôle Lecteur Cloud AI (cloud-ai-viewer) à un compte de service.
Le compte de service a besoin de ce rôle pour accéder aux services Vertex AI.
Vérifiez que vous avez installé Python version 3.7.
Installer une bibliothèque cliente
Après avoir rempli les conditions préalables, procédez comme suit pour télécharger le fichier TAR et l'utiliser pour installer une bibliothèque cliente :
Téléchargez la bibliothèque cliente que vous souhaitez installer :
Remplacez FOLDER_NAME par le chemin d'accès au répertoire local dans lequel vous avez téléchargé le fichier de bibliothèque.
Importez la bibliothèque cliente à l'aide d'un script Python. L'exemple suivant montre un extrait de code d'un script Python qui importe la bibliothèque cliente Vertex AI Translation pour illustrer l'importation de bibliothèques :
Enregistrez le script Python sous un nom, par exemple translation-service.py.
Exécutez le script Python :
pythonSCRIPT_NAME
Remplacez SCRIPT_NAME par le nom que vous avez donné à votre script Python, par exemple translation-service.py.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["# Install Vertex AI client libraries\n\nThis page describes the various types of client libraries that\nGoogle Distributed Cloud (GDC) air-gapped appliance offers for Vertex AI APIs and\nexplains how to install them from the tar file.\n\nGDC air-gapped appliance offers various Vertex AI\nservices, including Optical Character Recognition (OCR), Vertex AI Translation, and\nSpeech-to-Text. Each service provides its own API, which you can install using\nclient libraries.\n\nClient libraries simplify accessing Vertex AI APIs from supported\nlanguages on GDC air-gapped appliance. Although you can use\nVertex AI APIs directly by making raw server requests, client\nlibraries provide simplifications that reduce the required code.\n\nClient libraries are the recommended method for accessing\nVertex AI APIs programmatically. Install a\nVertex AI client library by extracting the library file directly\nfrom the tar file.\n\nVertex AI client libraries\n--------------------------\n\nVertex AI offers different versions of client libraries for\nCentOS and Ubuntu operating systems.\n\nThe naming conventions of Vertex AI client libraries in the tar\nfile are based on the operating system, the service name, and the version. The\nfilenames adhere to the following format: \n\n \u003cvar translate=\"no\"\u003eOS\u003c/var\u003e-google-cloud-\u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e-\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e.tar.gz\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eOS\u003c/var\u003e: the name of the operating system where you want to install the client library. Allowed values are `centos` and `ubuntu`.\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e: the name of the Vertex AI\n service from which you want to download the client library. The following are\n the allowed values:\n\n - `aiplatform`: the Vertex AI Platform client library.\n - `speech`: the Speech-to-Text client library.\n - `translate`: the Vertex AI Translation client library.\n - `vision`: the OCR client library.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: the version number of the client library,\n such as `3.8.0`.\n\nThe following table contains the Vertex AI client libraries that\nGDC air-gapped appliance supports:\n\nBefore you begin\n----------------\n\nBefore downloading the tar file and extracting client libraries, follow these\nsteps:\n\n1. [Set up a project for Vertex AI](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vertex-ai-set-up-project).\n\n2. Authenticate with gdcloud CLI:\n\n gdcloud auth login\n\n For more information about how to authenticate with your configured identity\n provider, see [the gdcloud CLI authentication](/distributed-cloud/hosted/docs/latest/appliance/resources/gdcloud-auth).\n3. Assign the Cloud AI Viewer (`cloud-ai-viewer`) role to [a service account](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vertex-ai-set-up-project#set-up-service).\n The service account requires this role to access the Vertex AI\n services.\n\n4. Verify that you have installed Python version 3.7.\n\nInstall a client library\n------------------------\n\nAfter completing the [prerequisites](#before-you-begin), follow these steps to\ndownload the tar file, and use the tar file to install a client library:\n\n1. Download the client library you want to install:\n\n wget https://\u003cvar translate=\"no\"\u003eGDC_URL\u003c/var\u003e/.well-known/static/client-libraries/\u003cvar translate=\"no\"\u003eCLIENT_LIBRARY\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eGDC_URL\u003c/var\u003e: the URL of your organization in GDC.\n - \u003cvar translate=\"no\"\u003eCLIENT_LIBRARY\u003c/var\u003e: the filename of the [client library](#clientlib) you want to download.\n2. Extract the library file:\n\n tar -zxf \u003cvar translate=\"no\"\u003eCLIENT_LIBRARY\u003c/var\u003e\n\n3. Install the client library in GDC air-gapped appliance:\n\n pip install -r \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eFOLDER_NAME\u003c/span\u003e\u003c/var\u003e/requirements.txt --no-index --find-links \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eFOLDER_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eFOLDER_NAME\u003c/var\u003e with the path to the local\n directory where you downloaded the library file.\n4. Import the client library using a Python script. The following example shows\n a code snippet of a Python script that imports the Vertex AI Translation\n client library to illustrate what importing libraries looks like:\n\n from google.cloud import https://cloud.google.com/python/docs/reference/translate/latest/google.cloud.translate_v2.client.Client.html\n translate_client = https://cloud.google.com/python/docs/reference/translate/latest/google.cloud.translate_v2.client.Client.html.https://cloud.google.com/python/docs/reference/translate/latest/google.cloud.translate_v2.client.Client.html(\n client_options={\"\u003cvar translate=\"no\"\u003eAPI_ENDPOINT\u003c/var\u003e\": \"https://foo-translation.googleapis.com\"})\n result\n = translate_client.https://cloud.google.com/python/docs/reference/translate/latest/google.cloud.translate_v2.client.Client.html(text, target_language=\"ru\")\n\n [...]\n\n This code sample is not complete. To make a Vertex AI Translation\n request, [learn about translation features](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/vertex-ai-translation).\n5. Save the Python script with a name, such as `translation-service.py`.\n\n6. Run the Python script:\n\n python \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSCRIPT_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eSCRIPT_NAME\u003c/var\u003e with the name you gave to your\n Python script, such as `translation-service.py`."]]