
    /                        S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SS	KJr  S
 rS r\R                  \R                  " \R                   R"                  5       " S S\R$                  5      5       5       r\R                  \R                  " \R                   R(                  \R                   R*                  5       " S S\5      5       5       rg)z/Vertex AI endpoints direct raw predict command.    N)client)base)	constants)endpoint_util)endpoints_util)flags)region_utilc                 x    [         R                  " U S[        R                  S9  [         R                  " U 5        g )Nz"to do online direct raw prediction)prompt_func)r   AddEndpointResourceArgr	   PromptForOpRegionAddDirectRawPredictInputArgparsers    .lib/surface/ai/endpoints/direct_raw_predict.py_AddArgsr      s/    *//
 ##F+    c                    U R                   R                  R                  5       nUR                  5       S   U l        [
        R                  " XR                  SS9   [        R                  " US9n[        R                  " U R                  5      n[        R                  " US   5      R                  S5      US'   U[        R                   :X  a  UR#                  X$5      nOUR%                  X$5      n[        R                  " UR&                  5      Ul        U R)                  S5      (       d$  [        R*                  " UR&                  SS	9U l        UsS
S
S
5        $ ! , (       d  f       g
= f)z+Run Vertex AI online direct raw prediction.locationsIdT)regionis_prediction)versioninputzutf-8formatoutput)key_nameN)CONCEPTSendpointParseAsDictr   r   AiplatformEndpointOverridesr   EndpointsClientr   ReadInputFromArgsjson_requestbase64	b64decodedecoder   
GA_VERSIONDirectRawPredictDirectRawPredictBetar   IsSpecifiedGetDefaultFormatr   )argsr   endpoint_refendpoints_client
input_jsonresultss         r   _Runr2   &   s   ''--/,##%m4$+00kk --g>  11$2C2CDJ **:g+>?FFwOJw)&&& 11,Kg 55lOg %%gnn5GNH%%"33
..8dk -  s   C7E
E+c                   .    \ rS rSrSr\S 5       rS rSrg)DirectRawPredictGaC   aw  Run Vertex AI online direct raw prediction.

   `{command}` sends a direct raw prediction request to Vertex AI endpoint for
   the given input. The request limit is 10MB.

## EXAMPLES

To direct predict against an endpoint ``123'' under project ``example'' in
region ``us-central1'', run:

  $ {command} 123 --project=example --region=us-central1
  --json-request=input.json
c                     [        U 5        g N)r   r   s    r   ArgsDirectRawPredictGa.ArgsT   s
    Vr   c                 6    [        U[        R                  5      $ r7   )r2   r   r(   selfr-   s     r   RunDirectRawPredictGa.RunX   s    i**++r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr8   r=   __static_attributes__r?   r   r   r4   r4   C   s       ,r   r4   c                       \ rS rSrSrS rSrg)r*   \   a{  Run Vertex AI online direct raw prediction.

   `{command}` sends a direct raw prediction request to Vertex AI endpoint for
   the given input. The request limit is 10MB.

## EXAMPLES

To direct raw predict against an endpoint ``123'' under project ``example'' in
region ``us-central1'', run:

  $ {command} 123 --project=example --region=us-central1
  --json-request=input.json
c                 6    [        U[        R                  5      $ r7   )r2   r   BETA_VERSIONr;   s     r   r=   DirectRawPredictBeta.Runm   s    i,,--r   r?   N)r@   rA   rB   rC   rD   r=   rF   r?   r   r   r*   r*   \   s    .r   r*   )rD   r%   #googlecloudsdk.api_lib.ai.endpointsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r   r   r   r	   r   r2   UniverseCompatibleReleaseTracksReleaseTrackGACommandr4   BETAALPHAr*   r?   r   r   <module>rV      s    6  6 ( 3 7 8 / 5,: D%%((), , * ,. D%%**D,=,=,C,CD.- . E .r   