techprotrade commited on
Commit
569a3e5
·
verified ·
1 Parent(s): d120491

Add loan-advisor-agent (part 11)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +67 -0
  2. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest_asyncio.cpython-312.pyc +3 -0
  3. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest_base.cpython-312.pyc +0 -0
  4. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py +436 -0
  5. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py +775 -0
  6. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py +895 -0
  7. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py +0 -0
  8. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py +0 -0
  9. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py +0 -0
  10. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py +22 -0
  11. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/__init__.cpython-312.pyc +0 -0
  12. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/async_client.cpython-312.pyc +3 -0
  13. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/client.cpython-312.pyc +3 -0
  14. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/pagers.cpython-312.pyc +0 -0
  15. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py +0 -0
  16. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/client.py +0 -0
  17. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py +1334 -0
  18. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py +54 -0
  19. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/__init__.cpython-312.pyc +0 -0
  20. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/base.cpython-312.pyc +0 -0
  21. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/grpc.cpython-312.pyc +0 -0
  22. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/grpc_asyncio.cpython-312.pyc +0 -0
  23. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest.cpython-312.pyc +3 -0
  24. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_asyncio.cpython-312.pyc +3 -0
  25. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_base.cpython-312.pyc +3 -0
  26. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py +877 -0
  27. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py +1649 -0
  28. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py +1918 -0
  29. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py +0 -0
  30. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py +0 -0
  31. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py +0 -0
  32. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py +22 -0
  33. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/__init__.cpython-312.pyc +0 -0
  34. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/async_client.cpython-312.pyc +0 -0
  35. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/client.cpython-312.pyc +0 -0
  36. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py +1144 -0
  37. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py +1651 -0
  38. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py +54 -0
  39. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/__init__.cpython-312.pyc +0 -0
  40. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/base.cpython-312.pyc +0 -0
  41. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/grpc.cpython-312.pyc +0 -0
  42. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/grpc_asyncio.cpython-312.pyc +0 -0
  43. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest.cpython-312.pyc +0 -0
  44. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest_asyncio.cpython-312.pyc +0 -0
  45. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest_base.cpython-312.pyc +0 -0
  46. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py +326 -0
  47. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py +569 -0
  48. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py +642 -0
  49. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py +2042 -0
  50. loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py +2198 -0
.gitattributes CHANGED
@@ -355,3 +355,70 @@ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/servi
355
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
356
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
357
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
356
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
357
  loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
358
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
359
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
360
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
361
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
362
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
363
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
364
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
365
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/memory_bank_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
366
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/metadata_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
367
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/metadata_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
368
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
369
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
370
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
371
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
372
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/migration_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
373
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
374
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
375
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
376
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
377
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
378
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
379
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
380
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
381
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
382
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/model_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
383
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/notebook_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
384
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/notebook_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
385
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
386
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
387
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
388
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
389
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
390
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/pipeline_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
391
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/pipeline_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
392
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
393
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
394
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
395
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
396
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
397
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
398
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
399
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
400
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/schedule_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
401
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
402
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
403
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/session_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
404
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/session_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
405
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
406
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
407
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
408
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/tensorboard_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
409
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
410
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
411
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
412
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
413
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
414
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
415
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
416
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
417
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
418
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
419
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vizier_service/__pycache__/async_client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
420
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vizier_service/__pycache__/client.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
421
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__pycache__/rest.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
422
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__pycache__/rest_asyncio.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
423
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/__pycache__/rest_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
424
+ loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/types/__pycache__/evaluation_service.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest_asyncio.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c16bb0818f6ce55b5034aec2da891d234aa2bb69f0dde1432d6392f6281bd9cd
3
+ size 188996
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/__pycache__/rest_base.cpython-312.pyc ADDED
Binary file (85.8 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ from google.cloud.aiplatform_v1beta1 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.api_core import operations_v1
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.oauth2 import service_account # type: ignore
29
+ import google.protobuf
30
+
31
+ from google.cloud.aiplatform_v1beta1.types import index
32
+ from google.cloud.aiplatform_v1beta1.types import index_service
33
+ from google.cloud.location import locations_pb2 # type: ignore
34
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
35
+ from google.iam.v1 import policy_pb2 # type: ignore
36
+ from google.longrunning import operations_pb2 # type: ignore
37
+
38
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
39
+ gapic_version=package_version.__version__
40
+ )
41
+
42
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
43
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
44
+
45
+
46
+ class IndexServiceTransport(abc.ABC):
47
+ """Abstract transport class for IndexService."""
48
+
49
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
50
+
51
+ DEFAULT_HOST: str = "aiplatform.googleapis.com"
52
+
53
+ def __init__(
54
+ self,
55
+ *,
56
+ host: str = DEFAULT_HOST,
57
+ credentials: Optional[ga_credentials.Credentials] = None,
58
+ credentials_file: Optional[str] = None,
59
+ scopes: Optional[Sequence[str]] = None,
60
+ quota_project_id: Optional[str] = None,
61
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
62
+ always_use_jwt_access: Optional[bool] = False,
63
+ api_audience: Optional[str] = None,
64
+ **kwargs,
65
+ ) -> None:
66
+ """Instantiate the transport.
67
+
68
+ Args:
69
+ host (Optional[str]):
70
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
71
+ credentials (Optional[google.auth.credentials.Credentials]): The
72
+ authorization credentials to attach to requests. These
73
+ credentials identify the application to the service; if none
74
+ are specified, the client will attempt to ascertain the
75
+ credentials from the environment.
76
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
77
+ be loaded with :func:`google.auth.load_credentials_from_file`.
78
+ This argument is mutually exclusive with credentials. This argument will be
79
+ removed in the next major version of this library.
80
+ scopes (Optional[Sequence[str]]): A list of scopes.
81
+ quota_project_id (Optional[str]): An optional project to use for billing
82
+ and quota.
83
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
84
+ The client info used to send a user-agent string along with
85
+ API requests. If ``None``, then default info will be used.
86
+ Generally, you only need to set this if you're developing
87
+ your own client library.
88
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
89
+ be used for service account credentials.
90
+ """
91
+
92
+ # Save the scopes.
93
+ self._scopes = scopes
94
+ if not hasattr(self, "_ignore_credentials"):
95
+ self._ignore_credentials: bool = False
96
+
97
+ # If no credentials are provided, then determine the appropriate
98
+ # defaults.
99
+ if credentials and credentials_file:
100
+ raise core_exceptions.DuplicateCredentialArgs(
101
+ "'credentials_file' and 'credentials' are mutually exclusive"
102
+ )
103
+
104
+ if credentials_file is not None:
105
+ credentials, _ = google.auth.load_credentials_from_file(
106
+ credentials_file,
107
+ scopes=scopes,
108
+ quota_project_id=quota_project_id,
109
+ default_scopes=self.AUTH_SCOPES,
110
+ )
111
+ elif credentials is None and not self._ignore_credentials:
112
+ credentials, _ = google.auth.default(
113
+ scopes=scopes,
114
+ quota_project_id=quota_project_id,
115
+ default_scopes=self.AUTH_SCOPES,
116
+ )
117
+ # Don't apply audience if the credentials file passed from user.
118
+ if hasattr(credentials, "with_gdch_audience"):
119
+ credentials = credentials.with_gdch_audience(
120
+ api_audience if api_audience else host
121
+ )
122
+
123
+ # If the credentials are service account credentials, then always try to use self signed JWT.
124
+ if (
125
+ always_use_jwt_access
126
+ and isinstance(credentials, service_account.Credentials)
127
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
128
+ ):
129
+ credentials = credentials.with_always_use_jwt_access(True)
130
+
131
+ # Save the credentials.
132
+ self._credentials = credentials
133
+
134
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
135
+ if ":" not in host:
136
+ host += ":443"
137
+ self._host = host
138
+
139
+ @property
140
+ def host(self):
141
+ return self._host
142
+
143
+ def _prep_wrapped_messages(self, client_info):
144
+ # Precompute the wrapped methods.
145
+ self._wrapped_methods = {
146
+ self.create_index: gapic_v1.method.wrap_method(
147
+ self.create_index,
148
+ default_timeout=5.0,
149
+ client_info=client_info,
150
+ ),
151
+ self.get_index: gapic_v1.method.wrap_method(
152
+ self.get_index,
153
+ default_timeout=5.0,
154
+ client_info=client_info,
155
+ ),
156
+ self.import_index: gapic_v1.method.wrap_method(
157
+ self.import_index,
158
+ default_timeout=None,
159
+ client_info=client_info,
160
+ ),
161
+ self.list_indexes: gapic_v1.method.wrap_method(
162
+ self.list_indexes,
163
+ default_timeout=5.0,
164
+ client_info=client_info,
165
+ ),
166
+ self.update_index: gapic_v1.method.wrap_method(
167
+ self.update_index,
168
+ default_timeout=5.0,
169
+ client_info=client_info,
170
+ ),
171
+ self.delete_index: gapic_v1.method.wrap_method(
172
+ self.delete_index,
173
+ default_timeout=5.0,
174
+ client_info=client_info,
175
+ ),
176
+ self.upsert_datapoints: gapic_v1.method.wrap_method(
177
+ self.upsert_datapoints,
178
+ default_timeout=None,
179
+ client_info=client_info,
180
+ ),
181
+ self.remove_datapoints: gapic_v1.method.wrap_method(
182
+ self.remove_datapoints,
183
+ default_timeout=None,
184
+ client_info=client_info,
185
+ ),
186
+ self.get_location: gapic_v1.method.wrap_method(
187
+ self.get_location,
188
+ default_timeout=None,
189
+ client_info=client_info,
190
+ ),
191
+ self.list_locations: gapic_v1.method.wrap_method(
192
+ self.list_locations,
193
+ default_timeout=None,
194
+ client_info=client_info,
195
+ ),
196
+ self.get_iam_policy: gapic_v1.method.wrap_method(
197
+ self.get_iam_policy,
198
+ default_timeout=None,
199
+ client_info=client_info,
200
+ ),
201
+ self.set_iam_policy: gapic_v1.method.wrap_method(
202
+ self.set_iam_policy,
203
+ default_timeout=None,
204
+ client_info=client_info,
205
+ ),
206
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
207
+ self.test_iam_permissions,
208
+ default_timeout=None,
209
+ client_info=client_info,
210
+ ),
211
+ self.cancel_operation: gapic_v1.method.wrap_method(
212
+ self.cancel_operation,
213
+ default_timeout=None,
214
+ client_info=client_info,
215
+ ),
216
+ self.delete_operation: gapic_v1.method.wrap_method(
217
+ self.delete_operation,
218
+ default_timeout=None,
219
+ client_info=client_info,
220
+ ),
221
+ self.get_operation: gapic_v1.method.wrap_method(
222
+ self.get_operation,
223
+ default_timeout=None,
224
+ client_info=client_info,
225
+ ),
226
+ self.list_operations: gapic_v1.method.wrap_method(
227
+ self.list_operations,
228
+ default_timeout=None,
229
+ client_info=client_info,
230
+ ),
231
+ self.wait_operation: gapic_v1.method.wrap_method(
232
+ self.wait_operation,
233
+ default_timeout=None,
234
+ client_info=client_info,
235
+ ),
236
+ }
237
+
238
+ def close(self):
239
+ """Closes resources associated with the transport.
240
+
241
+ .. warning::
242
+ Only call this method if the transport is NOT shared
243
+ with other clients - this may cause errors in other clients!
244
+ """
245
+ raise NotImplementedError()
246
+
247
+ @property
248
+ def operations_client(self):
249
+ """Return the client designed to process long-running operations."""
250
+ raise NotImplementedError()
251
+
252
+ @property
253
+ def create_index(
254
+ self,
255
+ ) -> Callable[
256
+ [index_service.CreateIndexRequest],
257
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
258
+ ]:
259
+ raise NotImplementedError()
260
+
261
+ @property
262
+ def get_index(
263
+ self,
264
+ ) -> Callable[
265
+ [index_service.GetIndexRequest], Union[index.Index, Awaitable[index.Index]]
266
+ ]:
267
+ raise NotImplementedError()
268
+
269
+ @property
270
+ def import_index(
271
+ self,
272
+ ) -> Callable[
273
+ [index_service.ImportIndexRequest],
274
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
275
+ ]:
276
+ raise NotImplementedError()
277
+
278
+ @property
279
+ def list_indexes(
280
+ self,
281
+ ) -> Callable[
282
+ [index_service.ListIndexesRequest],
283
+ Union[
284
+ index_service.ListIndexesResponse,
285
+ Awaitable[index_service.ListIndexesResponse],
286
+ ],
287
+ ]:
288
+ raise NotImplementedError()
289
+
290
+ @property
291
+ def update_index(
292
+ self,
293
+ ) -> Callable[
294
+ [index_service.UpdateIndexRequest],
295
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
296
+ ]:
297
+ raise NotImplementedError()
298
+
299
+ @property
300
+ def delete_index(
301
+ self,
302
+ ) -> Callable[
303
+ [index_service.DeleteIndexRequest],
304
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
305
+ ]:
306
+ raise NotImplementedError()
307
+
308
+ @property
309
+ def upsert_datapoints(
310
+ self,
311
+ ) -> Callable[
312
+ [index_service.UpsertDatapointsRequest],
313
+ Union[
314
+ index_service.UpsertDatapointsResponse,
315
+ Awaitable[index_service.UpsertDatapointsResponse],
316
+ ],
317
+ ]:
318
+ raise NotImplementedError()
319
+
320
+ @property
321
+ def remove_datapoints(
322
+ self,
323
+ ) -> Callable[
324
+ [index_service.RemoveDatapointsRequest],
325
+ Union[
326
+ index_service.RemoveDatapointsResponse,
327
+ Awaitable[index_service.RemoveDatapointsResponse],
328
+ ],
329
+ ]:
330
+ raise NotImplementedError()
331
+
332
+ @property
333
+ def list_operations(
334
+ self,
335
+ ) -> Callable[
336
+ [operations_pb2.ListOperationsRequest],
337
+ Union[
338
+ operations_pb2.ListOperationsResponse,
339
+ Awaitable[operations_pb2.ListOperationsResponse],
340
+ ],
341
+ ]:
342
+ raise NotImplementedError()
343
+
344
+ @property
345
+ def get_operation(
346
+ self,
347
+ ) -> Callable[
348
+ [operations_pb2.GetOperationRequest],
349
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
350
+ ]:
351
+ raise NotImplementedError()
352
+
353
+ @property
354
+ def cancel_operation(
355
+ self,
356
+ ) -> Callable[
357
+ [operations_pb2.CancelOperationRequest],
358
+ None,
359
+ ]:
360
+ raise NotImplementedError()
361
+
362
+ @property
363
+ def delete_operation(
364
+ self,
365
+ ) -> Callable[
366
+ [operations_pb2.DeleteOperationRequest],
367
+ None,
368
+ ]:
369
+ raise NotImplementedError()
370
+
371
+ @property
372
+ def wait_operation(
373
+ self,
374
+ ) -> Callable[
375
+ [operations_pb2.WaitOperationRequest],
376
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
377
+ ]:
378
+ raise NotImplementedError()
379
+
380
+ @property
381
+ def set_iam_policy(
382
+ self,
383
+ ) -> Callable[
384
+ [iam_policy_pb2.SetIamPolicyRequest],
385
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
386
+ ]:
387
+ raise NotImplementedError()
388
+
389
+ @property
390
+ def get_iam_policy(
391
+ self,
392
+ ) -> Callable[
393
+ [iam_policy_pb2.GetIamPolicyRequest],
394
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
395
+ ]:
396
+ raise NotImplementedError()
397
+
398
+ @property
399
+ def test_iam_permissions(
400
+ self,
401
+ ) -> Callable[
402
+ [iam_policy_pb2.TestIamPermissionsRequest],
403
+ Union[
404
+ iam_policy_pb2.TestIamPermissionsResponse,
405
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
406
+ ],
407
+ ]:
408
+ raise NotImplementedError()
409
+
410
+ @property
411
+ def get_location(
412
+ self,
413
+ ) -> Callable[
414
+ [locations_pb2.GetLocationRequest],
415
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
416
+ ]:
417
+ raise NotImplementedError()
418
+
419
+ @property
420
+ def list_locations(
421
+ self,
422
+ ) -> Callable[
423
+ [locations_pb2.ListLocationsRequest],
424
+ Union[
425
+ locations_pb2.ListLocationsResponse,
426
+ Awaitable[locations_pb2.ListLocationsResponse],
427
+ ],
428
+ ]:
429
+ raise NotImplementedError()
430
+
431
+ @property
432
+ def kind(self) -> str:
433
+ raise NotImplementedError()
434
+
435
+
436
+ __all__ = ("IndexServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py ADDED
@@ -0,0 +1,775 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ from google.api_core import grpc_helpers
23
+ from google.api_core import operations_v1
24
+ from google.api_core import gapic_v1
25
+ import google.auth # type: ignore
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.protobuf.json_format import MessageToJson
29
+ import google.protobuf.message
30
+
31
+ import grpc # type: ignore
32
+ import proto # type: ignore
33
+
34
+ from google.cloud.aiplatform_v1beta1.types import index
35
+ from google.cloud.aiplatform_v1beta1.types import index_service
36
+ from google.cloud.location import locations_pb2 # type: ignore
37
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
38
+ from google.iam.v1 import policy_pb2 # type: ignore
39
+ from google.longrunning import operations_pb2 # type: ignore
40
+ from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO
41
+
42
+ try:
43
+ from google.api_core import client_logging # type: ignore
44
+
45
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
46
+ except ImportError: # pragma: NO COVER
47
+ CLIENT_LOGGING_SUPPORTED = False
48
+
49
+ _LOGGER = std_logging.getLogger(__name__)
50
+
51
+
52
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
53
+ def intercept_unary_unary(self, continuation, client_call_details, request):
54
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
55
+ std_logging.DEBUG
56
+ )
57
+ if logging_enabled: # pragma: NO COVER
58
+ request_metadata = client_call_details.metadata
59
+ if isinstance(request, proto.Message):
60
+ request_payload = type(request).to_json(request)
61
+ elif isinstance(request, google.protobuf.message.Message):
62
+ request_payload = MessageToJson(request)
63
+ else:
64
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
65
+
66
+ request_metadata = {
67
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
68
+ for key, value in request_metadata
69
+ }
70
+ grpc_request = {
71
+ "payload": request_payload,
72
+ "requestMethod": "grpc",
73
+ "metadata": dict(request_metadata),
74
+ }
75
+ _LOGGER.debug(
76
+ f"Sending request for {client_call_details.method}",
77
+ extra={
78
+ "serviceName": "google.cloud.aiplatform.v1beta1.IndexService",
79
+ "rpcName": str(client_call_details.method),
80
+ "request": grpc_request,
81
+ "metadata": grpc_request["metadata"],
82
+ },
83
+ )
84
+ response = continuation(client_call_details, request)
85
+ if logging_enabled: # pragma: NO COVER
86
+ response_metadata = response.trailing_metadata()
87
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
88
+ metadata = (
89
+ dict([(k, str(v)) for k, v in response_metadata])
90
+ if response_metadata
91
+ else None
92
+ )
93
+ result = response.result()
94
+ if isinstance(result, proto.Message):
95
+ response_payload = type(result).to_json(result)
96
+ elif isinstance(result, google.protobuf.message.Message):
97
+ response_payload = MessageToJson(result)
98
+ else:
99
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
100
+ grpc_response = {
101
+ "payload": response_payload,
102
+ "metadata": metadata,
103
+ "status": "OK",
104
+ }
105
+ _LOGGER.debug(
106
+ f"Received response for {client_call_details.method}.",
107
+ extra={
108
+ "serviceName": "google.cloud.aiplatform.v1beta1.IndexService",
109
+ "rpcName": client_call_details.method,
110
+ "response": grpc_response,
111
+ "metadata": grpc_response["metadata"],
112
+ },
113
+ )
114
+ return response
115
+
116
+
117
+ class IndexServiceGrpcTransport(IndexServiceTransport):
118
+ """gRPC backend transport for IndexService.
119
+
120
+ A service for creating and managing Vertex AI's Index
121
+ resources.
122
+
123
+ This class defines the same methods as the primary client, so the
124
+ primary client can load the underlying transport implementation
125
+ and call it.
126
+
127
+ It sends protocol buffers over the wire using gRPC (which is built on
128
+ top of HTTP/2); the ``grpcio`` package must be installed.
129
+ """
130
+
131
+ _stubs: Dict[str, Callable]
132
+
133
+ def __init__(
134
+ self,
135
+ *,
136
+ host: str = "aiplatform.googleapis.com",
137
+ credentials: Optional[ga_credentials.Credentials] = None,
138
+ credentials_file: Optional[str] = None,
139
+ scopes: Optional[Sequence[str]] = None,
140
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
141
+ api_mtls_endpoint: Optional[str] = None,
142
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
143
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
144
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
145
+ quota_project_id: Optional[str] = None,
146
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
147
+ always_use_jwt_access: Optional[bool] = False,
148
+ api_audience: Optional[str] = None,
149
+ ) -> None:
150
+ """Instantiate the transport.
151
+
152
+ Args:
153
+ host (Optional[str]):
154
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
155
+ credentials (Optional[google.auth.credentials.Credentials]): The
156
+ authorization credentials to attach to requests. These
157
+ credentials identify the application to the service; if none
158
+ are specified, the client will attempt to ascertain the
159
+ credentials from the environment.
160
+ This argument is ignored if a ``channel`` instance is provided.
161
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
162
+ be loaded with :func:`google.auth.load_credentials_from_file`.
163
+ This argument is ignored if a ``channel`` instance is provided.
164
+ This argument will be removed in the next major version of this library.
165
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
166
+ ignored if a ``channel`` instance is provided.
167
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
168
+ A ``Channel`` instance through which to make calls, or a Callable
169
+ that constructs and returns one. If set to None, ``self.create_channel``
170
+ is used to create the channel. If a Callable is given, it will be called
171
+ with the same arguments as used in ``self.create_channel``.
172
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
173
+ If provided, it overrides the ``host`` argument and tries to create
174
+ a mutual TLS channel with client SSL credentials from
175
+ ``client_cert_source`` or application default SSL credentials.
176
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
177
+ Deprecated. A callback to provide client SSL certificate bytes and
178
+ private key bytes, both in PEM format. It is ignored if
179
+ ``api_mtls_endpoint`` is None.
180
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
181
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
182
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
183
+ A callback to provide client certificate bytes and private key bytes,
184
+ both in PEM format. It is used to configure a mutual TLS channel. It is
185
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
186
+ quota_project_id (Optional[str]): An optional project to use for billing
187
+ and quota.
188
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
189
+ The client info used to send a user-agent string along with
190
+ API requests. If ``None``, then default info will be used.
191
+ Generally, you only need to set this if you're developing
192
+ your own client library.
193
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
194
+ be used for service account credentials.
195
+
196
+ Raises:
197
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
198
+ creation failed for any reason.
199
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
200
+ and ``credentials_file`` are passed.
201
+ """
202
+ self._grpc_channel = None
203
+ self._ssl_channel_credentials = ssl_channel_credentials
204
+ self._stubs: Dict[str, Callable] = {}
205
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
206
+
207
+ if api_mtls_endpoint:
208
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
209
+ if client_cert_source:
210
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
211
+
212
+ if isinstance(channel, grpc.Channel):
213
+ # Ignore credentials if a channel was passed.
214
+ credentials = None
215
+ self._ignore_credentials = True
216
+ # If a channel was explicitly provided, set it.
217
+ self._grpc_channel = channel
218
+ self._ssl_channel_credentials = None
219
+
220
+ else:
221
+ if api_mtls_endpoint:
222
+ host = api_mtls_endpoint
223
+
224
+ # Create SSL credentials with client_cert_source or application
225
+ # default SSL credentials.
226
+ if client_cert_source:
227
+ cert, key = client_cert_source()
228
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
229
+ certificate_chain=cert, private_key=key
230
+ )
231
+ else:
232
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
233
+
234
+ else:
235
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
236
+ cert, key = client_cert_source_for_mtls()
237
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
238
+ certificate_chain=cert, private_key=key
239
+ )
240
+
241
+ # The base transport sets the host, credentials and scopes
242
+ super().__init__(
243
+ host=host,
244
+ credentials=credentials,
245
+ credentials_file=credentials_file,
246
+ scopes=scopes,
247
+ quota_project_id=quota_project_id,
248
+ client_info=client_info,
249
+ always_use_jwt_access=always_use_jwt_access,
250
+ api_audience=api_audience,
251
+ )
252
+
253
+ if not self._grpc_channel:
254
+ # initialize with the provided callable or the default channel
255
+ channel_init = channel or type(self).create_channel
256
+ self._grpc_channel = channel_init(
257
+ self._host,
258
+ # use the credentials which are saved
259
+ credentials=self._credentials,
260
+ # Set ``credentials_file`` to ``None`` here as
261
+ # the credentials that we saved earlier should be used.
262
+ credentials_file=None,
263
+ scopes=self._scopes,
264
+ ssl_credentials=self._ssl_channel_credentials,
265
+ quota_project_id=quota_project_id,
266
+ options=[
267
+ ("grpc.max_send_message_length", -1),
268
+ ("grpc.max_receive_message_length", -1),
269
+ ],
270
+ )
271
+
272
+ self._interceptor = _LoggingClientInterceptor()
273
+ self._logged_channel = grpc.intercept_channel(
274
+ self._grpc_channel, self._interceptor
275
+ )
276
+
277
+ # Wrap messages. This must be done after self._logged_channel exists
278
+ self._prep_wrapped_messages(client_info)
279
+
280
+ @classmethod
281
+ def create_channel(
282
+ cls,
283
+ host: str = "aiplatform.googleapis.com",
284
+ credentials: Optional[ga_credentials.Credentials] = None,
285
+ credentials_file: Optional[str] = None,
286
+ scopes: Optional[Sequence[str]] = None,
287
+ quota_project_id: Optional[str] = None,
288
+ **kwargs,
289
+ ) -> grpc.Channel:
290
+ """Create and return a gRPC channel object.
291
+ Args:
292
+ host (Optional[str]): The host for the channel to use.
293
+ credentials (Optional[~.Credentials]): The
294
+ authorization credentials to attach to requests. These
295
+ credentials identify this application to the service. If
296
+ none are specified, the client will attempt to ascertain
297
+ the credentials from the environment.
298
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
299
+ be loaded with :func:`google.auth.load_credentials_from_file`.
300
+ This argument is mutually exclusive with credentials. This argument will be
301
+ removed in the next major version of this library.
302
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
303
+ service. These are only used when credentials are not specified and
304
+ are passed to :func:`google.auth.default`.
305
+ quota_project_id (Optional[str]): An optional project to use for billing
306
+ and quota.
307
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
308
+ channel creation.
309
+ Returns:
310
+ grpc.Channel: A gRPC channel object.
311
+
312
+ Raises:
313
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
314
+ and ``credentials_file`` are passed.
315
+ """
316
+
317
+ return grpc_helpers.create_channel(
318
+ host,
319
+ credentials=credentials,
320
+ credentials_file=credentials_file,
321
+ quota_project_id=quota_project_id,
322
+ default_scopes=cls.AUTH_SCOPES,
323
+ scopes=scopes,
324
+ default_host=cls.DEFAULT_HOST,
325
+ **kwargs,
326
+ )
327
+
328
+ @property
329
+ def grpc_channel(self) -> grpc.Channel:
330
+ """Return the channel designed to connect to this service."""
331
+ return self._grpc_channel
332
+
333
+ @property
334
+ def operations_client(self) -> operations_v1.OperationsClient:
335
+ """Create the client designed to process long-running operations.
336
+
337
+ This property caches on the instance; repeated calls return the same
338
+ client.
339
+ """
340
+ # Quick check: Only create a new client if we do not already have one.
341
+ if self._operations_client is None:
342
+ self._operations_client = operations_v1.OperationsClient(
343
+ self._logged_channel
344
+ )
345
+
346
+ # Return the client from cache.
347
+ return self._operations_client
348
+
349
+ @property
350
+ def create_index(
351
+ self,
352
+ ) -> Callable[[index_service.CreateIndexRequest], operations_pb2.Operation]:
353
+ r"""Return a callable for the create index method over gRPC.
354
+
355
+ Creates an Index.
356
+
357
+ Returns:
358
+ Callable[[~.CreateIndexRequest],
359
+ ~.Operation]:
360
+ A function that, when called, will call the underlying RPC
361
+ on the server.
362
+ """
363
+ # Generate a "stub function" on-the-fly which will actually make
364
+ # the request.
365
+ # gRPC handles serialization and deserialization, so we just need
366
+ # to pass in the functions for each.
367
+ if "create_index" not in self._stubs:
368
+ self._stubs["create_index"] = self._logged_channel.unary_unary(
369
+ "/google.cloud.aiplatform.v1beta1.IndexService/CreateIndex",
370
+ request_serializer=index_service.CreateIndexRequest.serialize,
371
+ response_deserializer=operations_pb2.Operation.FromString,
372
+ )
373
+ return self._stubs["create_index"]
374
+
375
+ @property
376
+ def get_index(self) -> Callable[[index_service.GetIndexRequest], index.Index]:
377
+ r"""Return a callable for the get index method over gRPC.
378
+
379
+ Gets an Index.
380
+
381
+ Returns:
382
+ Callable[[~.GetIndexRequest],
383
+ ~.Index]:
384
+ A function that, when called, will call the underlying RPC
385
+ on the server.
386
+ """
387
+ # Generate a "stub function" on-the-fly which will actually make
388
+ # the request.
389
+ # gRPC handles serialization and deserialization, so we just need
390
+ # to pass in the functions for each.
391
+ if "get_index" not in self._stubs:
392
+ self._stubs["get_index"] = self._logged_channel.unary_unary(
393
+ "/google.cloud.aiplatform.v1beta1.IndexService/GetIndex",
394
+ request_serializer=index_service.GetIndexRequest.serialize,
395
+ response_deserializer=index.Index.deserialize,
396
+ )
397
+ return self._stubs["get_index"]
398
+
399
+ @property
400
+ def import_index(
401
+ self,
402
+ ) -> Callable[[index_service.ImportIndexRequest], operations_pb2.Operation]:
403
+ r"""Return a callable for the import index method over gRPC.
404
+
405
+ Imports an Index from an external source (e.g.,
406
+ BigQuery).
407
+
408
+ Returns:
409
+ Callable[[~.ImportIndexRequest],
410
+ ~.Operation]:
411
+ A function that, when called, will call the underlying RPC
412
+ on the server.
413
+ """
414
+ # Generate a "stub function" on-the-fly which will actually make
415
+ # the request.
416
+ # gRPC handles serialization and deserialization, so we just need
417
+ # to pass in the functions for each.
418
+ if "import_index" not in self._stubs:
419
+ self._stubs["import_index"] = self._logged_channel.unary_unary(
420
+ "/google.cloud.aiplatform.v1beta1.IndexService/ImportIndex",
421
+ request_serializer=index_service.ImportIndexRequest.serialize,
422
+ response_deserializer=operations_pb2.Operation.FromString,
423
+ )
424
+ return self._stubs["import_index"]
425
+
426
+ @property
427
+ def list_indexes(
428
+ self,
429
+ ) -> Callable[
430
+ [index_service.ListIndexesRequest], index_service.ListIndexesResponse
431
+ ]:
432
+ r"""Return a callable for the list indexes method over gRPC.
433
+
434
+ Lists Indexes in a Location.
435
+
436
+ Returns:
437
+ Callable[[~.ListIndexesRequest],
438
+ ~.ListIndexesResponse]:
439
+ A function that, when called, will call the underlying RPC
440
+ on the server.
441
+ """
442
+ # Generate a "stub function" on-the-fly which will actually make
443
+ # the request.
444
+ # gRPC handles serialization and deserialization, so we just need
445
+ # to pass in the functions for each.
446
+ if "list_indexes" not in self._stubs:
447
+ self._stubs["list_indexes"] = self._logged_channel.unary_unary(
448
+ "/google.cloud.aiplatform.v1beta1.IndexService/ListIndexes",
449
+ request_serializer=index_service.ListIndexesRequest.serialize,
450
+ response_deserializer=index_service.ListIndexesResponse.deserialize,
451
+ )
452
+ return self._stubs["list_indexes"]
453
+
454
+ @property
455
+ def update_index(
456
+ self,
457
+ ) -> Callable[[index_service.UpdateIndexRequest], operations_pb2.Operation]:
458
+ r"""Return a callable for the update index method over gRPC.
459
+
460
+ Updates an Index.
461
+
462
+ Returns:
463
+ Callable[[~.UpdateIndexRequest],
464
+ ~.Operation]:
465
+ A function that, when called, will call the underlying RPC
466
+ on the server.
467
+ """
468
+ # Generate a "stub function" on-the-fly which will actually make
469
+ # the request.
470
+ # gRPC handles serialization and deserialization, so we just need
471
+ # to pass in the functions for each.
472
+ if "update_index" not in self._stubs:
473
+ self._stubs["update_index"] = self._logged_channel.unary_unary(
474
+ "/google.cloud.aiplatform.v1beta1.IndexService/UpdateIndex",
475
+ request_serializer=index_service.UpdateIndexRequest.serialize,
476
+ response_deserializer=operations_pb2.Operation.FromString,
477
+ )
478
+ return self._stubs["update_index"]
479
+
480
+ @property
481
+ def delete_index(
482
+ self,
483
+ ) -> Callable[[index_service.DeleteIndexRequest], operations_pb2.Operation]:
484
+ r"""Return a callable for the delete index method over gRPC.
485
+
486
+ Deletes an Index. An Index can only be deleted when all its
487
+ [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes]
488
+ had been undeployed.
489
+
490
+ Returns:
491
+ Callable[[~.DeleteIndexRequest],
492
+ ~.Operation]:
493
+ A function that, when called, will call the underlying RPC
494
+ on the server.
495
+ """
496
+ # Generate a "stub function" on-the-fly which will actually make
497
+ # the request.
498
+ # gRPC handles serialization and deserialization, so we just need
499
+ # to pass in the functions for each.
500
+ if "delete_index" not in self._stubs:
501
+ self._stubs["delete_index"] = self._logged_channel.unary_unary(
502
+ "/google.cloud.aiplatform.v1beta1.IndexService/DeleteIndex",
503
+ request_serializer=index_service.DeleteIndexRequest.serialize,
504
+ response_deserializer=operations_pb2.Operation.FromString,
505
+ )
506
+ return self._stubs["delete_index"]
507
+
508
+ @property
509
+ def upsert_datapoints(
510
+ self,
511
+ ) -> Callable[
512
+ [index_service.UpsertDatapointsRequest], index_service.UpsertDatapointsResponse
513
+ ]:
514
+ r"""Return a callable for the upsert datapoints method over gRPC.
515
+
516
+ Add/update Datapoints into an Index.
517
+
518
+ Returns:
519
+ Callable[[~.UpsertDatapointsRequest],
520
+ ~.UpsertDatapointsResponse]:
521
+ A function that, when called, will call the underlying RPC
522
+ on the server.
523
+ """
524
+ # Generate a "stub function" on-the-fly which will actually make
525
+ # the request.
526
+ # gRPC handles serialization and deserialization, so we just need
527
+ # to pass in the functions for each.
528
+ if "upsert_datapoints" not in self._stubs:
529
+ self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary(
530
+ "/google.cloud.aiplatform.v1beta1.IndexService/UpsertDatapoints",
531
+ request_serializer=index_service.UpsertDatapointsRequest.serialize,
532
+ response_deserializer=index_service.UpsertDatapointsResponse.deserialize,
533
+ )
534
+ return self._stubs["upsert_datapoints"]
535
+
536
+ @property
537
+ def remove_datapoints(
538
+ self,
539
+ ) -> Callable[
540
+ [index_service.RemoveDatapointsRequest], index_service.RemoveDatapointsResponse
541
+ ]:
542
+ r"""Return a callable for the remove datapoints method over gRPC.
543
+
544
+ Remove Datapoints from an Index.
545
+
546
+ Returns:
547
+ Callable[[~.RemoveDatapointsRequest],
548
+ ~.RemoveDatapointsResponse]:
549
+ A function that, when called, will call the underlying RPC
550
+ on the server.
551
+ """
552
+ # Generate a "stub function" on-the-fly which will actually make
553
+ # the request.
554
+ # gRPC handles serialization and deserialization, so we just need
555
+ # to pass in the functions for each.
556
+ if "remove_datapoints" not in self._stubs:
557
+ self._stubs["remove_datapoints"] = self._logged_channel.unary_unary(
558
+ "/google.cloud.aiplatform.v1beta1.IndexService/RemoveDatapoints",
559
+ request_serializer=index_service.RemoveDatapointsRequest.serialize,
560
+ response_deserializer=index_service.RemoveDatapointsResponse.deserialize,
561
+ )
562
+ return self._stubs["remove_datapoints"]
563
+
564
+ def close(self):
565
+ self._logged_channel.close()
566
+
567
+ @property
568
+ def delete_operation(
569
+ self,
570
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
571
+ r"""Return a callable for the delete_operation method over gRPC."""
572
+ # Generate a "stub function" on-the-fly which will actually make
573
+ # the request.
574
+ # gRPC handles serialization and deserialization, so we just need
575
+ # to pass in the functions for each.
576
+ if "delete_operation" not in self._stubs:
577
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
578
+ "/google.longrunning.Operations/DeleteOperation",
579
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
580
+ response_deserializer=None,
581
+ )
582
+ return self._stubs["delete_operation"]
583
+
584
+ @property
585
+ def cancel_operation(
586
+ self,
587
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
588
+ r"""Return a callable for the cancel_operation method over gRPC."""
589
+ # Generate a "stub function" on-the-fly which will actually make
590
+ # the request.
591
+ # gRPC handles serialization and deserialization, so we just need
592
+ # to pass in the functions for each.
593
+ if "cancel_operation" not in self._stubs:
594
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
595
+ "/google.longrunning.Operations/CancelOperation",
596
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
597
+ response_deserializer=None,
598
+ )
599
+ return self._stubs["cancel_operation"]
600
+
601
+ @property
602
+ def wait_operation(
603
+ self,
604
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
605
+ r"""Return a callable for the wait_operation method over gRPC."""
606
+ # Generate a "stub function" on-the-fly which will actually make
607
+ # the request.
608
+ # gRPC handles serialization and deserialization, so we just need
609
+ # to pass in the functions for each.
610
+ if "wait_operation" not in self._stubs:
611
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
612
+ "/google.longrunning.Operations/WaitOperation",
613
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
614
+ response_deserializer=None,
615
+ )
616
+ return self._stubs["wait_operation"]
617
+
618
+ @property
619
+ def get_operation(
620
+ self,
621
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
622
+ r"""Return a callable for the get_operation method over gRPC."""
623
+ # Generate a "stub function" on-the-fly which will actually make
624
+ # the request.
625
+ # gRPC handles serialization and deserialization, so we just need
626
+ # to pass in the functions for each.
627
+ if "get_operation" not in self._stubs:
628
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
629
+ "/google.longrunning.Operations/GetOperation",
630
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
631
+ response_deserializer=operations_pb2.Operation.FromString,
632
+ )
633
+ return self._stubs["get_operation"]
634
+
635
+ @property
636
+ def list_operations(
637
+ self,
638
+ ) -> Callable[
639
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
640
+ ]:
641
+ r"""Return a callable for the list_operations method over gRPC."""
642
+ # Generate a "stub function" on-the-fly which will actually make
643
+ # the request.
644
+ # gRPC handles serialization and deserialization, so we just need
645
+ # to pass in the functions for each.
646
+ if "list_operations" not in self._stubs:
647
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
648
+ "/google.longrunning.Operations/ListOperations",
649
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
650
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
651
+ )
652
+ return self._stubs["list_operations"]
653
+
654
+ @property
655
+ def list_locations(
656
+ self,
657
+ ) -> Callable[
658
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
659
+ ]:
660
+ r"""Return a callable for the list locations method over gRPC."""
661
+ # Generate a "stub function" on-the-fly which will actually make
662
+ # the request.
663
+ # gRPC handles serialization and deserialization, so we just need
664
+ # to pass in the functions for each.
665
+ if "list_locations" not in self._stubs:
666
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
667
+ "/google.cloud.location.Locations/ListLocations",
668
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
669
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
670
+ )
671
+ return self._stubs["list_locations"]
672
+
673
+ @property
674
+ def get_location(
675
+ self,
676
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
677
+ r"""Return a callable for the list locations method over gRPC."""
678
+ # Generate a "stub function" on-the-fly which will actually make
679
+ # the request.
680
+ # gRPC handles serialization and deserialization, so we just need
681
+ # to pass in the functions for each.
682
+ if "get_location" not in self._stubs:
683
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
684
+ "/google.cloud.location.Locations/GetLocation",
685
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
686
+ response_deserializer=locations_pb2.Location.FromString,
687
+ )
688
+ return self._stubs["get_location"]
689
+
690
+ @property
691
+ def set_iam_policy(
692
+ self,
693
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
694
+ r"""Return a callable for the set iam policy method over gRPC.
695
+ Sets the IAM access control policy on the specified
696
+ function. Replaces any existing policy.
697
+ Returns:
698
+ Callable[[~.SetIamPolicyRequest],
699
+ ~.Policy]:
700
+ A function that, when called, will call the underlying RPC
701
+ on the server.
702
+ """
703
+ # Generate a "stub function" on-the-fly which will actually make
704
+ # the request.
705
+ # gRPC handles serialization and deserialization, so we just need
706
+ # to pass in the functions for each.
707
+ if "set_iam_policy" not in self._stubs:
708
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
709
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
710
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
711
+ response_deserializer=policy_pb2.Policy.FromString,
712
+ )
713
+ return self._stubs["set_iam_policy"]
714
+
715
+ @property
716
+ def get_iam_policy(
717
+ self,
718
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
719
+ r"""Return a callable for the get iam policy method over gRPC.
720
+ Gets the IAM access control policy for a function.
721
+ Returns an empty policy if the function exists and does
722
+ not have a policy set.
723
+ Returns:
724
+ Callable[[~.GetIamPolicyRequest],
725
+ ~.Policy]:
726
+ A function that, when called, will call the underlying RPC
727
+ on the server.
728
+ """
729
+ # Generate a "stub function" on-the-fly which will actually make
730
+ # the request.
731
+ # gRPC handles serialization and deserialization, so we just need
732
+ # to pass in the functions for each.
733
+ if "get_iam_policy" not in self._stubs:
734
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
735
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
736
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
737
+ response_deserializer=policy_pb2.Policy.FromString,
738
+ )
739
+ return self._stubs["get_iam_policy"]
740
+
741
+ @property
742
+ def test_iam_permissions(
743
+ self,
744
+ ) -> Callable[
745
+ [iam_policy_pb2.TestIamPermissionsRequest],
746
+ iam_policy_pb2.TestIamPermissionsResponse,
747
+ ]:
748
+ r"""Return a callable for the test iam permissions method over gRPC.
749
+ Tests the specified permissions against the IAM access control
750
+ policy for a function. If the function does not exist, this will
751
+ return an empty set of permissions, not a NOT_FOUND error.
752
+ Returns:
753
+ Callable[[~.TestIamPermissionsRequest],
754
+ ~.TestIamPermissionsResponse]:
755
+ A function that, when called, will call the underlying RPC
756
+ on the server.
757
+ """
758
+ # Generate a "stub function" on-the-fly which will actually make
759
+ # the request.
760
+ # gRPC handles serialization and deserialization, so we just need
761
+ # to pass in the functions for each.
762
+ if "test_iam_permissions" not in self._stubs:
763
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
764
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
765
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
766
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
767
+ )
768
+ return self._stubs["test_iam_permissions"]
769
+
770
+ @property
771
+ def kind(self) -> str:
772
+ return "grpc"
773
+
774
+
775
+ __all__ = ("IndexServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,895 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import pickle
19
+ import logging as std_logging
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import grpc_helpers_async
25
+ from google.api_core import exceptions as core_exceptions
26
+ from google.api_core import retry_async as retries
27
+ from google.api_core import operations_v1
28
+ from google.auth import credentials as ga_credentials # type: ignore
29
+ from google.auth.transport.grpc import SslCredentials # type: ignore
30
+ from google.protobuf.json_format import MessageToJson
31
+ import google.protobuf.message
32
+
33
+ import grpc # type: ignore
34
+ import proto # type: ignore
35
+ from grpc.experimental import aio # type: ignore
36
+
37
+ from google.cloud.aiplatform_v1beta1.types import index
38
+ from google.cloud.aiplatform_v1beta1.types import index_service
39
+ from google.cloud.location import locations_pb2 # type: ignore
40
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
41
+ from google.iam.v1 import policy_pb2 # type: ignore
42
+ from google.longrunning import operations_pb2 # type: ignore
43
+ from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO
44
+ from .grpc import IndexServiceGrpcTransport
45
+
46
+ try:
47
+ from google.api_core import client_logging # type: ignore
48
+
49
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
50
+ except ImportError: # pragma: NO COVER
51
+ CLIENT_LOGGING_SUPPORTED = False
52
+
53
+ _LOGGER = std_logging.getLogger(__name__)
54
+
55
+
56
+ class _LoggingClientAIOInterceptor(
57
+ grpc.aio.UnaryUnaryClientInterceptor
58
+ ): # pragma: NO COVER
59
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
60
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
61
+ std_logging.DEBUG
62
+ )
63
+ if logging_enabled: # pragma: NO COVER
64
+ request_metadata = client_call_details.metadata
65
+ if isinstance(request, proto.Message):
66
+ request_payload = type(request).to_json(request)
67
+ elif isinstance(request, google.protobuf.message.Message):
68
+ request_payload = MessageToJson(request)
69
+ else:
70
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
71
+
72
+ request_metadata = {
73
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
74
+ for key, value in request_metadata
75
+ }
76
+ grpc_request = {
77
+ "payload": request_payload,
78
+ "requestMethod": "grpc",
79
+ "metadata": dict(request_metadata),
80
+ }
81
+ _LOGGER.debug(
82
+ f"Sending request for {client_call_details.method}",
83
+ extra={
84
+ "serviceName": "google.cloud.aiplatform.v1beta1.IndexService",
85
+ "rpcName": str(client_call_details.method),
86
+ "request": grpc_request,
87
+ "metadata": grpc_request["metadata"],
88
+ },
89
+ )
90
+ response = await continuation(client_call_details, request)
91
+ if logging_enabled: # pragma: NO COVER
92
+ response_metadata = await response.trailing_metadata()
93
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
94
+ metadata = (
95
+ dict([(k, str(v)) for k, v in response_metadata])
96
+ if response_metadata
97
+ else None
98
+ )
99
+ result = await response
100
+ if isinstance(result, proto.Message):
101
+ response_payload = type(result).to_json(result)
102
+ elif isinstance(result, google.protobuf.message.Message):
103
+ response_payload = MessageToJson(result)
104
+ else:
105
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
106
+ grpc_response = {
107
+ "payload": response_payload,
108
+ "metadata": metadata,
109
+ "status": "OK",
110
+ }
111
+ _LOGGER.debug(
112
+ f"Received response to rpc {client_call_details.method}.",
113
+ extra={
114
+ "serviceName": "google.cloud.aiplatform.v1beta1.IndexService",
115
+ "rpcName": str(client_call_details.method),
116
+ "response": grpc_response,
117
+ "metadata": grpc_response["metadata"],
118
+ },
119
+ )
120
+ return response
121
+
122
+
123
+ class IndexServiceGrpcAsyncIOTransport(IndexServiceTransport):
124
+ """gRPC AsyncIO backend transport for IndexService.
125
+
126
+ A service for creating and managing Vertex AI's Index
127
+ resources.
128
+
129
+ This class defines the same methods as the primary client, so the
130
+ primary client can load the underlying transport implementation
131
+ and call it.
132
+
133
+ It sends protocol buffers over the wire using gRPC (which is built on
134
+ top of HTTP/2); the ``grpcio`` package must be installed.
135
+ """
136
+
137
+ _grpc_channel: aio.Channel
138
+ _stubs: Dict[str, Callable] = {}
139
+
140
+ @classmethod
141
+ def create_channel(
142
+ cls,
143
+ host: str = "aiplatform.googleapis.com",
144
+ credentials: Optional[ga_credentials.Credentials] = None,
145
+ credentials_file: Optional[str] = None,
146
+ scopes: Optional[Sequence[str]] = None,
147
+ quota_project_id: Optional[str] = None,
148
+ **kwargs,
149
+ ) -> aio.Channel:
150
+ """Create and return a gRPC AsyncIO channel object.
151
+ Args:
152
+ host (Optional[str]): The host for the channel to use.
153
+ credentials (Optional[~.Credentials]): The
154
+ authorization credentials to attach to requests. These
155
+ credentials identify this application to the service. If
156
+ none are specified, the client will attempt to ascertain
157
+ the credentials from the environment.
158
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
159
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
160
+ removed in the next major version of this library.
161
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
162
+ service. These are only used when credentials are not specified and
163
+ are passed to :func:`google.auth.default`.
164
+ quota_project_id (Optional[str]): An optional project to use for billing
165
+ and quota.
166
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
167
+ channel creation.
168
+ Returns:
169
+ aio.Channel: A gRPC AsyncIO channel object.
170
+ """
171
+
172
+ return grpc_helpers_async.create_channel(
173
+ host,
174
+ credentials=credentials,
175
+ credentials_file=credentials_file,
176
+ quota_project_id=quota_project_id,
177
+ default_scopes=cls.AUTH_SCOPES,
178
+ scopes=scopes,
179
+ default_host=cls.DEFAULT_HOST,
180
+ **kwargs,
181
+ )
182
+
183
+ def __init__(
184
+ self,
185
+ *,
186
+ host: str = "aiplatform.googleapis.com",
187
+ credentials: Optional[ga_credentials.Credentials] = None,
188
+ credentials_file: Optional[str] = None,
189
+ scopes: Optional[Sequence[str]] = None,
190
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
191
+ api_mtls_endpoint: Optional[str] = None,
192
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
193
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
194
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
195
+ quota_project_id: Optional[str] = None,
196
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
197
+ always_use_jwt_access: Optional[bool] = False,
198
+ api_audience: Optional[str] = None,
199
+ ) -> None:
200
+ """Instantiate the transport.
201
+
202
+ Args:
203
+ host (Optional[str]):
204
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
205
+ credentials (Optional[google.auth.credentials.Credentials]): The
206
+ authorization credentials to attach to requests. These
207
+ credentials identify the application to the service; if none
208
+ are specified, the client will attempt to ascertain the
209
+ credentials from the environment.
210
+ This argument is ignored if a ``channel`` instance is provided.
211
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
212
+ be loaded with :func:`google.auth.load_credentials_from_file`.
213
+ This argument is ignored if a ``channel`` instance is provided.
214
+ This argument will be removed in the next major version of this library.
215
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
216
+ service. These are only used when credentials are not specified and
217
+ are passed to :func:`google.auth.default`.
218
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
219
+ A ``Channel`` instance through which to make calls, or a Callable
220
+ that constructs and returns one. If set to None, ``self.create_channel``
221
+ is used to create the channel. If a Callable is given, it will be called
222
+ with the same arguments as used in ``self.create_channel``.
223
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
224
+ If provided, it overrides the ``host`` argument and tries to create
225
+ a mutual TLS channel with client SSL credentials from
226
+ ``client_cert_source`` or application default SSL credentials.
227
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
228
+ Deprecated. A callback to provide client SSL certificate bytes and
229
+ private key bytes, both in PEM format. It is ignored if
230
+ ``api_mtls_endpoint`` is None.
231
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
232
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
233
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
234
+ A callback to provide client certificate bytes and private key bytes,
235
+ both in PEM format. It is used to configure a mutual TLS channel. It is
236
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
237
+ quota_project_id (Optional[str]): An optional project to use for billing
238
+ and quota.
239
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
240
+ The client info used to send a user-agent string along with
241
+ API requests. If ``None``, then default info will be used.
242
+ Generally, you only need to set this if you're developing
243
+ your own client library.
244
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
245
+ be used for service account credentials.
246
+
247
+ Raises:
248
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
249
+ creation failed for any reason.
250
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
251
+ and ``credentials_file`` are passed.
252
+ """
253
+ self._grpc_channel = None
254
+ self._ssl_channel_credentials = ssl_channel_credentials
255
+ self._stubs: Dict[str, Callable] = {}
256
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
257
+
258
+ if api_mtls_endpoint:
259
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
260
+ if client_cert_source:
261
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
262
+
263
+ if isinstance(channel, aio.Channel):
264
+ # Ignore credentials if a channel was passed.
265
+ credentials = None
266
+ self._ignore_credentials = True
267
+ # If a channel was explicitly provided, set it.
268
+ self._grpc_channel = channel
269
+ self._ssl_channel_credentials = None
270
+ else:
271
+ if api_mtls_endpoint:
272
+ host = api_mtls_endpoint
273
+
274
+ # Create SSL credentials with client_cert_source or application
275
+ # default SSL credentials.
276
+ if client_cert_source:
277
+ cert, key = client_cert_source()
278
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
279
+ certificate_chain=cert, private_key=key
280
+ )
281
+ else:
282
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
283
+
284
+ else:
285
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
286
+ cert, key = client_cert_source_for_mtls()
287
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
288
+ certificate_chain=cert, private_key=key
289
+ )
290
+
291
+ # The base transport sets the host, credentials and scopes
292
+ super().__init__(
293
+ host=host,
294
+ credentials=credentials,
295
+ credentials_file=credentials_file,
296
+ scopes=scopes,
297
+ quota_project_id=quota_project_id,
298
+ client_info=client_info,
299
+ always_use_jwt_access=always_use_jwt_access,
300
+ api_audience=api_audience,
301
+ )
302
+
303
+ if not self._grpc_channel:
304
+ # initialize with the provided callable or the default channel
305
+ channel_init = channel or type(self).create_channel
306
+ self._grpc_channel = channel_init(
307
+ self._host,
308
+ # use the credentials which are saved
309
+ credentials=self._credentials,
310
+ # Set ``credentials_file`` to ``None`` here as
311
+ # the credentials that we saved earlier should be used.
312
+ credentials_file=None,
313
+ scopes=self._scopes,
314
+ ssl_credentials=self._ssl_channel_credentials,
315
+ quota_project_id=quota_project_id,
316
+ options=[
317
+ ("grpc.max_send_message_length", -1),
318
+ ("grpc.max_receive_message_length", -1),
319
+ ],
320
+ )
321
+
322
+ self._interceptor = _LoggingClientAIOInterceptor()
323
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
324
+ self._logged_channel = self._grpc_channel
325
+ self._wrap_with_kind = (
326
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
327
+ )
328
+ # Wrap messages. This must be done after self._logged_channel exists
329
+ self._prep_wrapped_messages(client_info)
330
+
331
+ @property
332
+ def grpc_channel(self) -> aio.Channel:
333
+ """Create the channel designed to connect to this service.
334
+
335
+ This property caches on the instance; repeated calls return
336
+ the same channel.
337
+ """
338
+ # Return the channel from cache.
339
+ return self._grpc_channel
340
+
341
+ @property
342
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
343
+ """Create the client designed to process long-running operations.
344
+
345
+ This property caches on the instance; repeated calls return the same
346
+ client.
347
+ """
348
+ # Quick check: Only create a new client if we do not already have one.
349
+ if self._operations_client is None:
350
+ self._operations_client = operations_v1.OperationsAsyncClient(
351
+ self._logged_channel
352
+ )
353
+
354
+ # Return the client from cache.
355
+ return self._operations_client
356
+
357
+ @property
358
+ def create_index(
359
+ self,
360
+ ) -> Callable[
361
+ [index_service.CreateIndexRequest], Awaitable[operations_pb2.Operation]
362
+ ]:
363
+ r"""Return a callable for the create index method over gRPC.
364
+
365
+ Creates an Index.
366
+
367
+ Returns:
368
+ Callable[[~.CreateIndexRequest],
369
+ Awaitable[~.Operation]]:
370
+ A function that, when called, will call the underlying RPC
371
+ on the server.
372
+ """
373
+ # Generate a "stub function" on-the-fly which will actually make
374
+ # the request.
375
+ # gRPC handles serialization and deserialization, so we just need
376
+ # to pass in the functions for each.
377
+ if "create_index" not in self._stubs:
378
+ self._stubs["create_index"] = self._logged_channel.unary_unary(
379
+ "/google.cloud.aiplatform.v1beta1.IndexService/CreateIndex",
380
+ request_serializer=index_service.CreateIndexRequest.serialize,
381
+ response_deserializer=operations_pb2.Operation.FromString,
382
+ )
383
+ return self._stubs["create_index"]
384
+
385
+ @property
386
+ def get_index(
387
+ self,
388
+ ) -> Callable[[index_service.GetIndexRequest], Awaitable[index.Index]]:
389
+ r"""Return a callable for the get index method over gRPC.
390
+
391
+ Gets an Index.
392
+
393
+ Returns:
394
+ Callable[[~.GetIndexRequest],
395
+ Awaitable[~.Index]]:
396
+ A function that, when called, will call the underlying RPC
397
+ on the server.
398
+ """
399
+ # Generate a "stub function" on-the-fly which will actually make
400
+ # the request.
401
+ # gRPC handles serialization and deserialization, so we just need
402
+ # to pass in the functions for each.
403
+ if "get_index" not in self._stubs:
404
+ self._stubs["get_index"] = self._logged_channel.unary_unary(
405
+ "/google.cloud.aiplatform.v1beta1.IndexService/GetIndex",
406
+ request_serializer=index_service.GetIndexRequest.serialize,
407
+ response_deserializer=index.Index.deserialize,
408
+ )
409
+ return self._stubs["get_index"]
410
+
411
+ @property
412
+ def import_index(
413
+ self,
414
+ ) -> Callable[
415
+ [index_service.ImportIndexRequest], Awaitable[operations_pb2.Operation]
416
+ ]:
417
+ r"""Return a callable for the import index method over gRPC.
418
+
419
+ Imports an Index from an external source (e.g.,
420
+ BigQuery).
421
+
422
+ Returns:
423
+ Callable[[~.ImportIndexRequest],
424
+ Awaitable[~.Operation]]:
425
+ A function that, when called, will call the underlying RPC
426
+ on the server.
427
+ """
428
+ # Generate a "stub function" on-the-fly which will actually make
429
+ # the request.
430
+ # gRPC handles serialization and deserialization, so we just need
431
+ # to pass in the functions for each.
432
+ if "import_index" not in self._stubs:
433
+ self._stubs["import_index"] = self._logged_channel.unary_unary(
434
+ "/google.cloud.aiplatform.v1beta1.IndexService/ImportIndex",
435
+ request_serializer=index_service.ImportIndexRequest.serialize,
436
+ response_deserializer=operations_pb2.Operation.FromString,
437
+ )
438
+ return self._stubs["import_index"]
439
+
440
+ @property
441
+ def list_indexes(
442
+ self,
443
+ ) -> Callable[
444
+ [index_service.ListIndexesRequest], Awaitable[index_service.ListIndexesResponse]
445
+ ]:
446
+ r"""Return a callable for the list indexes method over gRPC.
447
+
448
+ Lists Indexes in a Location.
449
+
450
+ Returns:
451
+ Callable[[~.ListIndexesRequest],
452
+ Awaitable[~.ListIndexesResponse]]:
453
+ A function that, when called, will call the underlying RPC
454
+ on the server.
455
+ """
456
+ # Generate a "stub function" on-the-fly which will actually make
457
+ # the request.
458
+ # gRPC handles serialization and deserialization, so we just need
459
+ # to pass in the functions for each.
460
+ if "list_indexes" not in self._stubs:
461
+ self._stubs["list_indexes"] = self._logged_channel.unary_unary(
462
+ "/google.cloud.aiplatform.v1beta1.IndexService/ListIndexes",
463
+ request_serializer=index_service.ListIndexesRequest.serialize,
464
+ response_deserializer=index_service.ListIndexesResponse.deserialize,
465
+ )
466
+ return self._stubs["list_indexes"]
467
+
468
+ @property
469
+ def update_index(
470
+ self,
471
+ ) -> Callable[
472
+ [index_service.UpdateIndexRequest], Awaitable[operations_pb2.Operation]
473
+ ]:
474
+ r"""Return a callable for the update index method over gRPC.
475
+
476
+ Updates an Index.
477
+
478
+ Returns:
479
+ Callable[[~.UpdateIndexRequest],
480
+ Awaitable[~.Operation]]:
481
+ A function that, when called, will call the underlying RPC
482
+ on the server.
483
+ """
484
+ # Generate a "stub function" on-the-fly which will actually make
485
+ # the request.
486
+ # gRPC handles serialization and deserialization, so we just need
487
+ # to pass in the functions for each.
488
+ if "update_index" not in self._stubs:
489
+ self._stubs["update_index"] = self._logged_channel.unary_unary(
490
+ "/google.cloud.aiplatform.v1beta1.IndexService/UpdateIndex",
491
+ request_serializer=index_service.UpdateIndexRequest.serialize,
492
+ response_deserializer=operations_pb2.Operation.FromString,
493
+ )
494
+ return self._stubs["update_index"]
495
+
496
+ @property
497
+ def delete_index(
498
+ self,
499
+ ) -> Callable[
500
+ [index_service.DeleteIndexRequest], Awaitable[operations_pb2.Operation]
501
+ ]:
502
+ r"""Return a callable for the delete index method over gRPC.
503
+
504
+ Deletes an Index. An Index can only be deleted when all its
505
+ [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes]
506
+ had been undeployed.
507
+
508
+ Returns:
509
+ Callable[[~.DeleteIndexRequest],
510
+ Awaitable[~.Operation]]:
511
+ A function that, when called, will call the underlying RPC
512
+ on the server.
513
+ """
514
+ # Generate a "stub function" on-the-fly which will actually make
515
+ # the request.
516
+ # gRPC handles serialization and deserialization, so we just need
517
+ # to pass in the functions for each.
518
+ if "delete_index" not in self._stubs:
519
+ self._stubs["delete_index"] = self._logged_channel.unary_unary(
520
+ "/google.cloud.aiplatform.v1beta1.IndexService/DeleteIndex",
521
+ request_serializer=index_service.DeleteIndexRequest.serialize,
522
+ response_deserializer=operations_pb2.Operation.FromString,
523
+ )
524
+ return self._stubs["delete_index"]
525
+
526
+ @property
527
+ def upsert_datapoints(
528
+ self,
529
+ ) -> Callable[
530
+ [index_service.UpsertDatapointsRequest],
531
+ Awaitable[index_service.UpsertDatapointsResponse],
532
+ ]:
533
+ r"""Return a callable for the upsert datapoints method over gRPC.
534
+
535
+ Add/update Datapoints into an Index.
536
+
537
+ Returns:
538
+ Callable[[~.UpsertDatapointsRequest],
539
+ Awaitable[~.UpsertDatapointsResponse]]:
540
+ A function that, when called, will call the underlying RPC
541
+ on the server.
542
+ """
543
+ # Generate a "stub function" on-the-fly which will actually make
544
+ # the request.
545
+ # gRPC handles serialization and deserialization, so we just need
546
+ # to pass in the functions for each.
547
+ if "upsert_datapoints" not in self._stubs:
548
+ self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary(
549
+ "/google.cloud.aiplatform.v1beta1.IndexService/UpsertDatapoints",
550
+ request_serializer=index_service.UpsertDatapointsRequest.serialize,
551
+ response_deserializer=index_service.UpsertDatapointsResponse.deserialize,
552
+ )
553
+ return self._stubs["upsert_datapoints"]
554
+
555
+ @property
556
+ def remove_datapoints(
557
+ self,
558
+ ) -> Callable[
559
+ [index_service.RemoveDatapointsRequest],
560
+ Awaitable[index_service.RemoveDatapointsResponse],
561
+ ]:
562
+ r"""Return a callable for the remove datapoints method over gRPC.
563
+
564
+ Remove Datapoints from an Index.
565
+
566
+ Returns:
567
+ Callable[[~.RemoveDatapointsRequest],
568
+ Awaitable[~.RemoveDatapointsResponse]]:
569
+ A function that, when called, will call the underlying RPC
570
+ on the server.
571
+ """
572
+ # Generate a "stub function" on-the-fly which will actually make
573
+ # the request.
574
+ # gRPC handles serialization and deserialization, so we just need
575
+ # to pass in the functions for each.
576
+ if "remove_datapoints" not in self._stubs:
577
+ self._stubs["remove_datapoints"] = self._logged_channel.unary_unary(
578
+ "/google.cloud.aiplatform.v1beta1.IndexService/RemoveDatapoints",
579
+ request_serializer=index_service.RemoveDatapointsRequest.serialize,
580
+ response_deserializer=index_service.RemoveDatapointsResponse.deserialize,
581
+ )
582
+ return self._stubs["remove_datapoints"]
583
+
584
+ def _prep_wrapped_messages(self, client_info):
585
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
586
+ self._wrapped_methods = {
587
+ self.create_index: self._wrap_method(
588
+ self.create_index,
589
+ default_timeout=5.0,
590
+ client_info=client_info,
591
+ ),
592
+ self.get_index: self._wrap_method(
593
+ self.get_index,
594
+ default_timeout=5.0,
595
+ client_info=client_info,
596
+ ),
597
+ self.import_index: self._wrap_method(
598
+ self.import_index,
599
+ default_timeout=None,
600
+ client_info=client_info,
601
+ ),
602
+ self.list_indexes: self._wrap_method(
603
+ self.list_indexes,
604
+ default_timeout=5.0,
605
+ client_info=client_info,
606
+ ),
607
+ self.update_index: self._wrap_method(
608
+ self.update_index,
609
+ default_timeout=5.0,
610
+ client_info=client_info,
611
+ ),
612
+ self.delete_index: self._wrap_method(
613
+ self.delete_index,
614
+ default_timeout=5.0,
615
+ client_info=client_info,
616
+ ),
617
+ self.upsert_datapoints: self._wrap_method(
618
+ self.upsert_datapoints,
619
+ default_timeout=None,
620
+ client_info=client_info,
621
+ ),
622
+ self.remove_datapoints: self._wrap_method(
623
+ self.remove_datapoints,
624
+ default_timeout=None,
625
+ client_info=client_info,
626
+ ),
627
+ self.get_location: self._wrap_method(
628
+ self.get_location,
629
+ default_timeout=None,
630
+ client_info=client_info,
631
+ ),
632
+ self.list_locations: self._wrap_method(
633
+ self.list_locations,
634
+ default_timeout=None,
635
+ client_info=client_info,
636
+ ),
637
+ self.get_iam_policy: self._wrap_method(
638
+ self.get_iam_policy,
639
+ default_timeout=None,
640
+ client_info=client_info,
641
+ ),
642
+ self.set_iam_policy: self._wrap_method(
643
+ self.set_iam_policy,
644
+ default_timeout=None,
645
+ client_info=client_info,
646
+ ),
647
+ self.test_iam_permissions: self._wrap_method(
648
+ self.test_iam_permissions,
649
+ default_timeout=None,
650
+ client_info=client_info,
651
+ ),
652
+ self.cancel_operation: self._wrap_method(
653
+ self.cancel_operation,
654
+ default_timeout=None,
655
+ client_info=client_info,
656
+ ),
657
+ self.delete_operation: self._wrap_method(
658
+ self.delete_operation,
659
+ default_timeout=None,
660
+ client_info=client_info,
661
+ ),
662
+ self.get_operation: self._wrap_method(
663
+ self.get_operation,
664
+ default_timeout=None,
665
+ client_info=client_info,
666
+ ),
667
+ self.list_operations: self._wrap_method(
668
+ self.list_operations,
669
+ default_timeout=None,
670
+ client_info=client_info,
671
+ ),
672
+ self.wait_operation: self._wrap_method(
673
+ self.wait_operation,
674
+ default_timeout=None,
675
+ client_info=client_info,
676
+ ),
677
+ }
678
+
679
+ def _wrap_method(self, func, *args, **kwargs):
680
+ if self._wrap_with_kind: # pragma: NO COVER
681
+ kwargs["kind"] = self.kind
682
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
683
+
684
+ def close(self):
685
+ return self._logged_channel.close()
686
+
687
+ @property
688
+ def kind(self) -> str:
689
+ return "grpc_asyncio"
690
+
691
+ @property
692
+ def delete_operation(
693
+ self,
694
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
695
+ r"""Return a callable for the delete_operation method over gRPC."""
696
+ # Generate a "stub function" on-the-fly which will actually make
697
+ # the request.
698
+ # gRPC handles serialization and deserialization, so we just need
699
+ # to pass in the functions for each.
700
+ if "delete_operation" not in self._stubs:
701
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
702
+ "/google.longrunning.Operations/DeleteOperation",
703
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
704
+ response_deserializer=None,
705
+ )
706
+ return self._stubs["delete_operation"]
707
+
708
+ @property
709
+ def cancel_operation(
710
+ self,
711
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
712
+ r"""Return a callable for the cancel_operation method over gRPC."""
713
+ # Generate a "stub function" on-the-fly which will actually make
714
+ # the request.
715
+ # gRPC handles serialization and deserialization, so we just need
716
+ # to pass in the functions for each.
717
+ if "cancel_operation" not in self._stubs:
718
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
719
+ "/google.longrunning.Operations/CancelOperation",
720
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
721
+ response_deserializer=None,
722
+ )
723
+ return self._stubs["cancel_operation"]
724
+
725
+ @property
726
+ def wait_operation(
727
+ self,
728
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
729
+ r"""Return a callable for the wait_operation method over gRPC."""
730
+ # Generate a "stub function" on-the-fly which will actually make
731
+ # the request.
732
+ # gRPC handles serialization and deserialization, so we just need
733
+ # to pass in the functions for each.
734
+ if "wait_operation" not in self._stubs:
735
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
736
+ "/google.longrunning.Operations/WaitOperation",
737
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
738
+ response_deserializer=None,
739
+ )
740
+ return self._stubs["wait_operation"]
741
+
742
+ @property
743
+ def get_operation(
744
+ self,
745
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
746
+ r"""Return a callable for the get_operation method over gRPC."""
747
+ # Generate a "stub function" on-the-fly which will actually make
748
+ # the request.
749
+ # gRPC handles serialization and deserialization, so we just need
750
+ # to pass in the functions for each.
751
+ if "get_operation" not in self._stubs:
752
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
753
+ "/google.longrunning.Operations/GetOperation",
754
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
755
+ response_deserializer=operations_pb2.Operation.FromString,
756
+ )
757
+ return self._stubs["get_operation"]
758
+
759
+ @property
760
+ def list_operations(
761
+ self,
762
+ ) -> Callable[
763
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
764
+ ]:
765
+ r"""Return a callable for the list_operations method over gRPC."""
766
+ # Generate a "stub function" on-the-fly which will actually make
767
+ # the request.
768
+ # gRPC handles serialization and deserialization, so we just need
769
+ # to pass in the functions for each.
770
+ if "list_operations" not in self._stubs:
771
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
772
+ "/google.longrunning.Operations/ListOperations",
773
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
774
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
775
+ )
776
+ return self._stubs["list_operations"]
777
+
778
+ @property
779
+ def list_locations(
780
+ self,
781
+ ) -> Callable[
782
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
783
+ ]:
784
+ r"""Return a callable for the list locations method over gRPC."""
785
+ # Generate a "stub function" on-the-fly which will actually make
786
+ # the request.
787
+ # gRPC handles serialization and deserialization, so we just need
788
+ # to pass in the functions for each.
789
+ if "list_locations" not in self._stubs:
790
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
791
+ "/google.cloud.location.Locations/ListLocations",
792
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
793
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
794
+ )
795
+ return self._stubs["list_locations"]
796
+
797
+ @property
798
+ def get_location(
799
+ self,
800
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
801
+ r"""Return a callable for the list locations method over gRPC."""
802
+ # Generate a "stub function" on-the-fly which will actually make
803
+ # the request.
804
+ # gRPC handles serialization and deserialization, so we just need
805
+ # to pass in the functions for each.
806
+ if "get_location" not in self._stubs:
807
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
808
+ "/google.cloud.location.Locations/GetLocation",
809
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
810
+ response_deserializer=locations_pb2.Location.FromString,
811
+ )
812
+ return self._stubs["get_location"]
813
+
814
+ @property
815
+ def set_iam_policy(
816
+ self,
817
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
818
+ r"""Return a callable for the set iam policy method over gRPC.
819
+ Sets the IAM access control policy on the specified
820
+ function. Replaces any existing policy.
821
+ Returns:
822
+ Callable[[~.SetIamPolicyRequest],
823
+ ~.Policy]:
824
+ A function that, when called, will call the underlying RPC
825
+ on the server.
826
+ """
827
+ # Generate a "stub function" on-the-fly which will actually make
828
+ # the request.
829
+ # gRPC handles serialization and deserialization, so we just need
830
+ # to pass in the functions for each.
831
+ if "set_iam_policy" not in self._stubs:
832
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
833
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
834
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
835
+ response_deserializer=policy_pb2.Policy.FromString,
836
+ )
837
+ return self._stubs["set_iam_policy"]
838
+
839
+ @property
840
+ def get_iam_policy(
841
+ self,
842
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
843
+ r"""Return a callable for the get iam policy method over gRPC.
844
+ Gets the IAM access control policy for a function.
845
+ Returns an empty policy if the function exists and does
846
+ not have a policy set.
847
+ Returns:
848
+ Callable[[~.GetIamPolicyRequest],
849
+ ~.Policy]:
850
+ A function that, when called, will call the underlying RPC
851
+ on the server.
852
+ """
853
+ # Generate a "stub function" on-the-fly which will actually make
854
+ # the request.
855
+ # gRPC handles serialization and deserialization, so we just need
856
+ # to pass in the functions for each.
857
+ if "get_iam_policy" not in self._stubs:
858
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
859
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
860
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
861
+ response_deserializer=policy_pb2.Policy.FromString,
862
+ )
863
+ return self._stubs["get_iam_policy"]
864
+
865
+ @property
866
+ def test_iam_permissions(
867
+ self,
868
+ ) -> Callable[
869
+ [iam_policy_pb2.TestIamPermissionsRequest],
870
+ iam_policy_pb2.TestIamPermissionsResponse,
871
+ ]:
872
+ r"""Return a callable for the test iam permissions method over gRPC.
873
+ Tests the specified permissions against the IAM access control
874
+ policy for a function. If the function does not exist, this will
875
+ return an empty set of permissions, not a NOT_FOUND error.
876
+ Returns:
877
+ Callable[[~.TestIamPermissionsRequest],
878
+ ~.TestIamPermissionsResponse]:
879
+ A function that, when called, will call the underlying RPC
880
+ on the server.
881
+ """
882
+ # Generate a "stub function" on-the-fly which will actually make
883
+ # the request.
884
+ # gRPC handles serialization and deserialization, so we just need
885
+ # to pass in the functions for each.
886
+ if "test_iam_permissions" not in self._stubs:
887
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
888
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
889
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
890
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
891
+ )
892
+ return self._stubs["test_iam_permissions"]
893
+
894
+
895
+ __all__ = ("IndexServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .client import JobServiceClient
17
+ from .async_client import JobServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "JobServiceClient",
21
+ "JobServiceAsyncClient",
22
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (372 Bytes). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/async_client.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9385f20d7153aa202cf72257388331794f4ad6001a1224c751cce813fded112
3
+ size 214086
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/client.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98abb6f5630d34413fc3a7b5505ee02f7f989277123cce7cbcc25ae403abc572
3
+ size 240575
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/__pycache__/pagers.cpython-312.pyc ADDED
Binary file (71.1 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/client.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py ADDED
@@ -0,0 +1,1334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from google.api_core import gapic_v1
17
+ from google.api_core import retry as retries
18
+ from google.api_core import retry_async as retries_async
19
+ from typing import (
20
+ Any,
21
+ AsyncIterator,
22
+ Awaitable,
23
+ Callable,
24
+ Sequence,
25
+ Tuple,
26
+ Optional,
27
+ Iterator,
28
+ Union,
29
+ )
30
+
31
+ try:
32
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
33
+ OptionalAsyncRetry = Union[
34
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
35
+ ]
36
+ except AttributeError: # pragma: NO COVER
37
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
38
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
39
+
40
+ from google.cloud.aiplatform_v1beta1.types import batch_prediction_job
41
+ from google.cloud.aiplatform_v1beta1.types import custom_job
42
+ from google.cloud.aiplatform_v1beta1.types import data_labeling_job
43
+ from google.cloud.aiplatform_v1beta1.types import hyperparameter_tuning_job
44
+ from google.cloud.aiplatform_v1beta1.types import job_service
45
+ from google.cloud.aiplatform_v1beta1.types import model_deployment_monitoring_job
46
+ from google.cloud.aiplatform_v1beta1.types import (
47
+ model_deployment_monitoring_job as gca_model_deployment_monitoring_job,
48
+ )
49
+ from google.cloud.aiplatform_v1beta1.types import nas_job
50
+
51
+
52
+ class ListCustomJobsPager:
53
+ """A pager for iterating through ``list_custom_jobs`` requests.
54
+
55
+ This class thinly wraps an initial
56
+ :class:`google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse` object, and
57
+ provides an ``__iter__`` method to iterate through its
58
+ ``custom_jobs`` field.
59
+
60
+ If there are more pages, the ``__iter__`` method will make additional
61
+ ``ListCustomJobs`` requests and continue to iterate
62
+ through the ``custom_jobs`` field on the
63
+ corresponding responses.
64
+
65
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse`
66
+ attributes are available on the pager. If multiple requests are made, only
67
+ the most recent response is retained, and thus used for attribute lookup.
68
+ """
69
+
70
+ def __init__(
71
+ self,
72
+ method: Callable[..., job_service.ListCustomJobsResponse],
73
+ request: job_service.ListCustomJobsRequest,
74
+ response: job_service.ListCustomJobsResponse,
75
+ *,
76
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
77
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
78
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
79
+ ):
80
+ """Instantiate the pager.
81
+
82
+ Args:
83
+ method (Callable): The method that was originally called, and
84
+ which instantiated this pager.
85
+ request (google.cloud.aiplatform_v1beta1.types.ListCustomJobsRequest):
86
+ The initial request object.
87
+ response (google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse):
88
+ The initial response object.
89
+ retry (google.api_core.retry.Retry): Designation of what errors,
90
+ if any, should be retried.
91
+ timeout (float): The timeout for this request.
92
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
93
+ sent along with the request as metadata. Normally, each value must be of type `str`,
94
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
95
+ be of type `bytes`.
96
+ """
97
+ self._method = method
98
+ self._request = job_service.ListCustomJobsRequest(request)
99
+ self._response = response
100
+ self._retry = retry
101
+ self._timeout = timeout
102
+ self._metadata = metadata
103
+
104
+ def __getattr__(self, name: str) -> Any:
105
+ return getattr(self._response, name)
106
+
107
+ @property
108
+ def pages(self) -> Iterator[job_service.ListCustomJobsResponse]:
109
+ yield self._response
110
+ while self._response.next_page_token:
111
+ self._request.page_token = self._response.next_page_token
112
+ self._response = self._method(
113
+ self._request,
114
+ retry=self._retry,
115
+ timeout=self._timeout,
116
+ metadata=self._metadata,
117
+ )
118
+ yield self._response
119
+
120
+ def __iter__(self) -> Iterator[custom_job.CustomJob]:
121
+ for page in self.pages:
122
+ yield from page.custom_jobs
123
+
124
+ def __repr__(self) -> str:
125
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
126
+
127
+
128
+ class ListCustomJobsAsyncPager:
129
+ """A pager for iterating through ``list_custom_jobs`` requests.
130
+
131
+ This class thinly wraps an initial
132
+ :class:`google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse` object, and
133
+ provides an ``__aiter__`` method to iterate through its
134
+ ``custom_jobs`` field.
135
+
136
+ If there are more pages, the ``__aiter__`` method will make additional
137
+ ``ListCustomJobs`` requests and continue to iterate
138
+ through the ``custom_jobs`` field on the
139
+ corresponding responses.
140
+
141
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse`
142
+ attributes are available on the pager. If multiple requests are made, only
143
+ the most recent response is retained, and thus used for attribute lookup.
144
+ """
145
+
146
+ def __init__(
147
+ self,
148
+ method: Callable[..., Awaitable[job_service.ListCustomJobsResponse]],
149
+ request: job_service.ListCustomJobsRequest,
150
+ response: job_service.ListCustomJobsResponse,
151
+ *,
152
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
153
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
154
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
155
+ ):
156
+ """Instantiates the pager.
157
+
158
+ Args:
159
+ method (Callable): The method that was originally called, and
160
+ which instantiated this pager.
161
+ request (google.cloud.aiplatform_v1beta1.types.ListCustomJobsRequest):
162
+ The initial request object.
163
+ response (google.cloud.aiplatform_v1beta1.types.ListCustomJobsResponse):
164
+ The initial response object.
165
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
166
+ if any, should be retried.
167
+ timeout (float): The timeout for this request.
168
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
169
+ sent along with the request as metadata. Normally, each value must be of type `str`,
170
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
171
+ be of type `bytes`.
172
+ """
173
+ self._method = method
174
+ self._request = job_service.ListCustomJobsRequest(request)
175
+ self._response = response
176
+ self._retry = retry
177
+ self._timeout = timeout
178
+ self._metadata = metadata
179
+
180
+ def __getattr__(self, name: str) -> Any:
181
+ return getattr(self._response, name)
182
+
183
+ @property
184
+ async def pages(self) -> AsyncIterator[job_service.ListCustomJobsResponse]:
185
+ yield self._response
186
+ while self._response.next_page_token:
187
+ self._request.page_token = self._response.next_page_token
188
+ self._response = await self._method(
189
+ self._request,
190
+ retry=self._retry,
191
+ timeout=self._timeout,
192
+ metadata=self._metadata,
193
+ )
194
+ yield self._response
195
+
196
+ def __aiter__(self) -> AsyncIterator[custom_job.CustomJob]:
197
+ async def async_generator():
198
+ async for page in self.pages:
199
+ for response in page.custom_jobs:
200
+ yield response
201
+
202
+ return async_generator()
203
+
204
+ def __repr__(self) -> str:
205
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
206
+
207
+
208
+ class ListDataLabelingJobsPager:
209
+ """A pager for iterating through ``list_data_labeling_jobs`` requests.
210
+
211
+ This class thinly wraps an initial
212
+ :class:`google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse` object, and
213
+ provides an ``__iter__`` method to iterate through its
214
+ ``data_labeling_jobs`` field.
215
+
216
+ If there are more pages, the ``__iter__`` method will make additional
217
+ ``ListDataLabelingJobs`` requests and continue to iterate
218
+ through the ``data_labeling_jobs`` field on the
219
+ corresponding responses.
220
+
221
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse`
222
+ attributes are available on the pager. If multiple requests are made, only
223
+ the most recent response is retained, and thus used for attribute lookup.
224
+ """
225
+
226
+ def __init__(
227
+ self,
228
+ method: Callable[..., job_service.ListDataLabelingJobsResponse],
229
+ request: job_service.ListDataLabelingJobsRequest,
230
+ response: job_service.ListDataLabelingJobsResponse,
231
+ *,
232
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
233
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
234
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
235
+ ):
236
+ """Instantiate the pager.
237
+
238
+ Args:
239
+ method (Callable): The method that was originally called, and
240
+ which instantiated this pager.
241
+ request (google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsRequest):
242
+ The initial request object.
243
+ response (google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse):
244
+ The initial response object.
245
+ retry (google.api_core.retry.Retry): Designation of what errors,
246
+ if any, should be retried.
247
+ timeout (float): The timeout for this request.
248
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
249
+ sent along with the request as metadata. Normally, each value must be of type `str`,
250
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
251
+ be of type `bytes`.
252
+ """
253
+ self._method = method
254
+ self._request = job_service.ListDataLabelingJobsRequest(request)
255
+ self._response = response
256
+ self._retry = retry
257
+ self._timeout = timeout
258
+ self._metadata = metadata
259
+
260
+ def __getattr__(self, name: str) -> Any:
261
+ return getattr(self._response, name)
262
+
263
+ @property
264
+ def pages(self) -> Iterator[job_service.ListDataLabelingJobsResponse]:
265
+ yield self._response
266
+ while self._response.next_page_token:
267
+ self._request.page_token = self._response.next_page_token
268
+ self._response = self._method(
269
+ self._request,
270
+ retry=self._retry,
271
+ timeout=self._timeout,
272
+ metadata=self._metadata,
273
+ )
274
+ yield self._response
275
+
276
+ def __iter__(self) -> Iterator[data_labeling_job.DataLabelingJob]:
277
+ for page in self.pages:
278
+ yield from page.data_labeling_jobs
279
+
280
+ def __repr__(self) -> str:
281
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
282
+
283
+
284
+ class ListDataLabelingJobsAsyncPager:
285
+ """A pager for iterating through ``list_data_labeling_jobs`` requests.
286
+
287
+ This class thinly wraps an initial
288
+ :class:`google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse` object, and
289
+ provides an ``__aiter__`` method to iterate through its
290
+ ``data_labeling_jobs`` field.
291
+
292
+ If there are more pages, the ``__aiter__`` method will make additional
293
+ ``ListDataLabelingJobs`` requests and continue to iterate
294
+ through the ``data_labeling_jobs`` field on the
295
+ corresponding responses.
296
+
297
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse`
298
+ attributes are available on the pager. If multiple requests are made, only
299
+ the most recent response is retained, and thus used for attribute lookup.
300
+ """
301
+
302
+ def __init__(
303
+ self,
304
+ method: Callable[..., Awaitable[job_service.ListDataLabelingJobsResponse]],
305
+ request: job_service.ListDataLabelingJobsRequest,
306
+ response: job_service.ListDataLabelingJobsResponse,
307
+ *,
308
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
309
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
310
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
311
+ ):
312
+ """Instantiates the pager.
313
+
314
+ Args:
315
+ method (Callable): The method that was originally called, and
316
+ which instantiated this pager.
317
+ request (google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsRequest):
318
+ The initial request object.
319
+ response (google.cloud.aiplatform_v1beta1.types.ListDataLabelingJobsResponse):
320
+ The initial response object.
321
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
322
+ if any, should be retried.
323
+ timeout (float): The timeout for this request.
324
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
325
+ sent along with the request as metadata. Normally, each value must be of type `str`,
326
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
327
+ be of type `bytes`.
328
+ """
329
+ self._method = method
330
+ self._request = job_service.ListDataLabelingJobsRequest(request)
331
+ self._response = response
332
+ self._retry = retry
333
+ self._timeout = timeout
334
+ self._metadata = metadata
335
+
336
+ def __getattr__(self, name: str) -> Any:
337
+ return getattr(self._response, name)
338
+
339
+ @property
340
+ async def pages(self) -> AsyncIterator[job_service.ListDataLabelingJobsResponse]:
341
+ yield self._response
342
+ while self._response.next_page_token:
343
+ self._request.page_token = self._response.next_page_token
344
+ self._response = await self._method(
345
+ self._request,
346
+ retry=self._retry,
347
+ timeout=self._timeout,
348
+ metadata=self._metadata,
349
+ )
350
+ yield self._response
351
+
352
+ def __aiter__(self) -> AsyncIterator[data_labeling_job.DataLabelingJob]:
353
+ async def async_generator():
354
+ async for page in self.pages:
355
+ for response in page.data_labeling_jobs:
356
+ yield response
357
+
358
+ return async_generator()
359
+
360
+ def __repr__(self) -> str:
361
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
362
+
363
+
364
+ class ListHyperparameterTuningJobsPager:
365
+ """A pager for iterating through ``list_hyperparameter_tuning_jobs`` requests.
366
+
367
+ This class thinly wraps an initial
368
+ :class:`google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse` object, and
369
+ provides an ``__iter__`` method to iterate through its
370
+ ``hyperparameter_tuning_jobs`` field.
371
+
372
+ If there are more pages, the ``__iter__`` method will make additional
373
+ ``ListHyperparameterTuningJobs`` requests and continue to iterate
374
+ through the ``hyperparameter_tuning_jobs`` field on the
375
+ corresponding responses.
376
+
377
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse`
378
+ attributes are available on the pager. If multiple requests are made, only
379
+ the most recent response is retained, and thus used for attribute lookup.
380
+ """
381
+
382
+ def __init__(
383
+ self,
384
+ method: Callable[..., job_service.ListHyperparameterTuningJobsResponse],
385
+ request: job_service.ListHyperparameterTuningJobsRequest,
386
+ response: job_service.ListHyperparameterTuningJobsResponse,
387
+ *,
388
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
389
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
390
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
391
+ ):
392
+ """Instantiate the pager.
393
+
394
+ Args:
395
+ method (Callable): The method that was originally called, and
396
+ which instantiated this pager.
397
+ request (google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsRequest):
398
+ The initial request object.
399
+ response (google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse):
400
+ The initial response object.
401
+ retry (google.api_core.retry.Retry): Designation of what errors,
402
+ if any, should be retried.
403
+ timeout (float): The timeout for this request.
404
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
405
+ sent along with the request as metadata. Normally, each value must be of type `str`,
406
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
407
+ be of type `bytes`.
408
+ """
409
+ self._method = method
410
+ self._request = job_service.ListHyperparameterTuningJobsRequest(request)
411
+ self._response = response
412
+ self._retry = retry
413
+ self._timeout = timeout
414
+ self._metadata = metadata
415
+
416
+ def __getattr__(self, name: str) -> Any:
417
+ return getattr(self._response, name)
418
+
419
+ @property
420
+ def pages(self) -> Iterator[job_service.ListHyperparameterTuningJobsResponse]:
421
+ yield self._response
422
+ while self._response.next_page_token:
423
+ self._request.page_token = self._response.next_page_token
424
+ self._response = self._method(
425
+ self._request,
426
+ retry=self._retry,
427
+ timeout=self._timeout,
428
+ metadata=self._metadata,
429
+ )
430
+ yield self._response
431
+
432
+ def __iter__(self) -> Iterator[hyperparameter_tuning_job.HyperparameterTuningJob]:
433
+ for page in self.pages:
434
+ yield from page.hyperparameter_tuning_jobs
435
+
436
+ def __repr__(self) -> str:
437
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
438
+
439
+
440
+ class ListHyperparameterTuningJobsAsyncPager:
441
+ """A pager for iterating through ``list_hyperparameter_tuning_jobs`` requests.
442
+
443
+ This class thinly wraps an initial
444
+ :class:`google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse` object, and
445
+ provides an ``__aiter__`` method to iterate through its
446
+ ``hyperparameter_tuning_jobs`` field.
447
+
448
+ If there are more pages, the ``__aiter__`` method will make additional
449
+ ``ListHyperparameterTuningJobs`` requests and continue to iterate
450
+ through the ``hyperparameter_tuning_jobs`` field on the
451
+ corresponding responses.
452
+
453
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse`
454
+ attributes are available on the pager. If multiple requests are made, only
455
+ the most recent response is retained, and thus used for attribute lookup.
456
+ """
457
+
458
+ def __init__(
459
+ self,
460
+ method: Callable[
461
+ ..., Awaitable[job_service.ListHyperparameterTuningJobsResponse]
462
+ ],
463
+ request: job_service.ListHyperparameterTuningJobsRequest,
464
+ response: job_service.ListHyperparameterTuningJobsResponse,
465
+ *,
466
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
467
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
468
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
469
+ ):
470
+ """Instantiates the pager.
471
+
472
+ Args:
473
+ method (Callable): The method that was originally called, and
474
+ which instantiated this pager.
475
+ request (google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsRequest):
476
+ The initial request object.
477
+ response (google.cloud.aiplatform_v1beta1.types.ListHyperparameterTuningJobsResponse):
478
+ The initial response object.
479
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
480
+ if any, should be retried.
481
+ timeout (float): The timeout for this request.
482
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
483
+ sent along with the request as metadata. Normally, each value must be of type `str`,
484
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
485
+ be of type `bytes`.
486
+ """
487
+ self._method = method
488
+ self._request = job_service.ListHyperparameterTuningJobsRequest(request)
489
+ self._response = response
490
+ self._retry = retry
491
+ self._timeout = timeout
492
+ self._metadata = metadata
493
+
494
+ def __getattr__(self, name: str) -> Any:
495
+ return getattr(self._response, name)
496
+
497
+ @property
498
+ async def pages(
499
+ self,
500
+ ) -> AsyncIterator[job_service.ListHyperparameterTuningJobsResponse]:
501
+ yield self._response
502
+ while self._response.next_page_token:
503
+ self._request.page_token = self._response.next_page_token
504
+ self._response = await self._method(
505
+ self._request,
506
+ retry=self._retry,
507
+ timeout=self._timeout,
508
+ metadata=self._metadata,
509
+ )
510
+ yield self._response
511
+
512
+ def __aiter__(
513
+ self,
514
+ ) -> AsyncIterator[hyperparameter_tuning_job.HyperparameterTuningJob]:
515
+ async def async_generator():
516
+ async for page in self.pages:
517
+ for response in page.hyperparameter_tuning_jobs:
518
+ yield response
519
+
520
+ return async_generator()
521
+
522
+ def __repr__(self) -> str:
523
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
524
+
525
+
526
+ class ListNasJobsPager:
527
+ """A pager for iterating through ``list_nas_jobs`` requests.
528
+
529
+ This class thinly wraps an initial
530
+ :class:`google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse` object, and
531
+ provides an ``__iter__`` method to iterate through its
532
+ ``nas_jobs`` field.
533
+
534
+ If there are more pages, the ``__iter__`` method will make additional
535
+ ``ListNasJobs`` requests and continue to iterate
536
+ through the ``nas_jobs`` field on the
537
+ corresponding responses.
538
+
539
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse`
540
+ attributes are available on the pager. If multiple requests are made, only
541
+ the most recent response is retained, and thus used for attribute lookup.
542
+ """
543
+
544
+ def __init__(
545
+ self,
546
+ method: Callable[..., job_service.ListNasJobsResponse],
547
+ request: job_service.ListNasJobsRequest,
548
+ response: job_service.ListNasJobsResponse,
549
+ *,
550
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
551
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
552
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
553
+ ):
554
+ """Instantiate the pager.
555
+
556
+ Args:
557
+ method (Callable): The method that was originally called, and
558
+ which instantiated this pager.
559
+ request (google.cloud.aiplatform_v1beta1.types.ListNasJobsRequest):
560
+ The initial request object.
561
+ response (google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse):
562
+ The initial response object.
563
+ retry (google.api_core.retry.Retry): Designation of what errors,
564
+ if any, should be retried.
565
+ timeout (float): The timeout for this request.
566
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
567
+ sent along with the request as metadata. Normally, each value must be of type `str`,
568
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
569
+ be of type `bytes`.
570
+ """
571
+ self._method = method
572
+ self._request = job_service.ListNasJobsRequest(request)
573
+ self._response = response
574
+ self._retry = retry
575
+ self._timeout = timeout
576
+ self._metadata = metadata
577
+
578
+ def __getattr__(self, name: str) -> Any:
579
+ return getattr(self._response, name)
580
+
581
+ @property
582
+ def pages(self) -> Iterator[job_service.ListNasJobsResponse]:
583
+ yield self._response
584
+ while self._response.next_page_token:
585
+ self._request.page_token = self._response.next_page_token
586
+ self._response = self._method(
587
+ self._request,
588
+ retry=self._retry,
589
+ timeout=self._timeout,
590
+ metadata=self._metadata,
591
+ )
592
+ yield self._response
593
+
594
+ def __iter__(self) -> Iterator[nas_job.NasJob]:
595
+ for page in self.pages:
596
+ yield from page.nas_jobs
597
+
598
+ def __repr__(self) -> str:
599
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
600
+
601
+
602
+ class ListNasJobsAsyncPager:
603
+ """A pager for iterating through ``list_nas_jobs`` requests.
604
+
605
+ This class thinly wraps an initial
606
+ :class:`google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse` object, and
607
+ provides an ``__aiter__`` method to iterate through its
608
+ ``nas_jobs`` field.
609
+
610
+ If there are more pages, the ``__aiter__`` method will make additional
611
+ ``ListNasJobs`` requests and continue to iterate
612
+ through the ``nas_jobs`` field on the
613
+ corresponding responses.
614
+
615
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse`
616
+ attributes are available on the pager. If multiple requests are made, only
617
+ the most recent response is retained, and thus used for attribute lookup.
618
+ """
619
+
620
+ def __init__(
621
+ self,
622
+ method: Callable[..., Awaitable[job_service.ListNasJobsResponse]],
623
+ request: job_service.ListNasJobsRequest,
624
+ response: job_service.ListNasJobsResponse,
625
+ *,
626
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
627
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
628
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
629
+ ):
630
+ """Instantiates the pager.
631
+
632
+ Args:
633
+ method (Callable): The method that was originally called, and
634
+ which instantiated this pager.
635
+ request (google.cloud.aiplatform_v1beta1.types.ListNasJobsRequest):
636
+ The initial request object.
637
+ response (google.cloud.aiplatform_v1beta1.types.ListNasJobsResponse):
638
+ The initial response object.
639
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
640
+ if any, should be retried.
641
+ timeout (float): The timeout for this request.
642
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
643
+ sent along with the request as metadata. Normally, each value must be of type `str`,
644
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
645
+ be of type `bytes`.
646
+ """
647
+ self._method = method
648
+ self._request = job_service.ListNasJobsRequest(request)
649
+ self._response = response
650
+ self._retry = retry
651
+ self._timeout = timeout
652
+ self._metadata = metadata
653
+
654
+ def __getattr__(self, name: str) -> Any:
655
+ return getattr(self._response, name)
656
+
657
+ @property
658
+ async def pages(self) -> AsyncIterator[job_service.ListNasJobsResponse]:
659
+ yield self._response
660
+ while self._response.next_page_token:
661
+ self._request.page_token = self._response.next_page_token
662
+ self._response = await self._method(
663
+ self._request,
664
+ retry=self._retry,
665
+ timeout=self._timeout,
666
+ metadata=self._metadata,
667
+ )
668
+ yield self._response
669
+
670
+ def __aiter__(self) -> AsyncIterator[nas_job.NasJob]:
671
+ async def async_generator():
672
+ async for page in self.pages:
673
+ for response in page.nas_jobs:
674
+ yield response
675
+
676
+ return async_generator()
677
+
678
+ def __repr__(self) -> str:
679
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
680
+
681
+
682
+ class ListNasTrialDetailsPager:
683
+ """A pager for iterating through ``list_nas_trial_details`` requests.
684
+
685
+ This class thinly wraps an initial
686
+ :class:`google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse` object, and
687
+ provides an ``__iter__`` method to iterate through its
688
+ ``nas_trial_details`` field.
689
+
690
+ If there are more pages, the ``__iter__`` method will make additional
691
+ ``ListNasTrialDetails`` requests and continue to iterate
692
+ through the ``nas_trial_details`` field on the
693
+ corresponding responses.
694
+
695
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse`
696
+ attributes are available on the pager. If multiple requests are made, only
697
+ the most recent response is retained, and thus used for attribute lookup.
698
+ """
699
+
700
+ def __init__(
701
+ self,
702
+ method: Callable[..., job_service.ListNasTrialDetailsResponse],
703
+ request: job_service.ListNasTrialDetailsRequest,
704
+ response: job_service.ListNasTrialDetailsResponse,
705
+ *,
706
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
707
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
708
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
709
+ ):
710
+ """Instantiate the pager.
711
+
712
+ Args:
713
+ method (Callable): The method that was originally called, and
714
+ which instantiated this pager.
715
+ request (google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsRequest):
716
+ The initial request object.
717
+ response (google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse):
718
+ The initial response object.
719
+ retry (google.api_core.retry.Retry): Designation of what errors,
720
+ if any, should be retried.
721
+ timeout (float): The timeout for this request.
722
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
723
+ sent along with the request as metadata. Normally, each value must be of type `str`,
724
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
725
+ be of type `bytes`.
726
+ """
727
+ self._method = method
728
+ self._request = job_service.ListNasTrialDetailsRequest(request)
729
+ self._response = response
730
+ self._retry = retry
731
+ self._timeout = timeout
732
+ self._metadata = metadata
733
+
734
+ def __getattr__(self, name: str) -> Any:
735
+ return getattr(self._response, name)
736
+
737
+ @property
738
+ def pages(self) -> Iterator[job_service.ListNasTrialDetailsResponse]:
739
+ yield self._response
740
+ while self._response.next_page_token:
741
+ self._request.page_token = self._response.next_page_token
742
+ self._response = self._method(
743
+ self._request,
744
+ retry=self._retry,
745
+ timeout=self._timeout,
746
+ metadata=self._metadata,
747
+ )
748
+ yield self._response
749
+
750
+ def __iter__(self) -> Iterator[nas_job.NasTrialDetail]:
751
+ for page in self.pages:
752
+ yield from page.nas_trial_details
753
+
754
+ def __repr__(self) -> str:
755
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
756
+
757
+
758
+ class ListNasTrialDetailsAsyncPager:
759
+ """A pager for iterating through ``list_nas_trial_details`` requests.
760
+
761
+ This class thinly wraps an initial
762
+ :class:`google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse` object, and
763
+ provides an ``__aiter__`` method to iterate through its
764
+ ``nas_trial_details`` field.
765
+
766
+ If there are more pages, the ``__aiter__`` method will make additional
767
+ ``ListNasTrialDetails`` requests and continue to iterate
768
+ through the ``nas_trial_details`` field on the
769
+ corresponding responses.
770
+
771
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse`
772
+ attributes are available on the pager. If multiple requests are made, only
773
+ the most recent response is retained, and thus used for attribute lookup.
774
+ """
775
+
776
+ def __init__(
777
+ self,
778
+ method: Callable[..., Awaitable[job_service.ListNasTrialDetailsResponse]],
779
+ request: job_service.ListNasTrialDetailsRequest,
780
+ response: job_service.ListNasTrialDetailsResponse,
781
+ *,
782
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
783
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
784
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
785
+ ):
786
+ """Instantiates the pager.
787
+
788
+ Args:
789
+ method (Callable): The method that was originally called, and
790
+ which instantiated this pager.
791
+ request (google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsRequest):
792
+ The initial request object.
793
+ response (google.cloud.aiplatform_v1beta1.types.ListNasTrialDetailsResponse):
794
+ The initial response object.
795
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
796
+ if any, should be retried.
797
+ timeout (float): The timeout for this request.
798
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
799
+ sent along with the request as metadata. Normally, each value must be of type `str`,
800
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
801
+ be of type `bytes`.
802
+ """
803
+ self._method = method
804
+ self._request = job_service.ListNasTrialDetailsRequest(request)
805
+ self._response = response
806
+ self._retry = retry
807
+ self._timeout = timeout
808
+ self._metadata = metadata
809
+
810
+ def __getattr__(self, name: str) -> Any:
811
+ return getattr(self._response, name)
812
+
813
+ @property
814
+ async def pages(self) -> AsyncIterator[job_service.ListNasTrialDetailsResponse]:
815
+ yield self._response
816
+ while self._response.next_page_token:
817
+ self._request.page_token = self._response.next_page_token
818
+ self._response = await self._method(
819
+ self._request,
820
+ retry=self._retry,
821
+ timeout=self._timeout,
822
+ metadata=self._metadata,
823
+ )
824
+ yield self._response
825
+
826
+ def __aiter__(self) -> AsyncIterator[nas_job.NasTrialDetail]:
827
+ async def async_generator():
828
+ async for page in self.pages:
829
+ for response in page.nas_trial_details:
830
+ yield response
831
+
832
+ return async_generator()
833
+
834
+ def __repr__(self) -> str:
835
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
836
+
837
+
838
+ class ListBatchPredictionJobsPager:
839
+ """A pager for iterating through ``list_batch_prediction_jobs`` requests.
840
+
841
+ This class thinly wraps an initial
842
+ :class:`google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse` object, and
843
+ provides an ``__iter__`` method to iterate through its
844
+ ``batch_prediction_jobs`` field.
845
+
846
+ If there are more pages, the ``__iter__`` method will make additional
847
+ ``ListBatchPredictionJobs`` requests and continue to iterate
848
+ through the ``batch_prediction_jobs`` field on the
849
+ corresponding responses.
850
+
851
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse`
852
+ attributes are available on the pager. If multiple requests are made, only
853
+ the most recent response is retained, and thus used for attribute lookup.
854
+ """
855
+
856
+ def __init__(
857
+ self,
858
+ method: Callable[..., job_service.ListBatchPredictionJobsResponse],
859
+ request: job_service.ListBatchPredictionJobsRequest,
860
+ response: job_service.ListBatchPredictionJobsResponse,
861
+ *,
862
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
863
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
864
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
865
+ ):
866
+ """Instantiate the pager.
867
+
868
+ Args:
869
+ method (Callable): The method that was originally called, and
870
+ which instantiated this pager.
871
+ request (google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsRequest):
872
+ The initial request object.
873
+ response (google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse):
874
+ The initial response object.
875
+ retry (google.api_core.retry.Retry): Designation of what errors,
876
+ if any, should be retried.
877
+ timeout (float): The timeout for this request.
878
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
879
+ sent along with the request as metadata. Normally, each value must be of type `str`,
880
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
881
+ be of type `bytes`.
882
+ """
883
+ self._method = method
884
+ self._request = job_service.ListBatchPredictionJobsRequest(request)
885
+ self._response = response
886
+ self._retry = retry
887
+ self._timeout = timeout
888
+ self._metadata = metadata
889
+
890
+ def __getattr__(self, name: str) -> Any:
891
+ return getattr(self._response, name)
892
+
893
+ @property
894
+ def pages(self) -> Iterator[job_service.ListBatchPredictionJobsResponse]:
895
+ yield self._response
896
+ while self._response.next_page_token:
897
+ self._request.page_token = self._response.next_page_token
898
+ self._response = self._method(
899
+ self._request,
900
+ retry=self._retry,
901
+ timeout=self._timeout,
902
+ metadata=self._metadata,
903
+ )
904
+ yield self._response
905
+
906
+ def __iter__(self) -> Iterator[batch_prediction_job.BatchPredictionJob]:
907
+ for page in self.pages:
908
+ yield from page.batch_prediction_jobs
909
+
910
+ def __repr__(self) -> str:
911
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
912
+
913
+
914
+ class ListBatchPredictionJobsAsyncPager:
915
+ """A pager for iterating through ``list_batch_prediction_jobs`` requests.
916
+
917
+ This class thinly wraps an initial
918
+ :class:`google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse` object, and
919
+ provides an ``__aiter__`` method to iterate through its
920
+ ``batch_prediction_jobs`` field.
921
+
922
+ If there are more pages, the ``__aiter__`` method will make additional
923
+ ``ListBatchPredictionJobs`` requests and continue to iterate
924
+ through the ``batch_prediction_jobs`` field on the
925
+ corresponding responses.
926
+
927
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse`
928
+ attributes are available on the pager. If multiple requests are made, only
929
+ the most recent response is retained, and thus used for attribute lookup.
930
+ """
931
+
932
+ def __init__(
933
+ self,
934
+ method: Callable[..., Awaitable[job_service.ListBatchPredictionJobsResponse]],
935
+ request: job_service.ListBatchPredictionJobsRequest,
936
+ response: job_service.ListBatchPredictionJobsResponse,
937
+ *,
938
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
939
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
940
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
941
+ ):
942
+ """Instantiates the pager.
943
+
944
+ Args:
945
+ method (Callable): The method that was originally called, and
946
+ which instantiated this pager.
947
+ request (google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsRequest):
948
+ The initial request object.
949
+ response (google.cloud.aiplatform_v1beta1.types.ListBatchPredictionJobsResponse):
950
+ The initial response object.
951
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
952
+ if any, should be retried.
953
+ timeout (float): The timeout for this request.
954
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
955
+ sent along with the request as metadata. Normally, each value must be of type `str`,
956
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
957
+ be of type `bytes`.
958
+ """
959
+ self._method = method
960
+ self._request = job_service.ListBatchPredictionJobsRequest(request)
961
+ self._response = response
962
+ self._retry = retry
963
+ self._timeout = timeout
964
+ self._metadata = metadata
965
+
966
+ def __getattr__(self, name: str) -> Any:
967
+ return getattr(self._response, name)
968
+
969
+ @property
970
+ async def pages(self) -> AsyncIterator[job_service.ListBatchPredictionJobsResponse]:
971
+ yield self._response
972
+ while self._response.next_page_token:
973
+ self._request.page_token = self._response.next_page_token
974
+ self._response = await self._method(
975
+ self._request,
976
+ retry=self._retry,
977
+ timeout=self._timeout,
978
+ metadata=self._metadata,
979
+ )
980
+ yield self._response
981
+
982
+ def __aiter__(self) -> AsyncIterator[batch_prediction_job.BatchPredictionJob]:
983
+ async def async_generator():
984
+ async for page in self.pages:
985
+ for response in page.batch_prediction_jobs:
986
+ yield response
987
+
988
+ return async_generator()
989
+
990
+ def __repr__(self) -> str:
991
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
992
+
993
+
994
+ class SearchModelDeploymentMonitoringStatsAnomaliesPager:
995
+ """A pager for iterating through ``search_model_deployment_monitoring_stats_anomalies`` requests.
996
+
997
+ This class thinly wraps an initial
998
+ :class:`google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse` object, and
999
+ provides an ``__iter__`` method to iterate through its
1000
+ ``monitoring_stats`` field.
1001
+
1002
+ If there are more pages, the ``__iter__`` method will make additional
1003
+ ``SearchModelDeploymentMonitoringStatsAnomalies`` requests and continue to iterate
1004
+ through the ``monitoring_stats`` field on the
1005
+ corresponding responses.
1006
+
1007
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse`
1008
+ attributes are available on the pager. If multiple requests are made, only
1009
+ the most recent response is retained, and thus used for attribute lookup.
1010
+ """
1011
+
1012
+ def __init__(
1013
+ self,
1014
+ method: Callable[
1015
+ ..., job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse
1016
+ ],
1017
+ request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest,
1018
+ response: job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse,
1019
+ *,
1020
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1021
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1022
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
1023
+ ):
1024
+ """Instantiate the pager.
1025
+
1026
+ Args:
1027
+ method (Callable): The method that was originally called, and
1028
+ which instantiated this pager.
1029
+ request (google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesRequest):
1030
+ The initial request object.
1031
+ response (google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse):
1032
+ The initial response object.
1033
+ retry (google.api_core.retry.Retry): Designation of what errors,
1034
+ if any, should be retried.
1035
+ timeout (float): The timeout for this request.
1036
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1037
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1038
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1039
+ be of type `bytes`.
1040
+ """
1041
+ self._method = method
1042
+ self._request = (
1043
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest(request)
1044
+ )
1045
+ self._response = response
1046
+ self._retry = retry
1047
+ self._timeout = timeout
1048
+ self._metadata = metadata
1049
+
1050
+ def __getattr__(self, name: str) -> Any:
1051
+ return getattr(self._response, name)
1052
+
1053
+ @property
1054
+ def pages(
1055
+ self,
1056
+ ) -> Iterator[job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse]:
1057
+ yield self._response
1058
+ while self._response.next_page_token:
1059
+ self._request.page_token = self._response.next_page_token
1060
+ self._response = self._method(
1061
+ self._request,
1062
+ retry=self._retry,
1063
+ timeout=self._timeout,
1064
+ metadata=self._metadata,
1065
+ )
1066
+ yield self._response
1067
+
1068
+ def __iter__(
1069
+ self,
1070
+ ) -> Iterator[gca_model_deployment_monitoring_job.ModelMonitoringStatsAnomalies]:
1071
+ for page in self.pages:
1072
+ yield from page.monitoring_stats
1073
+
1074
+ def __repr__(self) -> str:
1075
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
1076
+
1077
+
1078
+ class SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager:
1079
+ """A pager for iterating through ``search_model_deployment_monitoring_stats_anomalies`` requests.
1080
+
1081
+ This class thinly wraps an initial
1082
+ :class:`google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse` object, and
1083
+ provides an ``__aiter__`` method to iterate through its
1084
+ ``monitoring_stats`` field.
1085
+
1086
+ If there are more pages, the ``__aiter__`` method will make additional
1087
+ ``SearchModelDeploymentMonitoringStatsAnomalies`` requests and continue to iterate
1088
+ through the ``monitoring_stats`` field on the
1089
+ corresponding responses.
1090
+
1091
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse`
1092
+ attributes are available on the pager. If multiple requests are made, only
1093
+ the most recent response is retained, and thus used for attribute lookup.
1094
+ """
1095
+
1096
+ def __init__(
1097
+ self,
1098
+ method: Callable[
1099
+ ...,
1100
+ Awaitable[
1101
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse
1102
+ ],
1103
+ ],
1104
+ request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest,
1105
+ response: job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse,
1106
+ *,
1107
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
1108
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1109
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
1110
+ ):
1111
+ """Instantiates the pager.
1112
+
1113
+ Args:
1114
+ method (Callable): The method that was originally called, and
1115
+ which instantiated this pager.
1116
+ request (google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesRequest):
1117
+ The initial request object.
1118
+ response (google.cloud.aiplatform_v1beta1.types.SearchModelDeploymentMonitoringStatsAnomaliesResponse):
1119
+ The initial response object.
1120
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
1121
+ if any, should be retried.
1122
+ timeout (float): The timeout for this request.
1123
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1124
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1125
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1126
+ be of type `bytes`.
1127
+ """
1128
+ self._method = method
1129
+ self._request = (
1130
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest(request)
1131
+ )
1132
+ self._response = response
1133
+ self._retry = retry
1134
+ self._timeout = timeout
1135
+ self._metadata = metadata
1136
+
1137
+ def __getattr__(self, name: str) -> Any:
1138
+ return getattr(self._response, name)
1139
+
1140
+ @property
1141
+ async def pages(
1142
+ self,
1143
+ ) -> AsyncIterator[
1144
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse
1145
+ ]:
1146
+ yield self._response
1147
+ while self._response.next_page_token:
1148
+ self._request.page_token = self._response.next_page_token
1149
+ self._response = await self._method(
1150
+ self._request,
1151
+ retry=self._retry,
1152
+ timeout=self._timeout,
1153
+ metadata=self._metadata,
1154
+ )
1155
+ yield self._response
1156
+
1157
+ def __aiter__(
1158
+ self,
1159
+ ) -> AsyncIterator[
1160
+ gca_model_deployment_monitoring_job.ModelMonitoringStatsAnomalies
1161
+ ]:
1162
+ async def async_generator():
1163
+ async for page in self.pages:
1164
+ for response in page.monitoring_stats:
1165
+ yield response
1166
+
1167
+ return async_generator()
1168
+
1169
+ def __repr__(self) -> str:
1170
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
1171
+
1172
+
1173
+ class ListModelDeploymentMonitoringJobsPager:
1174
+ """A pager for iterating through ``list_model_deployment_monitoring_jobs`` requests.
1175
+
1176
+ This class thinly wraps an initial
1177
+ :class:`google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse` object, and
1178
+ provides an ``__iter__`` method to iterate through its
1179
+ ``model_deployment_monitoring_jobs`` field.
1180
+
1181
+ If there are more pages, the ``__iter__`` method will make additional
1182
+ ``ListModelDeploymentMonitoringJobs`` requests and continue to iterate
1183
+ through the ``model_deployment_monitoring_jobs`` field on the
1184
+ corresponding responses.
1185
+
1186
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse`
1187
+ attributes are available on the pager. If multiple requests are made, only
1188
+ the most recent response is retained, and thus used for attribute lookup.
1189
+ """
1190
+
1191
+ def __init__(
1192
+ self,
1193
+ method: Callable[..., job_service.ListModelDeploymentMonitoringJobsResponse],
1194
+ request: job_service.ListModelDeploymentMonitoringJobsRequest,
1195
+ response: job_service.ListModelDeploymentMonitoringJobsResponse,
1196
+ *,
1197
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1198
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1199
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
1200
+ ):
1201
+ """Instantiate the pager.
1202
+
1203
+ Args:
1204
+ method (Callable): The method that was originally called, and
1205
+ which instantiated this pager.
1206
+ request (google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsRequest):
1207
+ The initial request object.
1208
+ response (google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse):
1209
+ The initial response object.
1210
+ retry (google.api_core.retry.Retry): Designation of what errors,
1211
+ if any, should be retried.
1212
+ timeout (float): The timeout for this request.
1213
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1214
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1215
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1216
+ be of type `bytes`.
1217
+ """
1218
+ self._method = method
1219
+ self._request = job_service.ListModelDeploymentMonitoringJobsRequest(request)
1220
+ self._response = response
1221
+ self._retry = retry
1222
+ self._timeout = timeout
1223
+ self._metadata = metadata
1224
+
1225
+ def __getattr__(self, name: str) -> Any:
1226
+ return getattr(self._response, name)
1227
+
1228
+ @property
1229
+ def pages(self) -> Iterator[job_service.ListModelDeploymentMonitoringJobsResponse]:
1230
+ yield self._response
1231
+ while self._response.next_page_token:
1232
+ self._request.page_token = self._response.next_page_token
1233
+ self._response = self._method(
1234
+ self._request,
1235
+ retry=self._retry,
1236
+ timeout=self._timeout,
1237
+ metadata=self._metadata,
1238
+ )
1239
+ yield self._response
1240
+
1241
+ def __iter__(
1242
+ self,
1243
+ ) -> Iterator[model_deployment_monitoring_job.ModelDeploymentMonitoringJob]:
1244
+ for page in self.pages:
1245
+ yield from page.model_deployment_monitoring_jobs
1246
+
1247
+ def __repr__(self) -> str:
1248
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
1249
+
1250
+
1251
+ class ListModelDeploymentMonitoringJobsAsyncPager:
1252
+ """A pager for iterating through ``list_model_deployment_monitoring_jobs`` requests.
1253
+
1254
+ This class thinly wraps an initial
1255
+ :class:`google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse` object, and
1256
+ provides an ``__aiter__`` method to iterate through its
1257
+ ``model_deployment_monitoring_jobs`` field.
1258
+
1259
+ If there are more pages, the ``__aiter__`` method will make additional
1260
+ ``ListModelDeploymentMonitoringJobs`` requests and continue to iterate
1261
+ through the ``model_deployment_monitoring_jobs`` field on the
1262
+ corresponding responses.
1263
+
1264
+ All the usual :class:`google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse`
1265
+ attributes are available on the pager. If multiple requests are made, only
1266
+ the most recent response is retained, and thus used for attribute lookup.
1267
+ """
1268
+
1269
+ def __init__(
1270
+ self,
1271
+ method: Callable[
1272
+ ..., Awaitable[job_service.ListModelDeploymentMonitoringJobsResponse]
1273
+ ],
1274
+ request: job_service.ListModelDeploymentMonitoringJobsRequest,
1275
+ response: job_service.ListModelDeploymentMonitoringJobsResponse,
1276
+ *,
1277
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
1278
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1279
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
1280
+ ):
1281
+ """Instantiates the pager.
1282
+
1283
+ Args:
1284
+ method (Callable): The method that was originally called, and
1285
+ which instantiated this pager.
1286
+ request (google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsRequest):
1287
+ The initial request object.
1288
+ response (google.cloud.aiplatform_v1beta1.types.ListModelDeploymentMonitoringJobsResponse):
1289
+ The initial response object.
1290
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
1291
+ if any, should be retried.
1292
+ timeout (float): The timeout for this request.
1293
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1294
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1295
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1296
+ be of type `bytes`.
1297
+ """
1298
+ self._method = method
1299
+ self._request = job_service.ListModelDeploymentMonitoringJobsRequest(request)
1300
+ self._response = response
1301
+ self._retry = retry
1302
+ self._timeout = timeout
1303
+ self._metadata = metadata
1304
+
1305
+ def __getattr__(self, name: str) -> Any:
1306
+ return getattr(self._response, name)
1307
+
1308
+ @property
1309
+ async def pages(
1310
+ self,
1311
+ ) -> AsyncIterator[job_service.ListModelDeploymentMonitoringJobsResponse]:
1312
+ yield self._response
1313
+ while self._response.next_page_token:
1314
+ self._request.page_token = self._response.next_page_token
1315
+ self._response = await self._method(
1316
+ self._request,
1317
+ retry=self._retry,
1318
+ timeout=self._timeout,
1319
+ metadata=self._metadata,
1320
+ )
1321
+ yield self._response
1322
+
1323
+ def __aiter__(
1324
+ self,
1325
+ ) -> AsyncIterator[model_deployment_monitoring_job.ModelDeploymentMonitoringJob]:
1326
+ async def async_generator():
1327
+ async for page in self.pages:
1328
+ for response in page.model_deployment_monitoring_jobs:
1329
+ yield response
1330
+
1331
+ return async_generator()
1332
+
1333
+ def __repr__(self) -> str:
1334
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type, Tuple
18
+
19
+ from .base import JobServiceTransport
20
+ from .grpc import JobServiceGrpcTransport
21
+ from .grpc_asyncio import JobServiceGrpcAsyncIOTransport
22
+ from .rest import JobServiceRestTransport
23
+ from .rest import JobServiceRestInterceptor
24
+
25
+ ASYNC_REST_CLASSES: Tuple[str, ...]
26
+ try:
27
+ from .rest_asyncio import AsyncJobServiceRestTransport
28
+ from .rest_asyncio import AsyncJobServiceRestInterceptor
29
+
30
+ ASYNC_REST_CLASSES = (
31
+ "AsyncJobServiceRestTransport",
32
+ "AsyncJobServiceRestInterceptor",
33
+ )
34
+ HAS_REST_ASYNC = True
35
+ except ImportError: # pragma: NO COVER
36
+ ASYNC_REST_CLASSES = ()
37
+ HAS_REST_ASYNC = False
38
+
39
+
40
+ # Compile a registry of transports.
41
+ _transport_registry = OrderedDict() # type: Dict[str, Type[JobServiceTransport]]
42
+ _transport_registry["grpc"] = JobServiceGrpcTransport
43
+ _transport_registry["grpc_asyncio"] = JobServiceGrpcAsyncIOTransport
44
+ _transport_registry["rest"] = JobServiceRestTransport
45
+ if HAS_REST_ASYNC: # pragma: NO COVER
46
+ _transport_registry["rest_asyncio"] = AsyncJobServiceRestTransport
47
+
48
+ __all__ = (
49
+ "JobServiceTransport",
50
+ "JobServiceGrpcTransport",
51
+ "JobServiceGrpcAsyncIOTransport",
52
+ "JobServiceRestTransport",
53
+ "JobServiceRestInterceptor",
54
+ ) + ASYNC_REST_CLASSES
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (1.22 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/base.cpython-312.pyc ADDED
Binary file (32.8 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/grpc.cpython-312.pyc ADDED
Binary file (68.3 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/grpc_asyncio.cpython-312.pyc ADDED
Binary file (77.2 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:599b59931aa5d3d08224fb0243e48039e57d3797f65140a34de253ae40d1b218
3
+ size 391026
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_asyncio.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:112094a837c5fbce6c7d062c41f5b33f1b53521fa1161497a0404f0dbec0a27f
3
+ size 423528
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/__pycache__/rest_base.cpython-312.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f348e0cb90bc3890121d8d672c5c8e6a19644399cba656ba60d87606c0d67c98
3
+ size 141854
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/base.py ADDED
@@ -0,0 +1,877 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ from google.cloud.aiplatform_v1beta1 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.api_core import operations_v1
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.oauth2 import service_account # type: ignore
29
+ import google.protobuf
30
+
31
+ from google.cloud.aiplatform_v1beta1.types import batch_prediction_job
32
+ from google.cloud.aiplatform_v1beta1.types import (
33
+ batch_prediction_job as gca_batch_prediction_job,
34
+ )
35
+ from google.cloud.aiplatform_v1beta1.types import custom_job
36
+ from google.cloud.aiplatform_v1beta1.types import custom_job as gca_custom_job
37
+ from google.cloud.aiplatform_v1beta1.types import data_labeling_job
38
+ from google.cloud.aiplatform_v1beta1.types import (
39
+ data_labeling_job as gca_data_labeling_job,
40
+ )
41
+ from google.cloud.aiplatform_v1beta1.types import hyperparameter_tuning_job
42
+ from google.cloud.aiplatform_v1beta1.types import (
43
+ hyperparameter_tuning_job as gca_hyperparameter_tuning_job,
44
+ )
45
+ from google.cloud.aiplatform_v1beta1.types import job_service
46
+ from google.cloud.aiplatform_v1beta1.types import model_deployment_monitoring_job
47
+ from google.cloud.aiplatform_v1beta1.types import (
48
+ model_deployment_monitoring_job as gca_model_deployment_monitoring_job,
49
+ )
50
+ from google.cloud.aiplatform_v1beta1.types import nas_job
51
+ from google.cloud.aiplatform_v1beta1.types import nas_job as gca_nas_job
52
+ from google.cloud.location import locations_pb2 # type: ignore
53
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
54
+ from google.iam.v1 import policy_pb2 # type: ignore
55
+ from google.longrunning import operations_pb2 # type: ignore
56
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
57
+
58
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
59
+ gapic_version=package_version.__version__
60
+ )
61
+
62
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
63
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
64
+
65
+
66
+ class JobServiceTransport(abc.ABC):
67
+ """Abstract transport class for JobService."""
68
+
69
+ AUTH_SCOPES = (
70
+ "https://www.googleapis.com/auth/cloud-platform",
71
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
72
+ )
73
+
74
+ DEFAULT_HOST: str = "aiplatform.googleapis.com"
75
+
76
+ def __init__(
77
+ self,
78
+ *,
79
+ host: str = DEFAULT_HOST,
80
+ credentials: Optional[ga_credentials.Credentials] = None,
81
+ credentials_file: Optional[str] = None,
82
+ scopes: Optional[Sequence[str]] = None,
83
+ quota_project_id: Optional[str] = None,
84
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
85
+ always_use_jwt_access: Optional[bool] = False,
86
+ api_audience: Optional[str] = None,
87
+ **kwargs,
88
+ ) -> None:
89
+ """Instantiate the transport.
90
+
91
+ Args:
92
+ host (Optional[str]):
93
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
94
+ credentials (Optional[google.auth.credentials.Credentials]): The
95
+ authorization credentials to attach to requests. These
96
+ credentials identify the application to the service; if none
97
+ are specified, the client will attempt to ascertain the
98
+ credentials from the environment.
99
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
100
+ be loaded with :func:`google.auth.load_credentials_from_file`.
101
+ This argument is mutually exclusive with credentials. This argument will be
102
+ removed in the next major version of this library.
103
+ scopes (Optional[Sequence[str]]): A list of scopes.
104
+ quota_project_id (Optional[str]): An optional project to use for billing
105
+ and quota.
106
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
107
+ The client info used to send a user-agent string along with
108
+ API requests. If ``None``, then default info will be used.
109
+ Generally, you only need to set this if you're developing
110
+ your own client library.
111
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
112
+ be used for service account credentials.
113
+ """
114
+
115
+ # Save the scopes.
116
+ self._scopes = scopes
117
+ if not hasattr(self, "_ignore_credentials"):
118
+ self._ignore_credentials: bool = False
119
+
120
+ # If no credentials are provided, then determine the appropriate
121
+ # defaults.
122
+ if credentials and credentials_file:
123
+ raise core_exceptions.DuplicateCredentialArgs(
124
+ "'credentials_file' and 'credentials' are mutually exclusive"
125
+ )
126
+
127
+ if credentials_file is not None:
128
+ credentials, _ = google.auth.load_credentials_from_file(
129
+ credentials_file,
130
+ scopes=scopes,
131
+ quota_project_id=quota_project_id,
132
+ default_scopes=self.AUTH_SCOPES,
133
+ )
134
+ elif credentials is None and not self._ignore_credentials:
135
+ credentials, _ = google.auth.default(
136
+ scopes=scopes,
137
+ quota_project_id=quota_project_id,
138
+ default_scopes=self.AUTH_SCOPES,
139
+ )
140
+ # Don't apply audience if the credentials file passed from user.
141
+ if hasattr(credentials, "with_gdch_audience"):
142
+ credentials = credentials.with_gdch_audience(
143
+ api_audience if api_audience else host
144
+ )
145
+
146
+ # If the credentials are service account credentials, then always try to use self signed JWT.
147
+ if (
148
+ always_use_jwt_access
149
+ and isinstance(credentials, service_account.Credentials)
150
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
151
+ ):
152
+ credentials = credentials.with_always_use_jwt_access(True)
153
+
154
+ # Save the credentials.
155
+ self._credentials = credentials
156
+
157
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
158
+ if ":" not in host:
159
+ host += ":443"
160
+ self._host = host
161
+
162
+ @property
163
+ def host(self):
164
+ return self._host
165
+
166
+ def _prep_wrapped_messages(self, client_info):
167
+ # Precompute the wrapped methods.
168
+ self._wrapped_methods = {
169
+ self.create_custom_job: gapic_v1.method.wrap_method(
170
+ self.create_custom_job,
171
+ default_timeout=5.0,
172
+ client_info=client_info,
173
+ ),
174
+ self.get_custom_job: gapic_v1.method.wrap_method(
175
+ self.get_custom_job,
176
+ default_timeout=5.0,
177
+ client_info=client_info,
178
+ ),
179
+ self.list_custom_jobs: gapic_v1.method.wrap_method(
180
+ self.list_custom_jobs,
181
+ default_timeout=5.0,
182
+ client_info=client_info,
183
+ ),
184
+ self.delete_custom_job: gapic_v1.method.wrap_method(
185
+ self.delete_custom_job,
186
+ default_timeout=5.0,
187
+ client_info=client_info,
188
+ ),
189
+ self.cancel_custom_job: gapic_v1.method.wrap_method(
190
+ self.cancel_custom_job,
191
+ default_timeout=5.0,
192
+ client_info=client_info,
193
+ ),
194
+ self.create_data_labeling_job: gapic_v1.method.wrap_method(
195
+ self.create_data_labeling_job,
196
+ default_timeout=5.0,
197
+ client_info=client_info,
198
+ ),
199
+ self.get_data_labeling_job: gapic_v1.method.wrap_method(
200
+ self.get_data_labeling_job,
201
+ default_timeout=5.0,
202
+ client_info=client_info,
203
+ ),
204
+ self.list_data_labeling_jobs: gapic_v1.method.wrap_method(
205
+ self.list_data_labeling_jobs,
206
+ default_timeout=5.0,
207
+ client_info=client_info,
208
+ ),
209
+ self.delete_data_labeling_job: gapic_v1.method.wrap_method(
210
+ self.delete_data_labeling_job,
211
+ default_timeout=5.0,
212
+ client_info=client_info,
213
+ ),
214
+ self.cancel_data_labeling_job: gapic_v1.method.wrap_method(
215
+ self.cancel_data_labeling_job,
216
+ default_timeout=5.0,
217
+ client_info=client_info,
218
+ ),
219
+ self.create_hyperparameter_tuning_job: gapic_v1.method.wrap_method(
220
+ self.create_hyperparameter_tuning_job,
221
+ default_timeout=5.0,
222
+ client_info=client_info,
223
+ ),
224
+ self.get_hyperparameter_tuning_job: gapic_v1.method.wrap_method(
225
+ self.get_hyperparameter_tuning_job,
226
+ default_timeout=5.0,
227
+ client_info=client_info,
228
+ ),
229
+ self.list_hyperparameter_tuning_jobs: gapic_v1.method.wrap_method(
230
+ self.list_hyperparameter_tuning_jobs,
231
+ default_timeout=5.0,
232
+ client_info=client_info,
233
+ ),
234
+ self.delete_hyperparameter_tuning_job: gapic_v1.method.wrap_method(
235
+ self.delete_hyperparameter_tuning_job,
236
+ default_timeout=5.0,
237
+ client_info=client_info,
238
+ ),
239
+ self.cancel_hyperparameter_tuning_job: gapic_v1.method.wrap_method(
240
+ self.cancel_hyperparameter_tuning_job,
241
+ default_timeout=5.0,
242
+ client_info=client_info,
243
+ ),
244
+ self.create_nas_job: gapic_v1.method.wrap_method(
245
+ self.create_nas_job,
246
+ default_timeout=None,
247
+ client_info=client_info,
248
+ ),
249
+ self.get_nas_job: gapic_v1.method.wrap_method(
250
+ self.get_nas_job,
251
+ default_timeout=None,
252
+ client_info=client_info,
253
+ ),
254
+ self.list_nas_jobs: gapic_v1.method.wrap_method(
255
+ self.list_nas_jobs,
256
+ default_timeout=None,
257
+ client_info=client_info,
258
+ ),
259
+ self.delete_nas_job: gapic_v1.method.wrap_method(
260
+ self.delete_nas_job,
261
+ default_timeout=None,
262
+ client_info=client_info,
263
+ ),
264
+ self.cancel_nas_job: gapic_v1.method.wrap_method(
265
+ self.cancel_nas_job,
266
+ default_timeout=None,
267
+ client_info=client_info,
268
+ ),
269
+ self.get_nas_trial_detail: gapic_v1.method.wrap_method(
270
+ self.get_nas_trial_detail,
271
+ default_timeout=None,
272
+ client_info=client_info,
273
+ ),
274
+ self.list_nas_trial_details: gapic_v1.method.wrap_method(
275
+ self.list_nas_trial_details,
276
+ default_timeout=None,
277
+ client_info=client_info,
278
+ ),
279
+ self.create_batch_prediction_job: gapic_v1.method.wrap_method(
280
+ self.create_batch_prediction_job,
281
+ default_timeout=5.0,
282
+ client_info=client_info,
283
+ ),
284
+ self.get_batch_prediction_job: gapic_v1.method.wrap_method(
285
+ self.get_batch_prediction_job,
286
+ default_timeout=5.0,
287
+ client_info=client_info,
288
+ ),
289
+ self.list_batch_prediction_jobs: gapic_v1.method.wrap_method(
290
+ self.list_batch_prediction_jobs,
291
+ default_timeout=5.0,
292
+ client_info=client_info,
293
+ ),
294
+ self.delete_batch_prediction_job: gapic_v1.method.wrap_method(
295
+ self.delete_batch_prediction_job,
296
+ default_timeout=5.0,
297
+ client_info=client_info,
298
+ ),
299
+ self.cancel_batch_prediction_job: gapic_v1.method.wrap_method(
300
+ self.cancel_batch_prediction_job,
301
+ default_timeout=5.0,
302
+ client_info=client_info,
303
+ ),
304
+ self.create_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
305
+ self.create_model_deployment_monitoring_job,
306
+ default_timeout=60.0,
307
+ client_info=client_info,
308
+ ),
309
+ self.search_model_deployment_monitoring_stats_anomalies: gapic_v1.method.wrap_method(
310
+ self.search_model_deployment_monitoring_stats_anomalies,
311
+ default_timeout=5.0,
312
+ client_info=client_info,
313
+ ),
314
+ self.get_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
315
+ self.get_model_deployment_monitoring_job,
316
+ default_timeout=5.0,
317
+ client_info=client_info,
318
+ ),
319
+ self.list_model_deployment_monitoring_jobs: gapic_v1.method.wrap_method(
320
+ self.list_model_deployment_monitoring_jobs,
321
+ default_timeout=5.0,
322
+ client_info=client_info,
323
+ ),
324
+ self.update_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
325
+ self.update_model_deployment_monitoring_job,
326
+ default_timeout=5.0,
327
+ client_info=client_info,
328
+ ),
329
+ self.delete_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
330
+ self.delete_model_deployment_monitoring_job,
331
+ default_timeout=5.0,
332
+ client_info=client_info,
333
+ ),
334
+ self.pause_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
335
+ self.pause_model_deployment_monitoring_job,
336
+ default_timeout=5.0,
337
+ client_info=client_info,
338
+ ),
339
+ self.resume_model_deployment_monitoring_job: gapic_v1.method.wrap_method(
340
+ self.resume_model_deployment_monitoring_job,
341
+ default_timeout=5.0,
342
+ client_info=client_info,
343
+ ),
344
+ self.get_location: gapic_v1.method.wrap_method(
345
+ self.get_location,
346
+ default_timeout=None,
347
+ client_info=client_info,
348
+ ),
349
+ self.list_locations: gapic_v1.method.wrap_method(
350
+ self.list_locations,
351
+ default_timeout=None,
352
+ client_info=client_info,
353
+ ),
354
+ self.get_iam_policy: gapic_v1.method.wrap_method(
355
+ self.get_iam_policy,
356
+ default_timeout=None,
357
+ client_info=client_info,
358
+ ),
359
+ self.set_iam_policy: gapic_v1.method.wrap_method(
360
+ self.set_iam_policy,
361
+ default_timeout=None,
362
+ client_info=client_info,
363
+ ),
364
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
365
+ self.test_iam_permissions,
366
+ default_timeout=None,
367
+ client_info=client_info,
368
+ ),
369
+ self.cancel_operation: gapic_v1.method.wrap_method(
370
+ self.cancel_operation,
371
+ default_timeout=None,
372
+ client_info=client_info,
373
+ ),
374
+ self.delete_operation: gapic_v1.method.wrap_method(
375
+ self.delete_operation,
376
+ default_timeout=None,
377
+ client_info=client_info,
378
+ ),
379
+ self.get_operation: gapic_v1.method.wrap_method(
380
+ self.get_operation,
381
+ default_timeout=None,
382
+ client_info=client_info,
383
+ ),
384
+ self.list_operations: gapic_v1.method.wrap_method(
385
+ self.list_operations,
386
+ default_timeout=None,
387
+ client_info=client_info,
388
+ ),
389
+ self.wait_operation: gapic_v1.method.wrap_method(
390
+ self.wait_operation,
391
+ default_timeout=None,
392
+ client_info=client_info,
393
+ ),
394
+ }
395
+
396
+ def close(self):
397
+ """Closes resources associated with the transport.
398
+
399
+ .. warning::
400
+ Only call this method if the transport is NOT shared
401
+ with other clients - this may cause errors in other clients!
402
+ """
403
+ raise NotImplementedError()
404
+
405
+ @property
406
+ def operations_client(self):
407
+ """Return the client designed to process long-running operations."""
408
+ raise NotImplementedError()
409
+
410
+ @property
411
+ def create_custom_job(
412
+ self,
413
+ ) -> Callable[
414
+ [job_service.CreateCustomJobRequest],
415
+ Union[gca_custom_job.CustomJob, Awaitable[gca_custom_job.CustomJob]],
416
+ ]:
417
+ raise NotImplementedError()
418
+
419
+ @property
420
+ def get_custom_job(
421
+ self,
422
+ ) -> Callable[
423
+ [job_service.GetCustomJobRequest],
424
+ Union[custom_job.CustomJob, Awaitable[custom_job.CustomJob]],
425
+ ]:
426
+ raise NotImplementedError()
427
+
428
+ @property
429
+ def list_custom_jobs(
430
+ self,
431
+ ) -> Callable[
432
+ [job_service.ListCustomJobsRequest],
433
+ Union[
434
+ job_service.ListCustomJobsResponse,
435
+ Awaitable[job_service.ListCustomJobsResponse],
436
+ ],
437
+ ]:
438
+ raise NotImplementedError()
439
+
440
+ @property
441
+ def delete_custom_job(
442
+ self,
443
+ ) -> Callable[
444
+ [job_service.DeleteCustomJobRequest],
445
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
446
+ ]:
447
+ raise NotImplementedError()
448
+
449
+ @property
450
+ def cancel_custom_job(
451
+ self,
452
+ ) -> Callable[
453
+ [job_service.CancelCustomJobRequest],
454
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
455
+ ]:
456
+ raise NotImplementedError()
457
+
458
+ @property
459
+ def create_data_labeling_job(
460
+ self,
461
+ ) -> Callable[
462
+ [job_service.CreateDataLabelingJobRequest],
463
+ Union[
464
+ gca_data_labeling_job.DataLabelingJob,
465
+ Awaitable[gca_data_labeling_job.DataLabelingJob],
466
+ ],
467
+ ]:
468
+ raise NotImplementedError()
469
+
470
+ @property
471
+ def get_data_labeling_job(
472
+ self,
473
+ ) -> Callable[
474
+ [job_service.GetDataLabelingJobRequest],
475
+ Union[
476
+ data_labeling_job.DataLabelingJob,
477
+ Awaitable[data_labeling_job.DataLabelingJob],
478
+ ],
479
+ ]:
480
+ raise NotImplementedError()
481
+
482
+ @property
483
+ def list_data_labeling_jobs(
484
+ self,
485
+ ) -> Callable[
486
+ [job_service.ListDataLabelingJobsRequest],
487
+ Union[
488
+ job_service.ListDataLabelingJobsResponse,
489
+ Awaitable[job_service.ListDataLabelingJobsResponse],
490
+ ],
491
+ ]:
492
+ raise NotImplementedError()
493
+
494
+ @property
495
+ def delete_data_labeling_job(
496
+ self,
497
+ ) -> Callable[
498
+ [job_service.DeleteDataLabelingJobRequest],
499
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
500
+ ]:
501
+ raise NotImplementedError()
502
+
503
+ @property
504
+ def cancel_data_labeling_job(
505
+ self,
506
+ ) -> Callable[
507
+ [job_service.CancelDataLabelingJobRequest],
508
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
509
+ ]:
510
+ raise NotImplementedError()
511
+
512
+ @property
513
+ def create_hyperparameter_tuning_job(
514
+ self,
515
+ ) -> Callable[
516
+ [job_service.CreateHyperparameterTuningJobRequest],
517
+ Union[
518
+ gca_hyperparameter_tuning_job.HyperparameterTuningJob,
519
+ Awaitable[gca_hyperparameter_tuning_job.HyperparameterTuningJob],
520
+ ],
521
+ ]:
522
+ raise NotImplementedError()
523
+
524
+ @property
525
+ def get_hyperparameter_tuning_job(
526
+ self,
527
+ ) -> Callable[
528
+ [job_service.GetHyperparameterTuningJobRequest],
529
+ Union[
530
+ hyperparameter_tuning_job.HyperparameterTuningJob,
531
+ Awaitable[hyperparameter_tuning_job.HyperparameterTuningJob],
532
+ ],
533
+ ]:
534
+ raise NotImplementedError()
535
+
536
+ @property
537
+ def list_hyperparameter_tuning_jobs(
538
+ self,
539
+ ) -> Callable[
540
+ [job_service.ListHyperparameterTuningJobsRequest],
541
+ Union[
542
+ job_service.ListHyperparameterTuningJobsResponse,
543
+ Awaitable[job_service.ListHyperparameterTuningJobsResponse],
544
+ ],
545
+ ]:
546
+ raise NotImplementedError()
547
+
548
+ @property
549
+ def delete_hyperparameter_tuning_job(
550
+ self,
551
+ ) -> Callable[
552
+ [job_service.DeleteHyperparameterTuningJobRequest],
553
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
554
+ ]:
555
+ raise NotImplementedError()
556
+
557
+ @property
558
+ def cancel_hyperparameter_tuning_job(
559
+ self,
560
+ ) -> Callable[
561
+ [job_service.CancelHyperparameterTuningJobRequest],
562
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
563
+ ]:
564
+ raise NotImplementedError()
565
+
566
+ @property
567
+ def create_nas_job(
568
+ self,
569
+ ) -> Callable[
570
+ [job_service.CreateNasJobRequest],
571
+ Union[gca_nas_job.NasJob, Awaitable[gca_nas_job.NasJob]],
572
+ ]:
573
+ raise NotImplementedError()
574
+
575
+ @property
576
+ def get_nas_job(
577
+ self,
578
+ ) -> Callable[
579
+ [job_service.GetNasJobRequest], Union[nas_job.NasJob, Awaitable[nas_job.NasJob]]
580
+ ]:
581
+ raise NotImplementedError()
582
+
583
+ @property
584
+ def list_nas_jobs(
585
+ self,
586
+ ) -> Callable[
587
+ [job_service.ListNasJobsRequest],
588
+ Union[
589
+ job_service.ListNasJobsResponse, Awaitable[job_service.ListNasJobsResponse]
590
+ ],
591
+ ]:
592
+ raise NotImplementedError()
593
+
594
+ @property
595
+ def delete_nas_job(
596
+ self,
597
+ ) -> Callable[
598
+ [job_service.DeleteNasJobRequest],
599
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
600
+ ]:
601
+ raise NotImplementedError()
602
+
603
+ @property
604
+ def cancel_nas_job(
605
+ self,
606
+ ) -> Callable[
607
+ [job_service.CancelNasJobRequest],
608
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
609
+ ]:
610
+ raise NotImplementedError()
611
+
612
+ @property
613
+ def get_nas_trial_detail(
614
+ self,
615
+ ) -> Callable[
616
+ [job_service.GetNasTrialDetailRequest],
617
+ Union[nas_job.NasTrialDetail, Awaitable[nas_job.NasTrialDetail]],
618
+ ]:
619
+ raise NotImplementedError()
620
+
621
+ @property
622
+ def list_nas_trial_details(
623
+ self,
624
+ ) -> Callable[
625
+ [job_service.ListNasTrialDetailsRequest],
626
+ Union[
627
+ job_service.ListNasTrialDetailsResponse,
628
+ Awaitable[job_service.ListNasTrialDetailsResponse],
629
+ ],
630
+ ]:
631
+ raise NotImplementedError()
632
+
633
+ @property
634
+ def create_batch_prediction_job(
635
+ self,
636
+ ) -> Callable[
637
+ [job_service.CreateBatchPredictionJobRequest],
638
+ Union[
639
+ gca_batch_prediction_job.BatchPredictionJob,
640
+ Awaitable[gca_batch_prediction_job.BatchPredictionJob],
641
+ ],
642
+ ]:
643
+ raise NotImplementedError()
644
+
645
+ @property
646
+ def get_batch_prediction_job(
647
+ self,
648
+ ) -> Callable[
649
+ [job_service.GetBatchPredictionJobRequest],
650
+ Union[
651
+ batch_prediction_job.BatchPredictionJob,
652
+ Awaitable[batch_prediction_job.BatchPredictionJob],
653
+ ],
654
+ ]:
655
+ raise NotImplementedError()
656
+
657
+ @property
658
+ def list_batch_prediction_jobs(
659
+ self,
660
+ ) -> Callable[
661
+ [job_service.ListBatchPredictionJobsRequest],
662
+ Union[
663
+ job_service.ListBatchPredictionJobsResponse,
664
+ Awaitable[job_service.ListBatchPredictionJobsResponse],
665
+ ],
666
+ ]:
667
+ raise NotImplementedError()
668
+
669
+ @property
670
+ def delete_batch_prediction_job(
671
+ self,
672
+ ) -> Callable[
673
+ [job_service.DeleteBatchPredictionJobRequest],
674
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
675
+ ]:
676
+ raise NotImplementedError()
677
+
678
+ @property
679
+ def cancel_batch_prediction_job(
680
+ self,
681
+ ) -> Callable[
682
+ [job_service.CancelBatchPredictionJobRequest],
683
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
684
+ ]:
685
+ raise NotImplementedError()
686
+
687
+ @property
688
+ def create_model_deployment_monitoring_job(
689
+ self,
690
+ ) -> Callable[
691
+ [job_service.CreateModelDeploymentMonitoringJobRequest],
692
+ Union[
693
+ gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob,
694
+ Awaitable[gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob],
695
+ ],
696
+ ]:
697
+ raise NotImplementedError()
698
+
699
+ @property
700
+ def search_model_deployment_monitoring_stats_anomalies(
701
+ self,
702
+ ) -> Callable[
703
+ [job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest],
704
+ Union[
705
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse,
706
+ Awaitable[
707
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse
708
+ ],
709
+ ],
710
+ ]:
711
+ raise NotImplementedError()
712
+
713
+ @property
714
+ def get_model_deployment_monitoring_job(
715
+ self,
716
+ ) -> Callable[
717
+ [job_service.GetModelDeploymentMonitoringJobRequest],
718
+ Union[
719
+ model_deployment_monitoring_job.ModelDeploymentMonitoringJob,
720
+ Awaitable[model_deployment_monitoring_job.ModelDeploymentMonitoringJob],
721
+ ],
722
+ ]:
723
+ raise NotImplementedError()
724
+
725
+ @property
726
+ def list_model_deployment_monitoring_jobs(
727
+ self,
728
+ ) -> Callable[
729
+ [job_service.ListModelDeploymentMonitoringJobsRequest],
730
+ Union[
731
+ job_service.ListModelDeploymentMonitoringJobsResponse,
732
+ Awaitable[job_service.ListModelDeploymentMonitoringJobsResponse],
733
+ ],
734
+ ]:
735
+ raise NotImplementedError()
736
+
737
+ @property
738
+ def update_model_deployment_monitoring_job(
739
+ self,
740
+ ) -> Callable[
741
+ [job_service.UpdateModelDeploymentMonitoringJobRequest],
742
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
743
+ ]:
744
+ raise NotImplementedError()
745
+
746
+ @property
747
+ def delete_model_deployment_monitoring_job(
748
+ self,
749
+ ) -> Callable[
750
+ [job_service.DeleteModelDeploymentMonitoringJobRequest],
751
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
752
+ ]:
753
+ raise NotImplementedError()
754
+
755
+ @property
756
+ def pause_model_deployment_monitoring_job(
757
+ self,
758
+ ) -> Callable[
759
+ [job_service.PauseModelDeploymentMonitoringJobRequest],
760
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
761
+ ]:
762
+ raise NotImplementedError()
763
+
764
+ @property
765
+ def resume_model_deployment_monitoring_job(
766
+ self,
767
+ ) -> Callable[
768
+ [job_service.ResumeModelDeploymentMonitoringJobRequest],
769
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
770
+ ]:
771
+ raise NotImplementedError()
772
+
773
+ @property
774
+ def list_operations(
775
+ self,
776
+ ) -> Callable[
777
+ [operations_pb2.ListOperationsRequest],
778
+ Union[
779
+ operations_pb2.ListOperationsResponse,
780
+ Awaitable[operations_pb2.ListOperationsResponse],
781
+ ],
782
+ ]:
783
+ raise NotImplementedError()
784
+
785
+ @property
786
+ def get_operation(
787
+ self,
788
+ ) -> Callable[
789
+ [operations_pb2.GetOperationRequest],
790
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
791
+ ]:
792
+ raise NotImplementedError()
793
+
794
+ @property
795
+ def cancel_operation(
796
+ self,
797
+ ) -> Callable[
798
+ [operations_pb2.CancelOperationRequest],
799
+ None,
800
+ ]:
801
+ raise NotImplementedError()
802
+
803
+ @property
804
+ def delete_operation(
805
+ self,
806
+ ) -> Callable[
807
+ [operations_pb2.DeleteOperationRequest],
808
+ None,
809
+ ]:
810
+ raise NotImplementedError()
811
+
812
+ @property
813
+ def wait_operation(
814
+ self,
815
+ ) -> Callable[
816
+ [operations_pb2.WaitOperationRequest],
817
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
818
+ ]:
819
+ raise NotImplementedError()
820
+
821
+ @property
822
+ def set_iam_policy(
823
+ self,
824
+ ) -> Callable[
825
+ [iam_policy_pb2.SetIamPolicyRequest],
826
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
827
+ ]:
828
+ raise NotImplementedError()
829
+
830
+ @property
831
+ def get_iam_policy(
832
+ self,
833
+ ) -> Callable[
834
+ [iam_policy_pb2.GetIamPolicyRequest],
835
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
836
+ ]:
837
+ raise NotImplementedError()
838
+
839
+ @property
840
+ def test_iam_permissions(
841
+ self,
842
+ ) -> Callable[
843
+ [iam_policy_pb2.TestIamPermissionsRequest],
844
+ Union[
845
+ iam_policy_pb2.TestIamPermissionsResponse,
846
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
847
+ ],
848
+ ]:
849
+ raise NotImplementedError()
850
+
851
+ @property
852
+ def get_location(
853
+ self,
854
+ ) -> Callable[
855
+ [locations_pb2.GetLocationRequest],
856
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
857
+ ]:
858
+ raise NotImplementedError()
859
+
860
+ @property
861
+ def list_locations(
862
+ self,
863
+ ) -> Callable[
864
+ [locations_pb2.ListLocationsRequest],
865
+ Union[
866
+ locations_pb2.ListLocationsResponse,
867
+ Awaitable[locations_pb2.ListLocationsResponse],
868
+ ],
869
+ ]:
870
+ raise NotImplementedError()
871
+
872
+ @property
873
+ def kind(self) -> str:
874
+ raise NotImplementedError()
875
+
876
+
877
+ __all__ = ("JobServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py ADDED
@@ -0,0 +1,1649 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ from google.api_core import grpc_helpers
23
+ from google.api_core import operations_v1
24
+ from google.api_core import gapic_v1
25
+ import google.auth # type: ignore
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.protobuf.json_format import MessageToJson
29
+ import google.protobuf.message
30
+
31
+ import grpc # type: ignore
32
+ import proto # type: ignore
33
+
34
+ from google.cloud.aiplatform_v1beta1.types import batch_prediction_job
35
+ from google.cloud.aiplatform_v1beta1.types import (
36
+ batch_prediction_job as gca_batch_prediction_job,
37
+ )
38
+ from google.cloud.aiplatform_v1beta1.types import custom_job
39
+ from google.cloud.aiplatform_v1beta1.types import custom_job as gca_custom_job
40
+ from google.cloud.aiplatform_v1beta1.types import data_labeling_job
41
+ from google.cloud.aiplatform_v1beta1.types import (
42
+ data_labeling_job as gca_data_labeling_job,
43
+ )
44
+ from google.cloud.aiplatform_v1beta1.types import hyperparameter_tuning_job
45
+ from google.cloud.aiplatform_v1beta1.types import (
46
+ hyperparameter_tuning_job as gca_hyperparameter_tuning_job,
47
+ )
48
+ from google.cloud.aiplatform_v1beta1.types import job_service
49
+ from google.cloud.aiplatform_v1beta1.types import model_deployment_monitoring_job
50
+ from google.cloud.aiplatform_v1beta1.types import (
51
+ model_deployment_monitoring_job as gca_model_deployment_monitoring_job,
52
+ )
53
+ from google.cloud.aiplatform_v1beta1.types import nas_job
54
+ from google.cloud.aiplatform_v1beta1.types import nas_job as gca_nas_job
55
+ from google.cloud.location import locations_pb2 # type: ignore
56
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
57
+ from google.iam.v1 import policy_pb2 # type: ignore
58
+ from google.longrunning import operations_pb2 # type: ignore
59
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
60
+ from .base import JobServiceTransport, DEFAULT_CLIENT_INFO
61
+
62
+ try:
63
+ from google.api_core import client_logging # type: ignore
64
+
65
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
66
+ except ImportError: # pragma: NO COVER
67
+ CLIENT_LOGGING_SUPPORTED = False
68
+
69
+ _LOGGER = std_logging.getLogger(__name__)
70
+
71
+
72
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
73
+ def intercept_unary_unary(self, continuation, client_call_details, request):
74
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
75
+ std_logging.DEBUG
76
+ )
77
+ if logging_enabled: # pragma: NO COVER
78
+ request_metadata = client_call_details.metadata
79
+ if isinstance(request, proto.Message):
80
+ request_payload = type(request).to_json(request)
81
+ elif isinstance(request, google.protobuf.message.Message):
82
+ request_payload = MessageToJson(request)
83
+ else:
84
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
85
+
86
+ request_metadata = {
87
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
88
+ for key, value in request_metadata
89
+ }
90
+ grpc_request = {
91
+ "payload": request_payload,
92
+ "requestMethod": "grpc",
93
+ "metadata": dict(request_metadata),
94
+ }
95
+ _LOGGER.debug(
96
+ f"Sending request for {client_call_details.method}",
97
+ extra={
98
+ "serviceName": "google.cloud.aiplatform.v1beta1.JobService",
99
+ "rpcName": str(client_call_details.method),
100
+ "request": grpc_request,
101
+ "metadata": grpc_request["metadata"],
102
+ },
103
+ )
104
+ response = continuation(client_call_details, request)
105
+ if logging_enabled: # pragma: NO COVER
106
+ response_metadata = response.trailing_metadata()
107
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
108
+ metadata = (
109
+ dict([(k, str(v)) for k, v in response_metadata])
110
+ if response_metadata
111
+ else None
112
+ )
113
+ result = response.result()
114
+ if isinstance(result, proto.Message):
115
+ response_payload = type(result).to_json(result)
116
+ elif isinstance(result, google.protobuf.message.Message):
117
+ response_payload = MessageToJson(result)
118
+ else:
119
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
120
+ grpc_response = {
121
+ "payload": response_payload,
122
+ "metadata": metadata,
123
+ "status": "OK",
124
+ }
125
+ _LOGGER.debug(
126
+ f"Received response for {client_call_details.method}.",
127
+ extra={
128
+ "serviceName": "google.cloud.aiplatform.v1beta1.JobService",
129
+ "rpcName": client_call_details.method,
130
+ "response": grpc_response,
131
+ "metadata": grpc_response["metadata"],
132
+ },
133
+ )
134
+ return response
135
+
136
+
137
+ class JobServiceGrpcTransport(JobServiceTransport):
138
+ """gRPC backend transport for JobService.
139
+
140
+ A service for creating and managing Vertex AI's jobs.
141
+
142
+ This class defines the same methods as the primary client, so the
143
+ primary client can load the underlying transport implementation
144
+ and call it.
145
+
146
+ It sends protocol buffers over the wire using gRPC (which is built on
147
+ top of HTTP/2); the ``grpcio`` package must be installed.
148
+ """
149
+
150
+ _stubs: Dict[str, Callable]
151
+
152
+ def __init__(
153
+ self,
154
+ *,
155
+ host: str = "aiplatform.googleapis.com",
156
+ credentials: Optional[ga_credentials.Credentials] = None,
157
+ credentials_file: Optional[str] = None,
158
+ scopes: Optional[Sequence[str]] = None,
159
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
160
+ api_mtls_endpoint: Optional[str] = None,
161
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
162
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
163
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
164
+ quota_project_id: Optional[str] = None,
165
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
166
+ always_use_jwt_access: Optional[bool] = False,
167
+ api_audience: Optional[str] = None,
168
+ ) -> None:
169
+ """Instantiate the transport.
170
+
171
+ Args:
172
+ host (Optional[str]):
173
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
174
+ credentials (Optional[google.auth.credentials.Credentials]): The
175
+ authorization credentials to attach to requests. These
176
+ credentials identify the application to the service; if none
177
+ are specified, the client will attempt to ascertain the
178
+ credentials from the environment.
179
+ This argument is ignored if a ``channel`` instance is provided.
180
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
181
+ be loaded with :func:`google.auth.load_credentials_from_file`.
182
+ This argument is ignored if a ``channel`` instance is provided.
183
+ This argument will be removed in the next major version of this library.
184
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
185
+ ignored if a ``channel`` instance is provided.
186
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
187
+ A ``Channel`` instance through which to make calls, or a Callable
188
+ that constructs and returns one. If set to None, ``self.create_channel``
189
+ is used to create the channel. If a Callable is given, it will be called
190
+ with the same arguments as used in ``self.create_channel``.
191
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
192
+ If provided, it overrides the ``host`` argument and tries to create
193
+ a mutual TLS channel with client SSL credentials from
194
+ ``client_cert_source`` or application default SSL credentials.
195
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
196
+ Deprecated. A callback to provide client SSL certificate bytes and
197
+ private key bytes, both in PEM format. It is ignored if
198
+ ``api_mtls_endpoint`` is None.
199
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
200
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
201
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
202
+ A callback to provide client certificate bytes and private key bytes,
203
+ both in PEM format. It is used to configure a mutual TLS channel. It is
204
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
205
+ quota_project_id (Optional[str]): An optional project to use for billing
206
+ and quota.
207
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
208
+ The client info used to send a user-agent string along with
209
+ API requests. If ``None``, then default info will be used.
210
+ Generally, you only need to set this if you're developing
211
+ your own client library.
212
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
213
+ be used for service account credentials.
214
+
215
+ Raises:
216
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
217
+ creation failed for any reason.
218
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
219
+ and ``credentials_file`` are passed.
220
+ """
221
+ self._grpc_channel = None
222
+ self._ssl_channel_credentials = ssl_channel_credentials
223
+ self._stubs: Dict[str, Callable] = {}
224
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
225
+
226
+ if api_mtls_endpoint:
227
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
228
+ if client_cert_source:
229
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
230
+
231
+ if isinstance(channel, grpc.Channel):
232
+ # Ignore credentials if a channel was passed.
233
+ credentials = None
234
+ self._ignore_credentials = True
235
+ # If a channel was explicitly provided, set it.
236
+ self._grpc_channel = channel
237
+ self._ssl_channel_credentials = None
238
+
239
+ else:
240
+ if api_mtls_endpoint:
241
+ host = api_mtls_endpoint
242
+
243
+ # Create SSL credentials with client_cert_source or application
244
+ # default SSL credentials.
245
+ if client_cert_source:
246
+ cert, key = client_cert_source()
247
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
248
+ certificate_chain=cert, private_key=key
249
+ )
250
+ else:
251
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
252
+
253
+ else:
254
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
255
+ cert, key = client_cert_source_for_mtls()
256
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
257
+ certificate_chain=cert, private_key=key
258
+ )
259
+
260
+ # The base transport sets the host, credentials and scopes
261
+ super().__init__(
262
+ host=host,
263
+ credentials=credentials,
264
+ credentials_file=credentials_file,
265
+ scopes=scopes,
266
+ quota_project_id=quota_project_id,
267
+ client_info=client_info,
268
+ always_use_jwt_access=always_use_jwt_access,
269
+ api_audience=api_audience,
270
+ )
271
+
272
+ if not self._grpc_channel:
273
+ # initialize with the provided callable or the default channel
274
+ channel_init = channel or type(self).create_channel
275
+ self._grpc_channel = channel_init(
276
+ self._host,
277
+ # use the credentials which are saved
278
+ credentials=self._credentials,
279
+ # Set ``credentials_file`` to ``None`` here as
280
+ # the credentials that we saved earlier should be used.
281
+ credentials_file=None,
282
+ scopes=self._scopes,
283
+ ssl_credentials=self._ssl_channel_credentials,
284
+ quota_project_id=quota_project_id,
285
+ options=[
286
+ ("grpc.max_send_message_length", -1),
287
+ ("grpc.max_receive_message_length", -1),
288
+ ],
289
+ )
290
+
291
+ self._interceptor = _LoggingClientInterceptor()
292
+ self._logged_channel = grpc.intercept_channel(
293
+ self._grpc_channel, self._interceptor
294
+ )
295
+
296
+ # Wrap messages. This must be done after self._logged_channel exists
297
+ self._prep_wrapped_messages(client_info)
298
+
299
+ @classmethod
300
+ def create_channel(
301
+ cls,
302
+ host: str = "aiplatform.googleapis.com",
303
+ credentials: Optional[ga_credentials.Credentials] = None,
304
+ credentials_file: Optional[str] = None,
305
+ scopes: Optional[Sequence[str]] = None,
306
+ quota_project_id: Optional[str] = None,
307
+ **kwargs,
308
+ ) -> grpc.Channel:
309
+ """Create and return a gRPC channel object.
310
+ Args:
311
+ host (Optional[str]): The host for the channel to use.
312
+ credentials (Optional[~.Credentials]): The
313
+ authorization credentials to attach to requests. These
314
+ credentials identify this application to the service. If
315
+ none are specified, the client will attempt to ascertain
316
+ the credentials from the environment.
317
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
318
+ be loaded with :func:`google.auth.load_credentials_from_file`.
319
+ This argument is mutually exclusive with credentials. This argument will be
320
+ removed in the next major version of this library.
321
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
322
+ service. These are only used when credentials are not specified and
323
+ are passed to :func:`google.auth.default`.
324
+ quota_project_id (Optional[str]): An optional project to use for billing
325
+ and quota.
326
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
327
+ channel creation.
328
+ Returns:
329
+ grpc.Channel: A gRPC channel object.
330
+
331
+ Raises:
332
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
333
+ and ``credentials_file`` are passed.
334
+ """
335
+
336
+ return grpc_helpers.create_channel(
337
+ host,
338
+ credentials=credentials,
339
+ credentials_file=credentials_file,
340
+ quota_project_id=quota_project_id,
341
+ default_scopes=cls.AUTH_SCOPES,
342
+ scopes=scopes,
343
+ default_host=cls.DEFAULT_HOST,
344
+ **kwargs,
345
+ )
346
+
347
+ @property
348
+ def grpc_channel(self) -> grpc.Channel:
349
+ """Return the channel designed to connect to this service."""
350
+ return self._grpc_channel
351
+
352
+ @property
353
+ def operations_client(self) -> operations_v1.OperationsClient:
354
+ """Create the client designed to process long-running operations.
355
+
356
+ This property caches on the instance; repeated calls return the same
357
+ client.
358
+ """
359
+ # Quick check: Only create a new client if we do not already have one.
360
+ if self._operations_client is None:
361
+ self._operations_client = operations_v1.OperationsClient(
362
+ self._logged_channel
363
+ )
364
+
365
+ # Return the client from cache.
366
+ return self._operations_client
367
+
368
+ @property
369
+ def create_custom_job(
370
+ self,
371
+ ) -> Callable[[job_service.CreateCustomJobRequest], gca_custom_job.CustomJob]:
372
+ r"""Return a callable for the create custom job method over gRPC.
373
+
374
+ Creates a CustomJob. A created CustomJob right away
375
+ will be attempted to be run.
376
+
377
+ Returns:
378
+ Callable[[~.CreateCustomJobRequest],
379
+ ~.CustomJob]:
380
+ A function that, when called, will call the underlying RPC
381
+ on the server.
382
+ """
383
+ # Generate a "stub function" on-the-fly which will actually make
384
+ # the request.
385
+ # gRPC handles serialization and deserialization, so we just need
386
+ # to pass in the functions for each.
387
+ if "create_custom_job" not in self._stubs:
388
+ self._stubs["create_custom_job"] = self._logged_channel.unary_unary(
389
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateCustomJob",
390
+ request_serializer=job_service.CreateCustomJobRequest.serialize,
391
+ response_deserializer=gca_custom_job.CustomJob.deserialize,
392
+ )
393
+ return self._stubs["create_custom_job"]
394
+
395
+ @property
396
+ def get_custom_job(
397
+ self,
398
+ ) -> Callable[[job_service.GetCustomJobRequest], custom_job.CustomJob]:
399
+ r"""Return a callable for the get custom job method over gRPC.
400
+
401
+ Gets a CustomJob.
402
+
403
+ Returns:
404
+ Callable[[~.GetCustomJobRequest],
405
+ ~.CustomJob]:
406
+ A function that, when called, will call the underlying RPC
407
+ on the server.
408
+ """
409
+ # Generate a "stub function" on-the-fly which will actually make
410
+ # the request.
411
+ # gRPC handles serialization and deserialization, so we just need
412
+ # to pass in the functions for each.
413
+ if "get_custom_job" not in self._stubs:
414
+ self._stubs["get_custom_job"] = self._logged_channel.unary_unary(
415
+ "/google.cloud.aiplatform.v1beta1.JobService/GetCustomJob",
416
+ request_serializer=job_service.GetCustomJobRequest.serialize,
417
+ response_deserializer=custom_job.CustomJob.deserialize,
418
+ )
419
+ return self._stubs["get_custom_job"]
420
+
421
+ @property
422
+ def list_custom_jobs(
423
+ self,
424
+ ) -> Callable[
425
+ [job_service.ListCustomJobsRequest], job_service.ListCustomJobsResponse
426
+ ]:
427
+ r"""Return a callable for the list custom jobs method over gRPC.
428
+
429
+ Lists CustomJobs in a Location.
430
+
431
+ Returns:
432
+ Callable[[~.ListCustomJobsRequest],
433
+ ~.ListCustomJobsResponse]:
434
+ A function that, when called, will call the underlying RPC
435
+ on the server.
436
+ """
437
+ # Generate a "stub function" on-the-fly which will actually make
438
+ # the request.
439
+ # gRPC handles serialization and deserialization, so we just need
440
+ # to pass in the functions for each.
441
+ if "list_custom_jobs" not in self._stubs:
442
+ self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary(
443
+ "/google.cloud.aiplatform.v1beta1.JobService/ListCustomJobs",
444
+ request_serializer=job_service.ListCustomJobsRequest.serialize,
445
+ response_deserializer=job_service.ListCustomJobsResponse.deserialize,
446
+ )
447
+ return self._stubs["list_custom_jobs"]
448
+
449
+ @property
450
+ def delete_custom_job(
451
+ self,
452
+ ) -> Callable[[job_service.DeleteCustomJobRequest], operations_pb2.Operation]:
453
+ r"""Return a callable for the delete custom job method over gRPC.
454
+
455
+ Deletes a CustomJob.
456
+
457
+ Returns:
458
+ Callable[[~.DeleteCustomJobRequest],
459
+ ~.Operation]:
460
+ A function that, when called, will call the underlying RPC
461
+ on the server.
462
+ """
463
+ # Generate a "stub function" on-the-fly which will actually make
464
+ # the request.
465
+ # gRPC handles serialization and deserialization, so we just need
466
+ # to pass in the functions for each.
467
+ if "delete_custom_job" not in self._stubs:
468
+ self._stubs["delete_custom_job"] = self._logged_channel.unary_unary(
469
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteCustomJob",
470
+ request_serializer=job_service.DeleteCustomJobRequest.serialize,
471
+ response_deserializer=operations_pb2.Operation.FromString,
472
+ )
473
+ return self._stubs["delete_custom_job"]
474
+
475
+ @property
476
+ def cancel_custom_job(
477
+ self,
478
+ ) -> Callable[[job_service.CancelCustomJobRequest], empty_pb2.Empty]:
479
+ r"""Return a callable for the cancel custom job method over gRPC.
480
+
481
+ Cancels a CustomJob. Starts asynchronous cancellation on the
482
+ CustomJob. The server makes a best effort to cancel the job, but
483
+ success is not guaranteed. Clients can use
484
+ [JobService.GetCustomJob][google.cloud.aiplatform.v1beta1.JobService.GetCustomJob]
485
+ or other methods to check whether the cancellation succeeded or
486
+ whether the job completed despite cancellation. On successful
487
+ cancellation, the CustomJob is not deleted; instead it becomes a
488
+ job with a
489
+ [CustomJob.error][google.cloud.aiplatform.v1beta1.CustomJob.error]
490
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
491
+ 1, corresponding to ``Code.CANCELLED``, and
492
+ [CustomJob.state][google.cloud.aiplatform.v1beta1.CustomJob.state]
493
+ is set to ``CANCELLED``.
494
+
495
+ Returns:
496
+ Callable[[~.CancelCustomJobRequest],
497
+ ~.Empty]:
498
+ A function that, when called, will call the underlying RPC
499
+ on the server.
500
+ """
501
+ # Generate a "stub function" on-the-fly which will actually make
502
+ # the request.
503
+ # gRPC handles serialization and deserialization, so we just need
504
+ # to pass in the functions for each.
505
+ if "cancel_custom_job" not in self._stubs:
506
+ self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary(
507
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelCustomJob",
508
+ request_serializer=job_service.CancelCustomJobRequest.serialize,
509
+ response_deserializer=empty_pb2.Empty.FromString,
510
+ )
511
+ return self._stubs["cancel_custom_job"]
512
+
513
+ @property
514
+ def create_data_labeling_job(
515
+ self,
516
+ ) -> Callable[
517
+ [job_service.CreateDataLabelingJobRequest],
518
+ gca_data_labeling_job.DataLabelingJob,
519
+ ]:
520
+ r"""Return a callable for the create data labeling job method over gRPC.
521
+
522
+ Creates a DataLabelingJob.
523
+
524
+ Returns:
525
+ Callable[[~.CreateDataLabelingJobRequest],
526
+ ~.DataLabelingJob]:
527
+ A function that, when called, will call the underlying RPC
528
+ on the server.
529
+ """
530
+ # Generate a "stub function" on-the-fly which will actually make
531
+ # the request.
532
+ # gRPC handles serialization and deserialization, so we just need
533
+ # to pass in the functions for each.
534
+ if "create_data_labeling_job" not in self._stubs:
535
+ self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary(
536
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateDataLabelingJob",
537
+ request_serializer=job_service.CreateDataLabelingJobRequest.serialize,
538
+ response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize,
539
+ )
540
+ return self._stubs["create_data_labeling_job"]
541
+
542
+ @property
543
+ def get_data_labeling_job(
544
+ self,
545
+ ) -> Callable[
546
+ [job_service.GetDataLabelingJobRequest], data_labeling_job.DataLabelingJob
547
+ ]:
548
+ r"""Return a callable for the get data labeling job method over gRPC.
549
+
550
+ Gets a DataLabelingJob.
551
+
552
+ Returns:
553
+ Callable[[~.GetDataLabelingJobRequest],
554
+ ~.DataLabelingJob]:
555
+ A function that, when called, will call the underlying RPC
556
+ on the server.
557
+ """
558
+ # Generate a "stub function" on-the-fly which will actually make
559
+ # the request.
560
+ # gRPC handles serialization and deserialization, so we just need
561
+ # to pass in the functions for each.
562
+ if "get_data_labeling_job" not in self._stubs:
563
+ self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary(
564
+ "/google.cloud.aiplatform.v1beta1.JobService/GetDataLabelingJob",
565
+ request_serializer=job_service.GetDataLabelingJobRequest.serialize,
566
+ response_deserializer=data_labeling_job.DataLabelingJob.deserialize,
567
+ )
568
+ return self._stubs["get_data_labeling_job"]
569
+
570
+ @property
571
+ def list_data_labeling_jobs(
572
+ self,
573
+ ) -> Callable[
574
+ [job_service.ListDataLabelingJobsRequest],
575
+ job_service.ListDataLabelingJobsResponse,
576
+ ]:
577
+ r"""Return a callable for the list data labeling jobs method over gRPC.
578
+
579
+ Lists DataLabelingJobs in a Location.
580
+
581
+ Returns:
582
+ Callable[[~.ListDataLabelingJobsRequest],
583
+ ~.ListDataLabelingJobsResponse]:
584
+ A function that, when called, will call the underlying RPC
585
+ on the server.
586
+ """
587
+ # Generate a "stub function" on-the-fly which will actually make
588
+ # the request.
589
+ # gRPC handles serialization and deserialization, so we just need
590
+ # to pass in the functions for each.
591
+ if "list_data_labeling_jobs" not in self._stubs:
592
+ self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary(
593
+ "/google.cloud.aiplatform.v1beta1.JobService/ListDataLabelingJobs",
594
+ request_serializer=job_service.ListDataLabelingJobsRequest.serialize,
595
+ response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize,
596
+ )
597
+ return self._stubs["list_data_labeling_jobs"]
598
+
599
+ @property
600
+ def delete_data_labeling_job(
601
+ self,
602
+ ) -> Callable[[job_service.DeleteDataLabelingJobRequest], operations_pb2.Operation]:
603
+ r"""Return a callable for the delete data labeling job method over gRPC.
604
+
605
+ Deletes a DataLabelingJob.
606
+
607
+ Returns:
608
+ Callable[[~.DeleteDataLabelingJobRequest],
609
+ ~.Operation]:
610
+ A function that, when called, will call the underlying RPC
611
+ on the server.
612
+ """
613
+ # Generate a "stub function" on-the-fly which will actually make
614
+ # the request.
615
+ # gRPC handles serialization and deserialization, so we just need
616
+ # to pass in the functions for each.
617
+ if "delete_data_labeling_job" not in self._stubs:
618
+ self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary(
619
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteDataLabelingJob",
620
+ request_serializer=job_service.DeleteDataLabelingJobRequest.serialize,
621
+ response_deserializer=operations_pb2.Operation.FromString,
622
+ )
623
+ return self._stubs["delete_data_labeling_job"]
624
+
625
+ @property
626
+ def cancel_data_labeling_job(
627
+ self,
628
+ ) -> Callable[[job_service.CancelDataLabelingJobRequest], empty_pb2.Empty]:
629
+ r"""Return a callable for the cancel data labeling job method over gRPC.
630
+
631
+ Cancels a DataLabelingJob. Success of cancellation is
632
+ not guaranteed.
633
+
634
+ Returns:
635
+ Callable[[~.CancelDataLabelingJobRequest],
636
+ ~.Empty]:
637
+ A function that, when called, will call the underlying RPC
638
+ on the server.
639
+ """
640
+ # Generate a "stub function" on-the-fly which will actually make
641
+ # the request.
642
+ # gRPC handles serialization and deserialization, so we just need
643
+ # to pass in the functions for each.
644
+ if "cancel_data_labeling_job" not in self._stubs:
645
+ self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary(
646
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelDataLabelingJob",
647
+ request_serializer=job_service.CancelDataLabelingJobRequest.serialize,
648
+ response_deserializer=empty_pb2.Empty.FromString,
649
+ )
650
+ return self._stubs["cancel_data_labeling_job"]
651
+
652
+ @property
653
+ def create_hyperparameter_tuning_job(
654
+ self,
655
+ ) -> Callable[
656
+ [job_service.CreateHyperparameterTuningJobRequest],
657
+ gca_hyperparameter_tuning_job.HyperparameterTuningJob,
658
+ ]:
659
+ r"""Return a callable for the create hyperparameter tuning
660
+ job method over gRPC.
661
+
662
+ Creates a HyperparameterTuningJob
663
+
664
+ Returns:
665
+ Callable[[~.CreateHyperparameterTuningJobRequest],
666
+ ~.HyperparameterTuningJob]:
667
+ A function that, when called, will call the underlying RPC
668
+ on the server.
669
+ """
670
+ # Generate a "stub function" on-the-fly which will actually make
671
+ # the request.
672
+ # gRPC handles serialization and deserialization, so we just need
673
+ # to pass in the functions for each.
674
+ if "create_hyperparameter_tuning_job" not in self._stubs:
675
+ self._stubs["create_hyperparameter_tuning_job"] = (
676
+ self._logged_channel.unary_unary(
677
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateHyperparameterTuningJob",
678
+ request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize,
679
+ response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize,
680
+ )
681
+ )
682
+ return self._stubs["create_hyperparameter_tuning_job"]
683
+
684
+ @property
685
+ def get_hyperparameter_tuning_job(
686
+ self,
687
+ ) -> Callable[
688
+ [job_service.GetHyperparameterTuningJobRequest],
689
+ hyperparameter_tuning_job.HyperparameterTuningJob,
690
+ ]:
691
+ r"""Return a callable for the get hyperparameter tuning job method over gRPC.
692
+
693
+ Gets a HyperparameterTuningJob
694
+
695
+ Returns:
696
+ Callable[[~.GetHyperparameterTuningJobRequest],
697
+ ~.HyperparameterTuningJob]:
698
+ A function that, when called, will call the underlying RPC
699
+ on the server.
700
+ """
701
+ # Generate a "stub function" on-the-fly which will actually make
702
+ # the request.
703
+ # gRPC handles serialization and deserialization, so we just need
704
+ # to pass in the functions for each.
705
+ if "get_hyperparameter_tuning_job" not in self._stubs:
706
+ self._stubs["get_hyperparameter_tuning_job"] = (
707
+ self._logged_channel.unary_unary(
708
+ "/google.cloud.aiplatform.v1beta1.JobService/GetHyperparameterTuningJob",
709
+ request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize,
710
+ response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize,
711
+ )
712
+ )
713
+ return self._stubs["get_hyperparameter_tuning_job"]
714
+
715
+ @property
716
+ def list_hyperparameter_tuning_jobs(
717
+ self,
718
+ ) -> Callable[
719
+ [job_service.ListHyperparameterTuningJobsRequest],
720
+ job_service.ListHyperparameterTuningJobsResponse,
721
+ ]:
722
+ r"""Return a callable for the list hyperparameter tuning
723
+ jobs method over gRPC.
724
+
725
+ Lists HyperparameterTuningJobs in a Location.
726
+
727
+ Returns:
728
+ Callable[[~.ListHyperparameterTuningJobsRequest],
729
+ ~.ListHyperparameterTuningJobsResponse]:
730
+ A function that, when called, will call the underlying RPC
731
+ on the server.
732
+ """
733
+ # Generate a "stub function" on-the-fly which will actually make
734
+ # the request.
735
+ # gRPC handles serialization and deserialization, so we just need
736
+ # to pass in the functions for each.
737
+ if "list_hyperparameter_tuning_jobs" not in self._stubs:
738
+ self._stubs["list_hyperparameter_tuning_jobs"] = (
739
+ self._logged_channel.unary_unary(
740
+ "/google.cloud.aiplatform.v1beta1.JobService/ListHyperparameterTuningJobs",
741
+ request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize,
742
+ response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize,
743
+ )
744
+ )
745
+ return self._stubs["list_hyperparameter_tuning_jobs"]
746
+
747
+ @property
748
+ def delete_hyperparameter_tuning_job(
749
+ self,
750
+ ) -> Callable[
751
+ [job_service.DeleteHyperparameterTuningJobRequest], operations_pb2.Operation
752
+ ]:
753
+ r"""Return a callable for the delete hyperparameter tuning
754
+ job method over gRPC.
755
+
756
+ Deletes a HyperparameterTuningJob.
757
+
758
+ Returns:
759
+ Callable[[~.DeleteHyperparameterTuningJobRequest],
760
+ ~.Operation]:
761
+ A function that, when called, will call the underlying RPC
762
+ on the server.
763
+ """
764
+ # Generate a "stub function" on-the-fly which will actually make
765
+ # the request.
766
+ # gRPC handles serialization and deserialization, so we just need
767
+ # to pass in the functions for each.
768
+ if "delete_hyperparameter_tuning_job" not in self._stubs:
769
+ self._stubs["delete_hyperparameter_tuning_job"] = (
770
+ self._logged_channel.unary_unary(
771
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteHyperparameterTuningJob",
772
+ request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize,
773
+ response_deserializer=operations_pb2.Operation.FromString,
774
+ )
775
+ )
776
+ return self._stubs["delete_hyperparameter_tuning_job"]
777
+
778
+ @property
779
+ def cancel_hyperparameter_tuning_job(
780
+ self,
781
+ ) -> Callable[[job_service.CancelHyperparameterTuningJobRequest], empty_pb2.Empty]:
782
+ r"""Return a callable for the cancel hyperparameter tuning
783
+ job method over gRPC.
784
+
785
+ Cancels a HyperparameterTuningJob. Starts asynchronous
786
+ cancellation on the HyperparameterTuningJob. The server makes a
787
+ best effort to cancel the job, but success is not guaranteed.
788
+ Clients can use
789
+ [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1beta1.JobService.GetHyperparameterTuningJob]
790
+ or other methods to check whether the cancellation succeeded or
791
+ whether the job completed despite cancellation. On successful
792
+ cancellation, the HyperparameterTuningJob is not deleted;
793
+ instead it becomes a job with a
794
+ [HyperparameterTuningJob.error][google.cloud.aiplatform.v1beta1.HyperparameterTuningJob.error]
795
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
796
+ 1, corresponding to ``Code.CANCELLED``, and
797
+ [HyperparameterTuningJob.state][google.cloud.aiplatform.v1beta1.HyperparameterTuningJob.state]
798
+ is set to ``CANCELLED``.
799
+
800
+ Returns:
801
+ Callable[[~.CancelHyperparameterTuningJobRequest],
802
+ ~.Empty]:
803
+ A function that, when called, will call the underlying RPC
804
+ on the server.
805
+ """
806
+ # Generate a "stub function" on-the-fly which will actually make
807
+ # the request.
808
+ # gRPC handles serialization and deserialization, so we just need
809
+ # to pass in the functions for each.
810
+ if "cancel_hyperparameter_tuning_job" not in self._stubs:
811
+ self._stubs["cancel_hyperparameter_tuning_job"] = (
812
+ self._logged_channel.unary_unary(
813
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelHyperparameterTuningJob",
814
+ request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize,
815
+ response_deserializer=empty_pb2.Empty.FromString,
816
+ )
817
+ )
818
+ return self._stubs["cancel_hyperparameter_tuning_job"]
819
+
820
+ @property
821
+ def create_nas_job(
822
+ self,
823
+ ) -> Callable[[job_service.CreateNasJobRequest], gca_nas_job.NasJob]:
824
+ r"""Return a callable for the create nas job method over gRPC.
825
+
826
+ Creates a NasJob
827
+
828
+ Returns:
829
+ Callable[[~.CreateNasJobRequest],
830
+ ~.NasJob]:
831
+ A function that, when called, will call the underlying RPC
832
+ on the server.
833
+ """
834
+ # Generate a "stub function" on-the-fly which will actually make
835
+ # the request.
836
+ # gRPC handles serialization and deserialization, so we just need
837
+ # to pass in the functions for each.
838
+ if "create_nas_job" not in self._stubs:
839
+ self._stubs["create_nas_job"] = self._logged_channel.unary_unary(
840
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateNasJob",
841
+ request_serializer=job_service.CreateNasJobRequest.serialize,
842
+ response_deserializer=gca_nas_job.NasJob.deserialize,
843
+ )
844
+ return self._stubs["create_nas_job"]
845
+
846
+ @property
847
+ def get_nas_job(self) -> Callable[[job_service.GetNasJobRequest], nas_job.NasJob]:
848
+ r"""Return a callable for the get nas job method over gRPC.
849
+
850
+ Gets a NasJob
851
+
852
+ Returns:
853
+ Callable[[~.GetNasJobRequest],
854
+ ~.NasJob]:
855
+ A function that, when called, will call the underlying RPC
856
+ on the server.
857
+ """
858
+ # Generate a "stub function" on-the-fly which will actually make
859
+ # the request.
860
+ # gRPC handles serialization and deserialization, so we just need
861
+ # to pass in the functions for each.
862
+ if "get_nas_job" not in self._stubs:
863
+ self._stubs["get_nas_job"] = self._logged_channel.unary_unary(
864
+ "/google.cloud.aiplatform.v1beta1.JobService/GetNasJob",
865
+ request_serializer=job_service.GetNasJobRequest.serialize,
866
+ response_deserializer=nas_job.NasJob.deserialize,
867
+ )
868
+ return self._stubs["get_nas_job"]
869
+
870
+ @property
871
+ def list_nas_jobs(
872
+ self,
873
+ ) -> Callable[[job_service.ListNasJobsRequest], job_service.ListNasJobsResponse]:
874
+ r"""Return a callable for the list nas jobs method over gRPC.
875
+
876
+ Lists NasJobs in a Location.
877
+
878
+ Returns:
879
+ Callable[[~.ListNasJobsRequest],
880
+ ~.ListNasJobsResponse]:
881
+ A function that, when called, will call the underlying RPC
882
+ on the server.
883
+ """
884
+ # Generate a "stub function" on-the-fly which will actually make
885
+ # the request.
886
+ # gRPC handles serialization and deserialization, so we just need
887
+ # to pass in the functions for each.
888
+ if "list_nas_jobs" not in self._stubs:
889
+ self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary(
890
+ "/google.cloud.aiplatform.v1beta1.JobService/ListNasJobs",
891
+ request_serializer=job_service.ListNasJobsRequest.serialize,
892
+ response_deserializer=job_service.ListNasJobsResponse.deserialize,
893
+ )
894
+ return self._stubs["list_nas_jobs"]
895
+
896
+ @property
897
+ def delete_nas_job(
898
+ self,
899
+ ) -> Callable[[job_service.DeleteNasJobRequest], operations_pb2.Operation]:
900
+ r"""Return a callable for the delete nas job method over gRPC.
901
+
902
+ Deletes a NasJob.
903
+
904
+ Returns:
905
+ Callable[[~.DeleteNasJobRequest],
906
+ ~.Operation]:
907
+ A function that, when called, will call the underlying RPC
908
+ on the server.
909
+ """
910
+ # Generate a "stub function" on-the-fly which will actually make
911
+ # the request.
912
+ # gRPC handles serialization and deserialization, so we just need
913
+ # to pass in the functions for each.
914
+ if "delete_nas_job" not in self._stubs:
915
+ self._stubs["delete_nas_job"] = self._logged_channel.unary_unary(
916
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteNasJob",
917
+ request_serializer=job_service.DeleteNasJobRequest.serialize,
918
+ response_deserializer=operations_pb2.Operation.FromString,
919
+ )
920
+ return self._stubs["delete_nas_job"]
921
+
922
+ @property
923
+ def cancel_nas_job(
924
+ self,
925
+ ) -> Callable[[job_service.CancelNasJobRequest], empty_pb2.Empty]:
926
+ r"""Return a callable for the cancel nas job method over gRPC.
927
+
928
+ Cancels a NasJob. Starts asynchronous cancellation on the
929
+ NasJob. The server makes a best effort to cancel the job, but
930
+ success is not guaranteed. Clients can use
931
+ [JobService.GetNasJob][google.cloud.aiplatform.v1beta1.JobService.GetNasJob]
932
+ or other methods to check whether the cancellation succeeded or
933
+ whether the job completed despite cancellation. On successful
934
+ cancellation, the NasJob is not deleted; instead it becomes a
935
+ job with a
936
+ [NasJob.error][google.cloud.aiplatform.v1beta1.NasJob.error]
937
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
938
+ 1, corresponding to ``Code.CANCELLED``, and
939
+ [NasJob.state][google.cloud.aiplatform.v1beta1.NasJob.state] is
940
+ set to ``CANCELLED``.
941
+
942
+ Returns:
943
+ Callable[[~.CancelNasJobRequest],
944
+ ~.Empty]:
945
+ A function that, when called, will call the underlying RPC
946
+ on the server.
947
+ """
948
+ # Generate a "stub function" on-the-fly which will actually make
949
+ # the request.
950
+ # gRPC handles serialization and deserialization, so we just need
951
+ # to pass in the functions for each.
952
+ if "cancel_nas_job" not in self._stubs:
953
+ self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary(
954
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelNasJob",
955
+ request_serializer=job_service.CancelNasJobRequest.serialize,
956
+ response_deserializer=empty_pb2.Empty.FromString,
957
+ )
958
+ return self._stubs["cancel_nas_job"]
959
+
960
+ @property
961
+ def get_nas_trial_detail(
962
+ self,
963
+ ) -> Callable[[job_service.GetNasTrialDetailRequest], nas_job.NasTrialDetail]:
964
+ r"""Return a callable for the get nas trial detail method over gRPC.
965
+
966
+ Gets a NasTrialDetail.
967
+
968
+ Returns:
969
+ Callable[[~.GetNasTrialDetailRequest],
970
+ ~.NasTrialDetail]:
971
+ A function that, when called, will call the underlying RPC
972
+ on the server.
973
+ """
974
+ # Generate a "stub function" on-the-fly which will actually make
975
+ # the request.
976
+ # gRPC handles serialization and deserialization, so we just need
977
+ # to pass in the functions for each.
978
+ if "get_nas_trial_detail" not in self._stubs:
979
+ self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary(
980
+ "/google.cloud.aiplatform.v1beta1.JobService/GetNasTrialDetail",
981
+ request_serializer=job_service.GetNasTrialDetailRequest.serialize,
982
+ response_deserializer=nas_job.NasTrialDetail.deserialize,
983
+ )
984
+ return self._stubs["get_nas_trial_detail"]
985
+
986
+ @property
987
+ def list_nas_trial_details(
988
+ self,
989
+ ) -> Callable[
990
+ [job_service.ListNasTrialDetailsRequest],
991
+ job_service.ListNasTrialDetailsResponse,
992
+ ]:
993
+ r"""Return a callable for the list nas trial details method over gRPC.
994
+
995
+ List top NasTrialDetails of a NasJob.
996
+
997
+ Returns:
998
+ Callable[[~.ListNasTrialDetailsRequest],
999
+ ~.ListNasTrialDetailsResponse]:
1000
+ A function that, when called, will call the underlying RPC
1001
+ on the server.
1002
+ """
1003
+ # Generate a "stub function" on-the-fly which will actually make
1004
+ # the request.
1005
+ # gRPC handles serialization and deserialization, so we just need
1006
+ # to pass in the functions for each.
1007
+ if "list_nas_trial_details" not in self._stubs:
1008
+ self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary(
1009
+ "/google.cloud.aiplatform.v1beta1.JobService/ListNasTrialDetails",
1010
+ request_serializer=job_service.ListNasTrialDetailsRequest.serialize,
1011
+ response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize,
1012
+ )
1013
+ return self._stubs["list_nas_trial_details"]
1014
+
1015
+ @property
1016
+ def create_batch_prediction_job(
1017
+ self,
1018
+ ) -> Callable[
1019
+ [job_service.CreateBatchPredictionJobRequest],
1020
+ gca_batch_prediction_job.BatchPredictionJob,
1021
+ ]:
1022
+ r"""Return a callable for the create batch prediction job method over gRPC.
1023
+
1024
+ Creates a BatchPredictionJob. A BatchPredictionJob
1025
+ once created will right away be attempted to start.
1026
+
1027
+ Returns:
1028
+ Callable[[~.CreateBatchPredictionJobRequest],
1029
+ ~.BatchPredictionJob]:
1030
+ A function that, when called, will call the underlying RPC
1031
+ on the server.
1032
+ """
1033
+ # Generate a "stub function" on-the-fly which will actually make
1034
+ # the request.
1035
+ # gRPC handles serialization and deserialization, so we just need
1036
+ # to pass in the functions for each.
1037
+ if "create_batch_prediction_job" not in self._stubs:
1038
+ self._stubs["create_batch_prediction_job"] = (
1039
+ self._logged_channel.unary_unary(
1040
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateBatchPredictionJob",
1041
+ request_serializer=job_service.CreateBatchPredictionJobRequest.serialize,
1042
+ response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize,
1043
+ )
1044
+ )
1045
+ return self._stubs["create_batch_prediction_job"]
1046
+
1047
+ @property
1048
+ def get_batch_prediction_job(
1049
+ self,
1050
+ ) -> Callable[
1051
+ [job_service.GetBatchPredictionJobRequest],
1052
+ batch_prediction_job.BatchPredictionJob,
1053
+ ]:
1054
+ r"""Return a callable for the get batch prediction job method over gRPC.
1055
+
1056
+ Gets a BatchPredictionJob
1057
+
1058
+ Returns:
1059
+ Callable[[~.GetBatchPredictionJobRequest],
1060
+ ~.BatchPredictionJob]:
1061
+ A function that, when called, will call the underlying RPC
1062
+ on the server.
1063
+ """
1064
+ # Generate a "stub function" on-the-fly which will actually make
1065
+ # the request.
1066
+ # gRPC handles serialization and deserialization, so we just need
1067
+ # to pass in the functions for each.
1068
+ if "get_batch_prediction_job" not in self._stubs:
1069
+ self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary(
1070
+ "/google.cloud.aiplatform.v1beta1.JobService/GetBatchPredictionJob",
1071
+ request_serializer=job_service.GetBatchPredictionJobRequest.serialize,
1072
+ response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize,
1073
+ )
1074
+ return self._stubs["get_batch_prediction_job"]
1075
+
1076
+ @property
1077
+ def list_batch_prediction_jobs(
1078
+ self,
1079
+ ) -> Callable[
1080
+ [job_service.ListBatchPredictionJobsRequest],
1081
+ job_service.ListBatchPredictionJobsResponse,
1082
+ ]:
1083
+ r"""Return a callable for the list batch prediction jobs method over gRPC.
1084
+
1085
+ Lists BatchPredictionJobs in a Location.
1086
+
1087
+ Returns:
1088
+ Callable[[~.ListBatchPredictionJobsRequest],
1089
+ ~.ListBatchPredictionJobsResponse]:
1090
+ A function that, when called, will call the underlying RPC
1091
+ on the server.
1092
+ """
1093
+ # Generate a "stub function" on-the-fly which will actually make
1094
+ # the request.
1095
+ # gRPC handles serialization and deserialization, so we just need
1096
+ # to pass in the functions for each.
1097
+ if "list_batch_prediction_jobs" not in self._stubs:
1098
+ self._stubs["list_batch_prediction_jobs"] = (
1099
+ self._logged_channel.unary_unary(
1100
+ "/google.cloud.aiplatform.v1beta1.JobService/ListBatchPredictionJobs",
1101
+ request_serializer=job_service.ListBatchPredictionJobsRequest.serialize,
1102
+ response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize,
1103
+ )
1104
+ )
1105
+ return self._stubs["list_batch_prediction_jobs"]
1106
+
1107
+ @property
1108
+ def delete_batch_prediction_job(
1109
+ self,
1110
+ ) -> Callable[
1111
+ [job_service.DeleteBatchPredictionJobRequest], operations_pb2.Operation
1112
+ ]:
1113
+ r"""Return a callable for the delete batch prediction job method over gRPC.
1114
+
1115
+ Deletes a BatchPredictionJob. Can only be called on
1116
+ jobs that already finished.
1117
+
1118
+ Returns:
1119
+ Callable[[~.DeleteBatchPredictionJobRequest],
1120
+ ~.Operation]:
1121
+ A function that, when called, will call the underlying RPC
1122
+ on the server.
1123
+ """
1124
+ # Generate a "stub function" on-the-fly which will actually make
1125
+ # the request.
1126
+ # gRPC handles serialization and deserialization, so we just need
1127
+ # to pass in the functions for each.
1128
+ if "delete_batch_prediction_job" not in self._stubs:
1129
+ self._stubs["delete_batch_prediction_job"] = (
1130
+ self._logged_channel.unary_unary(
1131
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteBatchPredictionJob",
1132
+ request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize,
1133
+ response_deserializer=operations_pb2.Operation.FromString,
1134
+ )
1135
+ )
1136
+ return self._stubs["delete_batch_prediction_job"]
1137
+
1138
+ @property
1139
+ def cancel_batch_prediction_job(
1140
+ self,
1141
+ ) -> Callable[[job_service.CancelBatchPredictionJobRequest], empty_pb2.Empty]:
1142
+ r"""Return a callable for the cancel batch prediction job method over gRPC.
1143
+
1144
+ Cancels a BatchPredictionJob.
1145
+
1146
+ Starts asynchronous cancellation on the BatchPredictionJob. The
1147
+ server makes the best effort to cancel the job, but success is
1148
+ not guaranteed. Clients can use
1149
+ [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1beta1.JobService.GetBatchPredictionJob]
1150
+ or other methods to check whether the cancellation succeeded or
1151
+ whether the job completed despite cancellation. On a successful
1152
+ cancellation, the BatchPredictionJob is not deleted;instead its
1153
+ [BatchPredictionJob.state][google.cloud.aiplatform.v1beta1.BatchPredictionJob.state]
1154
+ is set to ``CANCELLED``. Any files already outputted by the job
1155
+ are not deleted.
1156
+
1157
+ Returns:
1158
+ Callable[[~.CancelBatchPredictionJobRequest],
1159
+ ~.Empty]:
1160
+ A function that, when called, will call the underlying RPC
1161
+ on the server.
1162
+ """
1163
+ # Generate a "stub function" on-the-fly which will actually make
1164
+ # the request.
1165
+ # gRPC handles serialization and deserialization, so we just need
1166
+ # to pass in the functions for each.
1167
+ if "cancel_batch_prediction_job" not in self._stubs:
1168
+ self._stubs["cancel_batch_prediction_job"] = (
1169
+ self._logged_channel.unary_unary(
1170
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelBatchPredictionJob",
1171
+ request_serializer=job_service.CancelBatchPredictionJobRequest.serialize,
1172
+ response_deserializer=empty_pb2.Empty.FromString,
1173
+ )
1174
+ )
1175
+ return self._stubs["cancel_batch_prediction_job"]
1176
+
1177
+ @property
1178
+ def create_model_deployment_monitoring_job(
1179
+ self,
1180
+ ) -> Callable[
1181
+ [job_service.CreateModelDeploymentMonitoringJobRequest],
1182
+ gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob,
1183
+ ]:
1184
+ r"""Return a callable for the create model deployment
1185
+ monitoring job method over gRPC.
1186
+
1187
+ Creates a ModelDeploymentMonitoringJob. It will run
1188
+ periodically on a configured interval.
1189
+
1190
+ Returns:
1191
+ Callable[[~.CreateModelDeploymentMonitoringJobRequest],
1192
+ ~.ModelDeploymentMonitoringJob]:
1193
+ A function that, when called, will call the underlying RPC
1194
+ on the server.
1195
+ """
1196
+ # Generate a "stub function" on-the-fly which will actually make
1197
+ # the request.
1198
+ # gRPC handles serialization and deserialization, so we just need
1199
+ # to pass in the functions for each.
1200
+ if "create_model_deployment_monitoring_job" not in self._stubs:
1201
+ self._stubs["create_model_deployment_monitoring_job"] = (
1202
+ self._logged_channel.unary_unary(
1203
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateModelDeploymentMonitoringJob",
1204
+ request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize,
1205
+ response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize,
1206
+ )
1207
+ )
1208
+ return self._stubs["create_model_deployment_monitoring_job"]
1209
+
1210
+ @property
1211
+ def search_model_deployment_monitoring_stats_anomalies(
1212
+ self,
1213
+ ) -> Callable[
1214
+ [job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest],
1215
+ job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse,
1216
+ ]:
1217
+ r"""Return a callable for the search model deployment
1218
+ monitoring stats anomalies method over gRPC.
1219
+
1220
+ Searches Model Monitoring Statistics generated within
1221
+ a given time window.
1222
+
1223
+ Returns:
1224
+ Callable[[~.SearchModelDeploymentMonitoringStatsAnomaliesRequest],
1225
+ ~.SearchModelDeploymentMonitoringStatsAnomaliesResponse]:
1226
+ A function that, when called, will call the underlying RPC
1227
+ on the server.
1228
+ """
1229
+ # Generate a "stub function" on-the-fly which will actually make
1230
+ # the request.
1231
+ # gRPC handles serialization and deserialization, so we just need
1232
+ # to pass in the functions for each.
1233
+ if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs:
1234
+ self._stubs["search_model_deployment_monitoring_stats_anomalies"] = (
1235
+ self._logged_channel.unary_unary(
1236
+ "/google.cloud.aiplatform.v1beta1.JobService/SearchModelDeploymentMonitoringStatsAnomalies",
1237
+ request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize,
1238
+ response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize,
1239
+ )
1240
+ )
1241
+ return self._stubs["search_model_deployment_monitoring_stats_anomalies"]
1242
+
1243
+ @property
1244
+ def get_model_deployment_monitoring_job(
1245
+ self,
1246
+ ) -> Callable[
1247
+ [job_service.GetModelDeploymentMonitoringJobRequest],
1248
+ model_deployment_monitoring_job.ModelDeploymentMonitoringJob,
1249
+ ]:
1250
+ r"""Return a callable for the get model deployment
1251
+ monitoring job method over gRPC.
1252
+
1253
+ Gets a ModelDeploymentMonitoringJob.
1254
+
1255
+ Returns:
1256
+ Callable[[~.GetModelDeploymentMonitoringJobRequest],
1257
+ ~.ModelDeploymentMonitoringJob]:
1258
+ A function that, when called, will call the underlying RPC
1259
+ on the server.
1260
+ """
1261
+ # Generate a "stub function" on-the-fly which will actually make
1262
+ # the request.
1263
+ # gRPC handles serialization and deserialization, so we just need
1264
+ # to pass in the functions for each.
1265
+ if "get_model_deployment_monitoring_job" not in self._stubs:
1266
+ self._stubs["get_model_deployment_monitoring_job"] = (
1267
+ self._logged_channel.unary_unary(
1268
+ "/google.cloud.aiplatform.v1beta1.JobService/GetModelDeploymentMonitoringJob",
1269
+ request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize,
1270
+ response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize,
1271
+ )
1272
+ )
1273
+ return self._stubs["get_model_deployment_monitoring_job"]
1274
+
1275
+ @property
1276
+ def list_model_deployment_monitoring_jobs(
1277
+ self,
1278
+ ) -> Callable[
1279
+ [job_service.ListModelDeploymentMonitoringJobsRequest],
1280
+ job_service.ListModelDeploymentMonitoringJobsResponse,
1281
+ ]:
1282
+ r"""Return a callable for the list model deployment
1283
+ monitoring jobs method over gRPC.
1284
+
1285
+ Lists ModelDeploymentMonitoringJobs in a Location.
1286
+
1287
+ Returns:
1288
+ Callable[[~.ListModelDeploymentMonitoringJobsRequest],
1289
+ ~.ListModelDeploymentMonitoringJobsResponse]:
1290
+ A function that, when called, will call the underlying RPC
1291
+ on the server.
1292
+ """
1293
+ # Generate a "stub function" on-the-fly which will actually make
1294
+ # the request.
1295
+ # gRPC handles serialization and deserialization, so we just need
1296
+ # to pass in the functions for each.
1297
+ if "list_model_deployment_monitoring_jobs" not in self._stubs:
1298
+ self._stubs["list_model_deployment_monitoring_jobs"] = (
1299
+ self._logged_channel.unary_unary(
1300
+ "/google.cloud.aiplatform.v1beta1.JobService/ListModelDeploymentMonitoringJobs",
1301
+ request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize,
1302
+ response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize,
1303
+ )
1304
+ )
1305
+ return self._stubs["list_model_deployment_monitoring_jobs"]
1306
+
1307
+ @property
1308
+ def update_model_deployment_monitoring_job(
1309
+ self,
1310
+ ) -> Callable[
1311
+ [job_service.UpdateModelDeploymentMonitoringJobRequest],
1312
+ operations_pb2.Operation,
1313
+ ]:
1314
+ r"""Return a callable for the update model deployment
1315
+ monitoring job method over gRPC.
1316
+
1317
+ Updates a ModelDeploymentMonitoringJob.
1318
+
1319
+ Returns:
1320
+ Callable[[~.UpdateModelDeploymentMonitoringJobRequest],
1321
+ ~.Operation]:
1322
+ A function that, when called, will call the underlying RPC
1323
+ on the server.
1324
+ """
1325
+ # Generate a "stub function" on-the-fly which will actually make
1326
+ # the request.
1327
+ # gRPC handles serialization and deserialization, so we just need
1328
+ # to pass in the functions for each.
1329
+ if "update_model_deployment_monitoring_job" not in self._stubs:
1330
+ self._stubs["update_model_deployment_monitoring_job"] = (
1331
+ self._logged_channel.unary_unary(
1332
+ "/google.cloud.aiplatform.v1beta1.JobService/UpdateModelDeploymentMonitoringJob",
1333
+ request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize,
1334
+ response_deserializer=operations_pb2.Operation.FromString,
1335
+ )
1336
+ )
1337
+ return self._stubs["update_model_deployment_monitoring_job"]
1338
+
1339
+ @property
1340
+ def delete_model_deployment_monitoring_job(
1341
+ self,
1342
+ ) -> Callable[
1343
+ [job_service.DeleteModelDeploymentMonitoringJobRequest],
1344
+ operations_pb2.Operation,
1345
+ ]:
1346
+ r"""Return a callable for the delete model deployment
1347
+ monitoring job method over gRPC.
1348
+
1349
+ Deletes a ModelDeploymentMonitoringJob.
1350
+
1351
+ Returns:
1352
+ Callable[[~.DeleteModelDeploymentMonitoringJobRequest],
1353
+ ~.Operation]:
1354
+ A function that, when called, will call the underlying RPC
1355
+ on the server.
1356
+ """
1357
+ # Generate a "stub function" on-the-fly which will actually make
1358
+ # the request.
1359
+ # gRPC handles serialization and deserialization, so we just need
1360
+ # to pass in the functions for each.
1361
+ if "delete_model_deployment_monitoring_job" not in self._stubs:
1362
+ self._stubs["delete_model_deployment_monitoring_job"] = (
1363
+ self._logged_channel.unary_unary(
1364
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteModelDeploymentMonitoringJob",
1365
+ request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize,
1366
+ response_deserializer=operations_pb2.Operation.FromString,
1367
+ )
1368
+ )
1369
+ return self._stubs["delete_model_deployment_monitoring_job"]
1370
+
1371
+ @property
1372
+ def pause_model_deployment_monitoring_job(
1373
+ self,
1374
+ ) -> Callable[
1375
+ [job_service.PauseModelDeploymentMonitoringJobRequest], empty_pb2.Empty
1376
+ ]:
1377
+ r"""Return a callable for the pause model deployment
1378
+ monitoring job method over gRPC.
1379
+
1380
+ Pauses a ModelDeploymentMonitoringJob. If the job is running,
1381
+ the server makes a best effort to cancel the job. Will mark
1382
+ [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob.state]
1383
+ to 'PAUSED'.
1384
+
1385
+ Returns:
1386
+ Callable[[~.PauseModelDeploymentMonitoringJobRequest],
1387
+ ~.Empty]:
1388
+ A function that, when called, will call the underlying RPC
1389
+ on the server.
1390
+ """
1391
+ # Generate a "stub function" on-the-fly which will actually make
1392
+ # the request.
1393
+ # gRPC handles serialization and deserialization, so we just need
1394
+ # to pass in the functions for each.
1395
+ if "pause_model_deployment_monitoring_job" not in self._stubs:
1396
+ self._stubs["pause_model_deployment_monitoring_job"] = (
1397
+ self._logged_channel.unary_unary(
1398
+ "/google.cloud.aiplatform.v1beta1.JobService/PauseModelDeploymentMonitoringJob",
1399
+ request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize,
1400
+ response_deserializer=empty_pb2.Empty.FromString,
1401
+ )
1402
+ )
1403
+ return self._stubs["pause_model_deployment_monitoring_job"]
1404
+
1405
+ @property
1406
+ def resume_model_deployment_monitoring_job(
1407
+ self,
1408
+ ) -> Callable[
1409
+ [job_service.ResumeModelDeploymentMonitoringJobRequest], empty_pb2.Empty
1410
+ ]:
1411
+ r"""Return a callable for the resume model deployment
1412
+ monitoring job method over gRPC.
1413
+
1414
+ Resumes a paused ModelDeploymentMonitoringJob. It
1415
+ will start to run from next scheduled time. A deleted
1416
+ ModelDeploymentMonitoringJob can't be resumed.
1417
+
1418
+ Returns:
1419
+ Callable[[~.ResumeModelDeploymentMonitoringJobRequest],
1420
+ ~.Empty]:
1421
+ A function that, when called, will call the underlying RPC
1422
+ on the server.
1423
+ """
1424
+ # Generate a "stub function" on-the-fly which will actually make
1425
+ # the request.
1426
+ # gRPC handles serialization and deserialization, so we just need
1427
+ # to pass in the functions for each.
1428
+ if "resume_model_deployment_monitoring_job" not in self._stubs:
1429
+ self._stubs["resume_model_deployment_monitoring_job"] = (
1430
+ self._logged_channel.unary_unary(
1431
+ "/google.cloud.aiplatform.v1beta1.JobService/ResumeModelDeploymentMonitoringJob",
1432
+ request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize,
1433
+ response_deserializer=empty_pb2.Empty.FromString,
1434
+ )
1435
+ )
1436
+ return self._stubs["resume_model_deployment_monitoring_job"]
1437
+
1438
+ def close(self):
1439
+ self._logged_channel.close()
1440
+
1441
+ @property
1442
+ def delete_operation(
1443
+ self,
1444
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
1445
+ r"""Return a callable for the delete_operation method over gRPC."""
1446
+ # Generate a "stub function" on-the-fly which will actually make
1447
+ # the request.
1448
+ # gRPC handles serialization and deserialization, so we just need
1449
+ # to pass in the functions for each.
1450
+ if "delete_operation" not in self._stubs:
1451
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
1452
+ "/google.longrunning.Operations/DeleteOperation",
1453
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
1454
+ response_deserializer=None,
1455
+ )
1456
+ return self._stubs["delete_operation"]
1457
+
1458
+ @property
1459
+ def cancel_operation(
1460
+ self,
1461
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
1462
+ r"""Return a callable for the cancel_operation method over gRPC."""
1463
+ # Generate a "stub function" on-the-fly which will actually make
1464
+ # the request.
1465
+ # gRPC handles serialization and deserialization, so we just need
1466
+ # to pass in the functions for each.
1467
+ if "cancel_operation" not in self._stubs:
1468
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
1469
+ "/google.longrunning.Operations/CancelOperation",
1470
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
1471
+ response_deserializer=None,
1472
+ )
1473
+ return self._stubs["cancel_operation"]
1474
+
1475
+ @property
1476
+ def wait_operation(
1477
+ self,
1478
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
1479
+ r"""Return a callable for the wait_operation method over gRPC."""
1480
+ # Generate a "stub function" on-the-fly which will actually make
1481
+ # the request.
1482
+ # gRPC handles serialization and deserialization, so we just need
1483
+ # to pass in the functions for each.
1484
+ if "wait_operation" not in self._stubs:
1485
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
1486
+ "/google.longrunning.Operations/WaitOperation",
1487
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
1488
+ response_deserializer=None,
1489
+ )
1490
+ return self._stubs["wait_operation"]
1491
+
1492
+ @property
1493
+ def get_operation(
1494
+ self,
1495
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
1496
+ r"""Return a callable for the get_operation method over gRPC."""
1497
+ # Generate a "stub function" on-the-fly which will actually make
1498
+ # the request.
1499
+ # gRPC handles serialization and deserialization, so we just need
1500
+ # to pass in the functions for each.
1501
+ if "get_operation" not in self._stubs:
1502
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
1503
+ "/google.longrunning.Operations/GetOperation",
1504
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
1505
+ response_deserializer=operations_pb2.Operation.FromString,
1506
+ )
1507
+ return self._stubs["get_operation"]
1508
+
1509
+ @property
1510
+ def list_operations(
1511
+ self,
1512
+ ) -> Callable[
1513
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
1514
+ ]:
1515
+ r"""Return a callable for the list_operations method over gRPC."""
1516
+ # Generate a "stub function" on-the-fly which will actually make
1517
+ # the request.
1518
+ # gRPC handles serialization and deserialization, so we just need
1519
+ # to pass in the functions for each.
1520
+ if "list_operations" not in self._stubs:
1521
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
1522
+ "/google.longrunning.Operations/ListOperations",
1523
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
1524
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
1525
+ )
1526
+ return self._stubs["list_operations"]
1527
+
1528
+ @property
1529
+ def list_locations(
1530
+ self,
1531
+ ) -> Callable[
1532
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
1533
+ ]:
1534
+ r"""Return a callable for the list locations method over gRPC."""
1535
+ # Generate a "stub function" on-the-fly which will actually make
1536
+ # the request.
1537
+ # gRPC handles serialization and deserialization, so we just need
1538
+ # to pass in the functions for each.
1539
+ if "list_locations" not in self._stubs:
1540
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
1541
+ "/google.cloud.location.Locations/ListLocations",
1542
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
1543
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
1544
+ )
1545
+ return self._stubs["list_locations"]
1546
+
1547
+ @property
1548
+ def get_location(
1549
+ self,
1550
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
1551
+ r"""Return a callable for the list locations method over gRPC."""
1552
+ # Generate a "stub function" on-the-fly which will actually make
1553
+ # the request.
1554
+ # gRPC handles serialization and deserialization, so we just need
1555
+ # to pass in the functions for each.
1556
+ if "get_location" not in self._stubs:
1557
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
1558
+ "/google.cloud.location.Locations/GetLocation",
1559
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
1560
+ response_deserializer=locations_pb2.Location.FromString,
1561
+ )
1562
+ return self._stubs["get_location"]
1563
+
1564
+ @property
1565
+ def set_iam_policy(
1566
+ self,
1567
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
1568
+ r"""Return a callable for the set iam policy method over gRPC.
1569
+ Sets the IAM access control policy on the specified
1570
+ function. Replaces any existing policy.
1571
+ Returns:
1572
+ Callable[[~.SetIamPolicyRequest],
1573
+ ~.Policy]:
1574
+ A function that, when called, will call the underlying RPC
1575
+ on the server.
1576
+ """
1577
+ # Generate a "stub function" on-the-fly which will actually make
1578
+ # the request.
1579
+ # gRPC handles serialization and deserialization, so we just need
1580
+ # to pass in the functions for each.
1581
+ if "set_iam_policy" not in self._stubs:
1582
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
1583
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
1584
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
1585
+ response_deserializer=policy_pb2.Policy.FromString,
1586
+ )
1587
+ return self._stubs["set_iam_policy"]
1588
+
1589
+ @property
1590
+ def get_iam_policy(
1591
+ self,
1592
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
1593
+ r"""Return a callable for the get iam policy method over gRPC.
1594
+ Gets the IAM access control policy for a function.
1595
+ Returns an empty policy if the function exists and does
1596
+ not have a policy set.
1597
+ Returns:
1598
+ Callable[[~.GetIamPolicyRequest],
1599
+ ~.Policy]:
1600
+ A function that, when called, will call the underlying RPC
1601
+ on the server.
1602
+ """
1603
+ # Generate a "stub function" on-the-fly which will actually make
1604
+ # the request.
1605
+ # gRPC handles serialization and deserialization, so we just need
1606
+ # to pass in the functions for each.
1607
+ if "get_iam_policy" not in self._stubs:
1608
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
1609
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
1610
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
1611
+ response_deserializer=policy_pb2.Policy.FromString,
1612
+ )
1613
+ return self._stubs["get_iam_policy"]
1614
+
1615
+ @property
1616
+ def test_iam_permissions(
1617
+ self,
1618
+ ) -> Callable[
1619
+ [iam_policy_pb2.TestIamPermissionsRequest],
1620
+ iam_policy_pb2.TestIamPermissionsResponse,
1621
+ ]:
1622
+ r"""Return a callable for the test iam permissions method over gRPC.
1623
+ Tests the specified permissions against the IAM access control
1624
+ policy for a function. If the function does not exist, this will
1625
+ return an empty set of permissions, not a NOT_FOUND error.
1626
+ Returns:
1627
+ Callable[[~.TestIamPermissionsRequest],
1628
+ ~.TestIamPermissionsResponse]:
1629
+ A function that, when called, will call the underlying RPC
1630
+ on the server.
1631
+ """
1632
+ # Generate a "stub function" on-the-fly which will actually make
1633
+ # the request.
1634
+ # gRPC handles serialization and deserialization, so we just need
1635
+ # to pass in the functions for each.
1636
+ if "test_iam_permissions" not in self._stubs:
1637
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
1638
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
1639
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
1640
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
1641
+ )
1642
+ return self._stubs["test_iam_permissions"]
1643
+
1644
+ @property
1645
+ def kind(self) -> str:
1646
+ return "grpc"
1647
+
1648
+
1649
+ __all__ = ("JobServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,1918 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import pickle
19
+ import logging as std_logging
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import grpc_helpers_async
25
+ from google.api_core import exceptions as core_exceptions
26
+ from google.api_core import retry_async as retries
27
+ from google.api_core import operations_v1
28
+ from google.auth import credentials as ga_credentials # type: ignore
29
+ from google.auth.transport.grpc import SslCredentials # type: ignore
30
+ from google.protobuf.json_format import MessageToJson
31
+ import google.protobuf.message
32
+
33
+ import grpc # type: ignore
34
+ import proto # type: ignore
35
+ from grpc.experimental import aio # type: ignore
36
+
37
+ from google.cloud.aiplatform_v1beta1.types import batch_prediction_job
38
+ from google.cloud.aiplatform_v1beta1.types import (
39
+ batch_prediction_job as gca_batch_prediction_job,
40
+ )
41
+ from google.cloud.aiplatform_v1beta1.types import custom_job
42
+ from google.cloud.aiplatform_v1beta1.types import custom_job as gca_custom_job
43
+ from google.cloud.aiplatform_v1beta1.types import data_labeling_job
44
+ from google.cloud.aiplatform_v1beta1.types import (
45
+ data_labeling_job as gca_data_labeling_job,
46
+ )
47
+ from google.cloud.aiplatform_v1beta1.types import hyperparameter_tuning_job
48
+ from google.cloud.aiplatform_v1beta1.types import (
49
+ hyperparameter_tuning_job as gca_hyperparameter_tuning_job,
50
+ )
51
+ from google.cloud.aiplatform_v1beta1.types import job_service
52
+ from google.cloud.aiplatform_v1beta1.types import model_deployment_monitoring_job
53
+ from google.cloud.aiplatform_v1beta1.types import (
54
+ model_deployment_monitoring_job as gca_model_deployment_monitoring_job,
55
+ )
56
+ from google.cloud.aiplatform_v1beta1.types import nas_job
57
+ from google.cloud.aiplatform_v1beta1.types import nas_job as gca_nas_job
58
+ from google.cloud.location import locations_pb2 # type: ignore
59
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
60
+ from google.iam.v1 import policy_pb2 # type: ignore
61
+ from google.longrunning import operations_pb2 # type: ignore
62
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
63
+ from .base import JobServiceTransport, DEFAULT_CLIENT_INFO
64
+ from .grpc import JobServiceGrpcTransport
65
+
66
+ try:
67
+ from google.api_core import client_logging # type: ignore
68
+
69
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
70
+ except ImportError: # pragma: NO COVER
71
+ CLIENT_LOGGING_SUPPORTED = False
72
+
73
+ _LOGGER = std_logging.getLogger(__name__)
74
+
75
+
76
+ class _LoggingClientAIOInterceptor(
77
+ grpc.aio.UnaryUnaryClientInterceptor
78
+ ): # pragma: NO COVER
79
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
80
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
81
+ std_logging.DEBUG
82
+ )
83
+ if logging_enabled: # pragma: NO COVER
84
+ request_metadata = client_call_details.metadata
85
+ if isinstance(request, proto.Message):
86
+ request_payload = type(request).to_json(request)
87
+ elif isinstance(request, google.protobuf.message.Message):
88
+ request_payload = MessageToJson(request)
89
+ else:
90
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
91
+
92
+ request_metadata = {
93
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
94
+ for key, value in request_metadata
95
+ }
96
+ grpc_request = {
97
+ "payload": request_payload,
98
+ "requestMethod": "grpc",
99
+ "metadata": dict(request_metadata),
100
+ }
101
+ _LOGGER.debug(
102
+ f"Sending request for {client_call_details.method}",
103
+ extra={
104
+ "serviceName": "google.cloud.aiplatform.v1beta1.JobService",
105
+ "rpcName": str(client_call_details.method),
106
+ "request": grpc_request,
107
+ "metadata": grpc_request["metadata"],
108
+ },
109
+ )
110
+ response = await continuation(client_call_details, request)
111
+ if logging_enabled: # pragma: NO COVER
112
+ response_metadata = await response.trailing_metadata()
113
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
114
+ metadata = (
115
+ dict([(k, str(v)) for k, v in response_metadata])
116
+ if response_metadata
117
+ else None
118
+ )
119
+ result = await response
120
+ if isinstance(result, proto.Message):
121
+ response_payload = type(result).to_json(result)
122
+ elif isinstance(result, google.protobuf.message.Message):
123
+ response_payload = MessageToJson(result)
124
+ else:
125
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
126
+ grpc_response = {
127
+ "payload": response_payload,
128
+ "metadata": metadata,
129
+ "status": "OK",
130
+ }
131
+ _LOGGER.debug(
132
+ f"Received response to rpc {client_call_details.method}.",
133
+ extra={
134
+ "serviceName": "google.cloud.aiplatform.v1beta1.JobService",
135
+ "rpcName": str(client_call_details.method),
136
+ "response": grpc_response,
137
+ "metadata": grpc_response["metadata"],
138
+ },
139
+ )
140
+ return response
141
+
142
+
143
+ class JobServiceGrpcAsyncIOTransport(JobServiceTransport):
144
+ """gRPC AsyncIO backend transport for JobService.
145
+
146
+ A service for creating and managing Vertex AI's jobs.
147
+
148
+ This class defines the same methods as the primary client, so the
149
+ primary client can load the underlying transport implementation
150
+ and call it.
151
+
152
+ It sends protocol buffers over the wire using gRPC (which is built on
153
+ top of HTTP/2); the ``grpcio`` package must be installed.
154
+ """
155
+
156
+ _grpc_channel: aio.Channel
157
+ _stubs: Dict[str, Callable] = {}
158
+
159
+ @classmethod
160
+ def create_channel(
161
+ cls,
162
+ host: str = "aiplatform.googleapis.com",
163
+ credentials: Optional[ga_credentials.Credentials] = None,
164
+ credentials_file: Optional[str] = None,
165
+ scopes: Optional[Sequence[str]] = None,
166
+ quota_project_id: Optional[str] = None,
167
+ **kwargs,
168
+ ) -> aio.Channel:
169
+ """Create and return a gRPC AsyncIO channel object.
170
+ Args:
171
+ host (Optional[str]): The host for the channel to use.
172
+ credentials (Optional[~.Credentials]): The
173
+ authorization credentials to attach to requests. These
174
+ credentials identify this application to the service. If
175
+ none are specified, the client will attempt to ascertain
176
+ the credentials from the environment.
177
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
178
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
179
+ removed in the next major version of this library.
180
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
181
+ service. These are only used when credentials are not specified and
182
+ are passed to :func:`google.auth.default`.
183
+ quota_project_id (Optional[str]): An optional project to use for billing
184
+ and quota.
185
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
186
+ channel creation.
187
+ Returns:
188
+ aio.Channel: A gRPC AsyncIO channel object.
189
+ """
190
+
191
+ return grpc_helpers_async.create_channel(
192
+ host,
193
+ credentials=credentials,
194
+ credentials_file=credentials_file,
195
+ quota_project_id=quota_project_id,
196
+ default_scopes=cls.AUTH_SCOPES,
197
+ scopes=scopes,
198
+ default_host=cls.DEFAULT_HOST,
199
+ **kwargs,
200
+ )
201
+
202
+ def __init__(
203
+ self,
204
+ *,
205
+ host: str = "aiplatform.googleapis.com",
206
+ credentials: Optional[ga_credentials.Credentials] = None,
207
+ credentials_file: Optional[str] = None,
208
+ scopes: Optional[Sequence[str]] = None,
209
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
210
+ api_mtls_endpoint: Optional[str] = None,
211
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
212
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
213
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
214
+ quota_project_id: Optional[str] = None,
215
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
216
+ always_use_jwt_access: Optional[bool] = False,
217
+ api_audience: Optional[str] = None,
218
+ ) -> None:
219
+ """Instantiate the transport.
220
+
221
+ Args:
222
+ host (Optional[str]):
223
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
224
+ credentials (Optional[google.auth.credentials.Credentials]): The
225
+ authorization credentials to attach to requests. These
226
+ credentials identify the application to the service; if none
227
+ are specified, the client will attempt to ascertain the
228
+ credentials from the environment.
229
+ This argument is ignored if a ``channel`` instance is provided.
230
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
231
+ be loaded with :func:`google.auth.load_credentials_from_file`.
232
+ This argument is ignored if a ``channel`` instance is provided.
233
+ This argument will be removed in the next major version of this library.
234
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
235
+ service. These are only used when credentials are not specified and
236
+ are passed to :func:`google.auth.default`.
237
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
238
+ A ``Channel`` instance through which to make calls, or a Callable
239
+ that constructs and returns one. If set to None, ``self.create_channel``
240
+ is used to create the channel. If a Callable is given, it will be called
241
+ with the same arguments as used in ``self.create_channel``.
242
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
243
+ If provided, it overrides the ``host`` argument and tries to create
244
+ a mutual TLS channel with client SSL credentials from
245
+ ``client_cert_source`` or application default SSL credentials.
246
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
247
+ Deprecated. A callback to provide client SSL certificate bytes and
248
+ private key bytes, both in PEM format. It is ignored if
249
+ ``api_mtls_endpoint`` is None.
250
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
251
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
252
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
253
+ A callback to provide client certificate bytes and private key bytes,
254
+ both in PEM format. It is used to configure a mutual TLS channel. It is
255
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
256
+ quota_project_id (Optional[str]): An optional project to use for billing
257
+ and quota.
258
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
259
+ The client info used to send a user-agent string along with
260
+ API requests. If ``None``, then default info will be used.
261
+ Generally, you only need to set this if you're developing
262
+ your own client library.
263
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
264
+ be used for service account credentials.
265
+
266
+ Raises:
267
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
268
+ creation failed for any reason.
269
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
270
+ and ``credentials_file`` are passed.
271
+ """
272
+ self._grpc_channel = None
273
+ self._ssl_channel_credentials = ssl_channel_credentials
274
+ self._stubs: Dict[str, Callable] = {}
275
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
276
+
277
+ if api_mtls_endpoint:
278
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
279
+ if client_cert_source:
280
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
281
+
282
+ if isinstance(channel, aio.Channel):
283
+ # Ignore credentials if a channel was passed.
284
+ credentials = None
285
+ self._ignore_credentials = True
286
+ # If a channel was explicitly provided, set it.
287
+ self._grpc_channel = channel
288
+ self._ssl_channel_credentials = None
289
+ else:
290
+ if api_mtls_endpoint:
291
+ host = api_mtls_endpoint
292
+
293
+ # Create SSL credentials with client_cert_source or application
294
+ # default SSL credentials.
295
+ if client_cert_source:
296
+ cert, key = client_cert_source()
297
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
298
+ certificate_chain=cert, private_key=key
299
+ )
300
+ else:
301
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
302
+
303
+ else:
304
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
305
+ cert, key = client_cert_source_for_mtls()
306
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
307
+ certificate_chain=cert, private_key=key
308
+ )
309
+
310
+ # The base transport sets the host, credentials and scopes
311
+ super().__init__(
312
+ host=host,
313
+ credentials=credentials,
314
+ credentials_file=credentials_file,
315
+ scopes=scopes,
316
+ quota_project_id=quota_project_id,
317
+ client_info=client_info,
318
+ always_use_jwt_access=always_use_jwt_access,
319
+ api_audience=api_audience,
320
+ )
321
+
322
+ if not self._grpc_channel:
323
+ # initialize with the provided callable or the default channel
324
+ channel_init = channel or type(self).create_channel
325
+ self._grpc_channel = channel_init(
326
+ self._host,
327
+ # use the credentials which are saved
328
+ credentials=self._credentials,
329
+ # Set ``credentials_file`` to ``None`` here as
330
+ # the credentials that we saved earlier should be used.
331
+ credentials_file=None,
332
+ scopes=self._scopes,
333
+ ssl_credentials=self._ssl_channel_credentials,
334
+ quota_project_id=quota_project_id,
335
+ options=[
336
+ ("grpc.max_send_message_length", -1),
337
+ ("grpc.max_receive_message_length", -1),
338
+ ],
339
+ )
340
+
341
+ self._interceptor = _LoggingClientAIOInterceptor()
342
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
343
+ self._logged_channel = self._grpc_channel
344
+ self._wrap_with_kind = (
345
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
346
+ )
347
+ # Wrap messages. This must be done after self._logged_channel exists
348
+ self._prep_wrapped_messages(client_info)
349
+
350
+ @property
351
+ def grpc_channel(self) -> aio.Channel:
352
+ """Create the channel designed to connect to this service.
353
+
354
+ This property caches on the instance; repeated calls return
355
+ the same channel.
356
+ """
357
+ # Return the channel from cache.
358
+ return self._grpc_channel
359
+
360
+ @property
361
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
362
+ """Create the client designed to process long-running operations.
363
+
364
+ This property caches on the instance; repeated calls return the same
365
+ client.
366
+ """
367
+ # Quick check: Only create a new client if we do not already have one.
368
+ if self._operations_client is None:
369
+ self._operations_client = operations_v1.OperationsAsyncClient(
370
+ self._logged_channel
371
+ )
372
+
373
+ # Return the client from cache.
374
+ return self._operations_client
375
+
376
+ @property
377
+ def create_custom_job(
378
+ self,
379
+ ) -> Callable[
380
+ [job_service.CreateCustomJobRequest], Awaitable[gca_custom_job.CustomJob]
381
+ ]:
382
+ r"""Return a callable for the create custom job method over gRPC.
383
+
384
+ Creates a CustomJob. A created CustomJob right away
385
+ will be attempted to be run.
386
+
387
+ Returns:
388
+ Callable[[~.CreateCustomJobRequest],
389
+ Awaitable[~.CustomJob]]:
390
+ A function that, when called, will call the underlying RPC
391
+ on the server.
392
+ """
393
+ # Generate a "stub function" on-the-fly which will actually make
394
+ # the request.
395
+ # gRPC handles serialization and deserialization, so we just need
396
+ # to pass in the functions for each.
397
+ if "create_custom_job" not in self._stubs:
398
+ self._stubs["create_custom_job"] = self._logged_channel.unary_unary(
399
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateCustomJob",
400
+ request_serializer=job_service.CreateCustomJobRequest.serialize,
401
+ response_deserializer=gca_custom_job.CustomJob.deserialize,
402
+ )
403
+ return self._stubs["create_custom_job"]
404
+
405
+ @property
406
+ def get_custom_job(
407
+ self,
408
+ ) -> Callable[[job_service.GetCustomJobRequest], Awaitable[custom_job.CustomJob]]:
409
+ r"""Return a callable for the get custom job method over gRPC.
410
+
411
+ Gets a CustomJob.
412
+
413
+ Returns:
414
+ Callable[[~.GetCustomJobRequest],
415
+ Awaitable[~.CustomJob]]:
416
+ A function that, when called, will call the underlying RPC
417
+ on the server.
418
+ """
419
+ # Generate a "stub function" on-the-fly which will actually make
420
+ # the request.
421
+ # gRPC handles serialization and deserialization, so we just need
422
+ # to pass in the functions for each.
423
+ if "get_custom_job" not in self._stubs:
424
+ self._stubs["get_custom_job"] = self._logged_channel.unary_unary(
425
+ "/google.cloud.aiplatform.v1beta1.JobService/GetCustomJob",
426
+ request_serializer=job_service.GetCustomJobRequest.serialize,
427
+ response_deserializer=custom_job.CustomJob.deserialize,
428
+ )
429
+ return self._stubs["get_custom_job"]
430
+
431
+ @property
432
+ def list_custom_jobs(
433
+ self,
434
+ ) -> Callable[
435
+ [job_service.ListCustomJobsRequest],
436
+ Awaitable[job_service.ListCustomJobsResponse],
437
+ ]:
438
+ r"""Return a callable for the list custom jobs method over gRPC.
439
+
440
+ Lists CustomJobs in a Location.
441
+
442
+ Returns:
443
+ Callable[[~.ListCustomJobsRequest],
444
+ Awaitable[~.ListCustomJobsResponse]]:
445
+ A function that, when called, will call the underlying RPC
446
+ on the server.
447
+ """
448
+ # Generate a "stub function" on-the-fly which will actually make
449
+ # the request.
450
+ # gRPC handles serialization and deserialization, so we just need
451
+ # to pass in the functions for each.
452
+ if "list_custom_jobs" not in self._stubs:
453
+ self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary(
454
+ "/google.cloud.aiplatform.v1beta1.JobService/ListCustomJobs",
455
+ request_serializer=job_service.ListCustomJobsRequest.serialize,
456
+ response_deserializer=job_service.ListCustomJobsResponse.deserialize,
457
+ )
458
+ return self._stubs["list_custom_jobs"]
459
+
460
+ @property
461
+ def delete_custom_job(
462
+ self,
463
+ ) -> Callable[
464
+ [job_service.DeleteCustomJobRequest], Awaitable[operations_pb2.Operation]
465
+ ]:
466
+ r"""Return a callable for the delete custom job method over gRPC.
467
+
468
+ Deletes a CustomJob.
469
+
470
+ Returns:
471
+ Callable[[~.DeleteCustomJobRequest],
472
+ Awaitable[~.Operation]]:
473
+ A function that, when called, will call the underlying RPC
474
+ on the server.
475
+ """
476
+ # Generate a "stub function" on-the-fly which will actually make
477
+ # the request.
478
+ # gRPC handles serialization and deserialization, so we just need
479
+ # to pass in the functions for each.
480
+ if "delete_custom_job" not in self._stubs:
481
+ self._stubs["delete_custom_job"] = self._logged_channel.unary_unary(
482
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteCustomJob",
483
+ request_serializer=job_service.DeleteCustomJobRequest.serialize,
484
+ response_deserializer=operations_pb2.Operation.FromString,
485
+ )
486
+ return self._stubs["delete_custom_job"]
487
+
488
+ @property
489
+ def cancel_custom_job(
490
+ self,
491
+ ) -> Callable[[job_service.CancelCustomJobRequest], Awaitable[empty_pb2.Empty]]:
492
+ r"""Return a callable for the cancel custom job method over gRPC.
493
+
494
+ Cancels a CustomJob. Starts asynchronous cancellation on the
495
+ CustomJob. The server makes a best effort to cancel the job, but
496
+ success is not guaranteed. Clients can use
497
+ [JobService.GetCustomJob][google.cloud.aiplatform.v1beta1.JobService.GetCustomJob]
498
+ or other methods to check whether the cancellation succeeded or
499
+ whether the job completed despite cancellation. On successful
500
+ cancellation, the CustomJob is not deleted; instead it becomes a
501
+ job with a
502
+ [CustomJob.error][google.cloud.aiplatform.v1beta1.CustomJob.error]
503
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
504
+ 1, corresponding to ``Code.CANCELLED``, and
505
+ [CustomJob.state][google.cloud.aiplatform.v1beta1.CustomJob.state]
506
+ is set to ``CANCELLED``.
507
+
508
+ Returns:
509
+ Callable[[~.CancelCustomJobRequest],
510
+ Awaitable[~.Empty]]:
511
+ A function that, when called, will call the underlying RPC
512
+ on the server.
513
+ """
514
+ # Generate a "stub function" on-the-fly which will actually make
515
+ # the request.
516
+ # gRPC handles serialization and deserialization, so we just need
517
+ # to pass in the functions for each.
518
+ if "cancel_custom_job" not in self._stubs:
519
+ self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary(
520
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelCustomJob",
521
+ request_serializer=job_service.CancelCustomJobRequest.serialize,
522
+ response_deserializer=empty_pb2.Empty.FromString,
523
+ )
524
+ return self._stubs["cancel_custom_job"]
525
+
526
+ @property
527
+ def create_data_labeling_job(
528
+ self,
529
+ ) -> Callable[
530
+ [job_service.CreateDataLabelingJobRequest],
531
+ Awaitable[gca_data_labeling_job.DataLabelingJob],
532
+ ]:
533
+ r"""Return a callable for the create data labeling job method over gRPC.
534
+
535
+ Creates a DataLabelingJob.
536
+
537
+ Returns:
538
+ Callable[[~.CreateDataLabelingJobRequest],
539
+ Awaitable[~.DataLabelingJob]]:
540
+ A function that, when called, will call the underlying RPC
541
+ on the server.
542
+ """
543
+ # Generate a "stub function" on-the-fly which will actually make
544
+ # the request.
545
+ # gRPC handles serialization and deserialization, so we just need
546
+ # to pass in the functions for each.
547
+ if "create_data_labeling_job" not in self._stubs:
548
+ self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary(
549
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateDataLabelingJob",
550
+ request_serializer=job_service.CreateDataLabelingJobRequest.serialize,
551
+ response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize,
552
+ )
553
+ return self._stubs["create_data_labeling_job"]
554
+
555
+ @property
556
+ def get_data_labeling_job(
557
+ self,
558
+ ) -> Callable[
559
+ [job_service.GetDataLabelingJobRequest],
560
+ Awaitable[data_labeling_job.DataLabelingJob],
561
+ ]:
562
+ r"""Return a callable for the get data labeling job method over gRPC.
563
+
564
+ Gets a DataLabelingJob.
565
+
566
+ Returns:
567
+ Callable[[~.GetDataLabelingJobRequest],
568
+ Awaitable[~.DataLabelingJob]]:
569
+ A function that, when called, will call the underlying RPC
570
+ on the server.
571
+ """
572
+ # Generate a "stub function" on-the-fly which will actually make
573
+ # the request.
574
+ # gRPC handles serialization and deserialization, so we just need
575
+ # to pass in the functions for each.
576
+ if "get_data_labeling_job" not in self._stubs:
577
+ self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary(
578
+ "/google.cloud.aiplatform.v1beta1.JobService/GetDataLabelingJob",
579
+ request_serializer=job_service.GetDataLabelingJobRequest.serialize,
580
+ response_deserializer=data_labeling_job.DataLabelingJob.deserialize,
581
+ )
582
+ return self._stubs["get_data_labeling_job"]
583
+
584
+ @property
585
+ def list_data_labeling_jobs(
586
+ self,
587
+ ) -> Callable[
588
+ [job_service.ListDataLabelingJobsRequest],
589
+ Awaitable[job_service.ListDataLabelingJobsResponse],
590
+ ]:
591
+ r"""Return a callable for the list data labeling jobs method over gRPC.
592
+
593
+ Lists DataLabelingJobs in a Location.
594
+
595
+ Returns:
596
+ Callable[[~.ListDataLabelingJobsRequest],
597
+ Awaitable[~.ListDataLabelingJobsResponse]]:
598
+ A function that, when called, will call the underlying RPC
599
+ on the server.
600
+ """
601
+ # Generate a "stub function" on-the-fly which will actually make
602
+ # the request.
603
+ # gRPC handles serialization and deserialization, so we just need
604
+ # to pass in the functions for each.
605
+ if "list_data_labeling_jobs" not in self._stubs:
606
+ self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary(
607
+ "/google.cloud.aiplatform.v1beta1.JobService/ListDataLabelingJobs",
608
+ request_serializer=job_service.ListDataLabelingJobsRequest.serialize,
609
+ response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize,
610
+ )
611
+ return self._stubs["list_data_labeling_jobs"]
612
+
613
+ @property
614
+ def delete_data_labeling_job(
615
+ self,
616
+ ) -> Callable[
617
+ [job_service.DeleteDataLabelingJobRequest], Awaitable[operations_pb2.Operation]
618
+ ]:
619
+ r"""Return a callable for the delete data labeling job method over gRPC.
620
+
621
+ Deletes a DataLabelingJob.
622
+
623
+ Returns:
624
+ Callable[[~.DeleteDataLabelingJobRequest],
625
+ Awaitable[~.Operation]]:
626
+ A function that, when called, will call the underlying RPC
627
+ on the server.
628
+ """
629
+ # Generate a "stub function" on-the-fly which will actually make
630
+ # the request.
631
+ # gRPC handles serialization and deserialization, so we just need
632
+ # to pass in the functions for each.
633
+ if "delete_data_labeling_job" not in self._stubs:
634
+ self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary(
635
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteDataLabelingJob",
636
+ request_serializer=job_service.DeleteDataLabelingJobRequest.serialize,
637
+ response_deserializer=operations_pb2.Operation.FromString,
638
+ )
639
+ return self._stubs["delete_data_labeling_job"]
640
+
641
+ @property
642
+ def cancel_data_labeling_job(
643
+ self,
644
+ ) -> Callable[
645
+ [job_service.CancelDataLabelingJobRequest], Awaitable[empty_pb2.Empty]
646
+ ]:
647
+ r"""Return a callable for the cancel data labeling job method over gRPC.
648
+
649
+ Cancels a DataLabelingJob. Success of cancellation is
650
+ not guaranteed.
651
+
652
+ Returns:
653
+ Callable[[~.CancelDataLabelingJobRequest],
654
+ Awaitable[~.Empty]]:
655
+ A function that, when called, will call the underlying RPC
656
+ on the server.
657
+ """
658
+ # Generate a "stub function" on-the-fly which will actually make
659
+ # the request.
660
+ # gRPC handles serialization and deserialization, so we just need
661
+ # to pass in the functions for each.
662
+ if "cancel_data_labeling_job" not in self._stubs:
663
+ self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary(
664
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelDataLabelingJob",
665
+ request_serializer=job_service.CancelDataLabelingJobRequest.serialize,
666
+ response_deserializer=empty_pb2.Empty.FromString,
667
+ )
668
+ return self._stubs["cancel_data_labeling_job"]
669
+
670
+ @property
671
+ def create_hyperparameter_tuning_job(
672
+ self,
673
+ ) -> Callable[
674
+ [job_service.CreateHyperparameterTuningJobRequest],
675
+ Awaitable[gca_hyperparameter_tuning_job.HyperparameterTuningJob],
676
+ ]:
677
+ r"""Return a callable for the create hyperparameter tuning
678
+ job method over gRPC.
679
+
680
+ Creates a HyperparameterTuningJob
681
+
682
+ Returns:
683
+ Callable[[~.CreateHyperparameterTuningJobRequest],
684
+ Awaitable[~.HyperparameterTuningJob]]:
685
+ A function that, when called, will call the underlying RPC
686
+ on the server.
687
+ """
688
+ # Generate a "stub function" on-the-fly which will actually make
689
+ # the request.
690
+ # gRPC handles serialization and deserialization, so we just need
691
+ # to pass in the functions for each.
692
+ if "create_hyperparameter_tuning_job" not in self._stubs:
693
+ self._stubs["create_hyperparameter_tuning_job"] = (
694
+ self._logged_channel.unary_unary(
695
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateHyperparameterTuningJob",
696
+ request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize,
697
+ response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize,
698
+ )
699
+ )
700
+ return self._stubs["create_hyperparameter_tuning_job"]
701
+
702
+ @property
703
+ def get_hyperparameter_tuning_job(
704
+ self,
705
+ ) -> Callable[
706
+ [job_service.GetHyperparameterTuningJobRequest],
707
+ Awaitable[hyperparameter_tuning_job.HyperparameterTuningJob],
708
+ ]:
709
+ r"""Return a callable for the get hyperparameter tuning job method over gRPC.
710
+
711
+ Gets a HyperparameterTuningJob
712
+
713
+ Returns:
714
+ Callable[[~.GetHyperparameterTuningJobRequest],
715
+ Awaitable[~.HyperparameterTuningJob]]:
716
+ A function that, when called, will call the underlying RPC
717
+ on the server.
718
+ """
719
+ # Generate a "stub function" on-the-fly which will actually make
720
+ # the request.
721
+ # gRPC handles serialization and deserialization, so we just need
722
+ # to pass in the functions for each.
723
+ if "get_hyperparameter_tuning_job" not in self._stubs:
724
+ self._stubs["get_hyperparameter_tuning_job"] = (
725
+ self._logged_channel.unary_unary(
726
+ "/google.cloud.aiplatform.v1beta1.JobService/GetHyperparameterTuningJob",
727
+ request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize,
728
+ response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize,
729
+ )
730
+ )
731
+ return self._stubs["get_hyperparameter_tuning_job"]
732
+
733
+ @property
734
+ def list_hyperparameter_tuning_jobs(
735
+ self,
736
+ ) -> Callable[
737
+ [job_service.ListHyperparameterTuningJobsRequest],
738
+ Awaitable[job_service.ListHyperparameterTuningJobsResponse],
739
+ ]:
740
+ r"""Return a callable for the list hyperparameter tuning
741
+ jobs method over gRPC.
742
+
743
+ Lists HyperparameterTuningJobs in a Location.
744
+
745
+ Returns:
746
+ Callable[[~.ListHyperparameterTuningJobsRequest],
747
+ Awaitable[~.ListHyperparameterTuningJobsResponse]]:
748
+ A function that, when called, will call the underlying RPC
749
+ on the server.
750
+ """
751
+ # Generate a "stub function" on-the-fly which will actually make
752
+ # the request.
753
+ # gRPC handles serialization and deserialization, so we just need
754
+ # to pass in the functions for each.
755
+ if "list_hyperparameter_tuning_jobs" not in self._stubs:
756
+ self._stubs["list_hyperparameter_tuning_jobs"] = (
757
+ self._logged_channel.unary_unary(
758
+ "/google.cloud.aiplatform.v1beta1.JobService/ListHyperparameterTuningJobs",
759
+ request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize,
760
+ response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize,
761
+ )
762
+ )
763
+ return self._stubs["list_hyperparameter_tuning_jobs"]
764
+
765
+ @property
766
+ def delete_hyperparameter_tuning_job(
767
+ self,
768
+ ) -> Callable[
769
+ [job_service.DeleteHyperparameterTuningJobRequest],
770
+ Awaitable[operations_pb2.Operation],
771
+ ]:
772
+ r"""Return a callable for the delete hyperparameter tuning
773
+ job method over gRPC.
774
+
775
+ Deletes a HyperparameterTuningJob.
776
+
777
+ Returns:
778
+ Callable[[~.DeleteHyperparameterTuningJobRequest],
779
+ Awaitable[~.Operation]]:
780
+ A function that, when called, will call the underlying RPC
781
+ on the server.
782
+ """
783
+ # Generate a "stub function" on-the-fly which will actually make
784
+ # the request.
785
+ # gRPC handles serialization and deserialization, so we just need
786
+ # to pass in the functions for each.
787
+ if "delete_hyperparameter_tuning_job" not in self._stubs:
788
+ self._stubs["delete_hyperparameter_tuning_job"] = (
789
+ self._logged_channel.unary_unary(
790
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteHyperparameterTuningJob",
791
+ request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize,
792
+ response_deserializer=operations_pb2.Operation.FromString,
793
+ )
794
+ )
795
+ return self._stubs["delete_hyperparameter_tuning_job"]
796
+
797
+ @property
798
+ def cancel_hyperparameter_tuning_job(
799
+ self,
800
+ ) -> Callable[
801
+ [job_service.CancelHyperparameterTuningJobRequest], Awaitable[empty_pb2.Empty]
802
+ ]:
803
+ r"""Return a callable for the cancel hyperparameter tuning
804
+ job method over gRPC.
805
+
806
+ Cancels a HyperparameterTuningJob. Starts asynchronous
807
+ cancellation on the HyperparameterTuningJob. The server makes a
808
+ best effort to cancel the job, but success is not guaranteed.
809
+ Clients can use
810
+ [JobService.GetHyperparameterTuningJob][google.cloud.aiplatform.v1beta1.JobService.GetHyperparameterTuningJob]
811
+ or other methods to check whether the cancellation succeeded or
812
+ whether the job completed despite cancellation. On successful
813
+ cancellation, the HyperparameterTuningJob is not deleted;
814
+ instead it becomes a job with a
815
+ [HyperparameterTuningJob.error][google.cloud.aiplatform.v1beta1.HyperparameterTuningJob.error]
816
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
817
+ 1, corresponding to ``Code.CANCELLED``, and
818
+ [HyperparameterTuningJob.state][google.cloud.aiplatform.v1beta1.HyperparameterTuningJob.state]
819
+ is set to ``CANCELLED``.
820
+
821
+ Returns:
822
+ Callable[[~.CancelHyperparameterTuningJobRequest],
823
+ Awaitable[~.Empty]]:
824
+ A function that, when called, will call the underlying RPC
825
+ on the server.
826
+ """
827
+ # Generate a "stub function" on-the-fly which will actually make
828
+ # the request.
829
+ # gRPC handles serialization and deserialization, so we just need
830
+ # to pass in the functions for each.
831
+ if "cancel_hyperparameter_tuning_job" not in self._stubs:
832
+ self._stubs["cancel_hyperparameter_tuning_job"] = (
833
+ self._logged_channel.unary_unary(
834
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelHyperparameterTuningJob",
835
+ request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize,
836
+ response_deserializer=empty_pb2.Empty.FromString,
837
+ )
838
+ )
839
+ return self._stubs["cancel_hyperparameter_tuning_job"]
840
+
841
+ @property
842
+ def create_nas_job(
843
+ self,
844
+ ) -> Callable[[job_service.CreateNasJobRequest], Awaitable[gca_nas_job.NasJob]]:
845
+ r"""Return a callable for the create nas job method over gRPC.
846
+
847
+ Creates a NasJob
848
+
849
+ Returns:
850
+ Callable[[~.CreateNasJobRequest],
851
+ Awaitable[~.NasJob]]:
852
+ A function that, when called, will call the underlying RPC
853
+ on the server.
854
+ """
855
+ # Generate a "stub function" on-the-fly which will actually make
856
+ # the request.
857
+ # gRPC handles serialization and deserialization, so we just need
858
+ # to pass in the functions for each.
859
+ if "create_nas_job" not in self._stubs:
860
+ self._stubs["create_nas_job"] = self._logged_channel.unary_unary(
861
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateNasJob",
862
+ request_serializer=job_service.CreateNasJobRequest.serialize,
863
+ response_deserializer=gca_nas_job.NasJob.deserialize,
864
+ )
865
+ return self._stubs["create_nas_job"]
866
+
867
+ @property
868
+ def get_nas_job(
869
+ self,
870
+ ) -> Callable[[job_service.GetNasJobRequest], Awaitable[nas_job.NasJob]]:
871
+ r"""Return a callable for the get nas job method over gRPC.
872
+
873
+ Gets a NasJob
874
+
875
+ Returns:
876
+ Callable[[~.GetNasJobRequest],
877
+ Awaitable[~.NasJob]]:
878
+ A function that, when called, will call the underlying RPC
879
+ on the server.
880
+ """
881
+ # Generate a "stub function" on-the-fly which will actually make
882
+ # the request.
883
+ # gRPC handles serialization and deserialization, so we just need
884
+ # to pass in the functions for each.
885
+ if "get_nas_job" not in self._stubs:
886
+ self._stubs["get_nas_job"] = self._logged_channel.unary_unary(
887
+ "/google.cloud.aiplatform.v1beta1.JobService/GetNasJob",
888
+ request_serializer=job_service.GetNasJobRequest.serialize,
889
+ response_deserializer=nas_job.NasJob.deserialize,
890
+ )
891
+ return self._stubs["get_nas_job"]
892
+
893
+ @property
894
+ def list_nas_jobs(
895
+ self,
896
+ ) -> Callable[
897
+ [job_service.ListNasJobsRequest], Awaitable[job_service.ListNasJobsResponse]
898
+ ]:
899
+ r"""Return a callable for the list nas jobs method over gRPC.
900
+
901
+ Lists NasJobs in a Location.
902
+
903
+ Returns:
904
+ Callable[[~.ListNasJobsRequest],
905
+ Awaitable[~.ListNasJobsResponse]]:
906
+ A function that, when called, will call the underlying RPC
907
+ on the server.
908
+ """
909
+ # Generate a "stub function" on-the-fly which will actually make
910
+ # the request.
911
+ # gRPC handles serialization and deserialization, so we just need
912
+ # to pass in the functions for each.
913
+ if "list_nas_jobs" not in self._stubs:
914
+ self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary(
915
+ "/google.cloud.aiplatform.v1beta1.JobService/ListNasJobs",
916
+ request_serializer=job_service.ListNasJobsRequest.serialize,
917
+ response_deserializer=job_service.ListNasJobsResponse.deserialize,
918
+ )
919
+ return self._stubs["list_nas_jobs"]
920
+
921
+ @property
922
+ def delete_nas_job(
923
+ self,
924
+ ) -> Callable[
925
+ [job_service.DeleteNasJobRequest], Awaitable[operations_pb2.Operation]
926
+ ]:
927
+ r"""Return a callable for the delete nas job method over gRPC.
928
+
929
+ Deletes a NasJob.
930
+
931
+ Returns:
932
+ Callable[[~.DeleteNasJobRequest],
933
+ Awaitable[~.Operation]]:
934
+ A function that, when called, will call the underlying RPC
935
+ on the server.
936
+ """
937
+ # Generate a "stub function" on-the-fly which will actually make
938
+ # the request.
939
+ # gRPC handles serialization and deserialization, so we just need
940
+ # to pass in the functions for each.
941
+ if "delete_nas_job" not in self._stubs:
942
+ self._stubs["delete_nas_job"] = self._logged_channel.unary_unary(
943
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteNasJob",
944
+ request_serializer=job_service.DeleteNasJobRequest.serialize,
945
+ response_deserializer=operations_pb2.Operation.FromString,
946
+ )
947
+ return self._stubs["delete_nas_job"]
948
+
949
+ @property
950
+ def cancel_nas_job(
951
+ self,
952
+ ) -> Callable[[job_service.CancelNasJobRequest], Awaitable[empty_pb2.Empty]]:
953
+ r"""Return a callable for the cancel nas job method over gRPC.
954
+
955
+ Cancels a NasJob. Starts asynchronous cancellation on the
956
+ NasJob. The server makes a best effort to cancel the job, but
957
+ success is not guaranteed. Clients can use
958
+ [JobService.GetNasJob][google.cloud.aiplatform.v1beta1.JobService.GetNasJob]
959
+ or other methods to check whether the cancellation succeeded or
960
+ whether the job completed despite cancellation. On successful
961
+ cancellation, the NasJob is not deleted; instead it becomes a
962
+ job with a
963
+ [NasJob.error][google.cloud.aiplatform.v1beta1.NasJob.error]
964
+ value with a [google.rpc.Status.code][google.rpc.Status.code] of
965
+ 1, corresponding to ``Code.CANCELLED``, and
966
+ [NasJob.state][google.cloud.aiplatform.v1beta1.NasJob.state] is
967
+ set to ``CANCELLED``.
968
+
969
+ Returns:
970
+ Callable[[~.CancelNasJobRequest],
971
+ Awaitable[~.Empty]]:
972
+ A function that, when called, will call the underlying RPC
973
+ on the server.
974
+ """
975
+ # Generate a "stub function" on-the-fly which will actually make
976
+ # the request.
977
+ # gRPC handles serialization and deserialization, so we just need
978
+ # to pass in the functions for each.
979
+ if "cancel_nas_job" not in self._stubs:
980
+ self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary(
981
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelNasJob",
982
+ request_serializer=job_service.CancelNasJobRequest.serialize,
983
+ response_deserializer=empty_pb2.Empty.FromString,
984
+ )
985
+ return self._stubs["cancel_nas_job"]
986
+
987
+ @property
988
+ def get_nas_trial_detail(
989
+ self,
990
+ ) -> Callable[
991
+ [job_service.GetNasTrialDetailRequest], Awaitable[nas_job.NasTrialDetail]
992
+ ]:
993
+ r"""Return a callable for the get nas trial detail method over gRPC.
994
+
995
+ Gets a NasTrialDetail.
996
+
997
+ Returns:
998
+ Callable[[~.GetNasTrialDetailRequest],
999
+ Awaitable[~.NasTrialDetail]]:
1000
+ A function that, when called, will call the underlying RPC
1001
+ on the server.
1002
+ """
1003
+ # Generate a "stub function" on-the-fly which will actually make
1004
+ # the request.
1005
+ # gRPC handles serialization and deserialization, so we just need
1006
+ # to pass in the functions for each.
1007
+ if "get_nas_trial_detail" not in self._stubs:
1008
+ self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary(
1009
+ "/google.cloud.aiplatform.v1beta1.JobService/GetNasTrialDetail",
1010
+ request_serializer=job_service.GetNasTrialDetailRequest.serialize,
1011
+ response_deserializer=nas_job.NasTrialDetail.deserialize,
1012
+ )
1013
+ return self._stubs["get_nas_trial_detail"]
1014
+
1015
+ @property
1016
+ def list_nas_trial_details(
1017
+ self,
1018
+ ) -> Callable[
1019
+ [job_service.ListNasTrialDetailsRequest],
1020
+ Awaitable[job_service.ListNasTrialDetailsResponse],
1021
+ ]:
1022
+ r"""Return a callable for the list nas trial details method over gRPC.
1023
+
1024
+ List top NasTrialDetails of a NasJob.
1025
+
1026
+ Returns:
1027
+ Callable[[~.ListNasTrialDetailsRequest],
1028
+ Awaitable[~.ListNasTrialDetailsResponse]]:
1029
+ A function that, when called, will call the underlying RPC
1030
+ on the server.
1031
+ """
1032
+ # Generate a "stub function" on-the-fly which will actually make
1033
+ # the request.
1034
+ # gRPC handles serialization and deserialization, so we just need
1035
+ # to pass in the functions for each.
1036
+ if "list_nas_trial_details" not in self._stubs:
1037
+ self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary(
1038
+ "/google.cloud.aiplatform.v1beta1.JobService/ListNasTrialDetails",
1039
+ request_serializer=job_service.ListNasTrialDetailsRequest.serialize,
1040
+ response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize,
1041
+ )
1042
+ return self._stubs["list_nas_trial_details"]
1043
+
1044
+ @property
1045
+ def create_batch_prediction_job(
1046
+ self,
1047
+ ) -> Callable[
1048
+ [job_service.CreateBatchPredictionJobRequest],
1049
+ Awaitable[gca_batch_prediction_job.BatchPredictionJob],
1050
+ ]:
1051
+ r"""Return a callable for the create batch prediction job method over gRPC.
1052
+
1053
+ Creates a BatchPredictionJob. A BatchPredictionJob
1054
+ once created will right away be attempted to start.
1055
+
1056
+ Returns:
1057
+ Callable[[~.CreateBatchPredictionJobRequest],
1058
+ Awaitable[~.BatchPredictionJob]]:
1059
+ A function that, when called, will call the underlying RPC
1060
+ on the server.
1061
+ """
1062
+ # Generate a "stub function" on-the-fly which will actually make
1063
+ # the request.
1064
+ # gRPC handles serialization and deserialization, so we just need
1065
+ # to pass in the functions for each.
1066
+ if "create_batch_prediction_job" not in self._stubs:
1067
+ self._stubs["create_batch_prediction_job"] = (
1068
+ self._logged_channel.unary_unary(
1069
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateBatchPredictionJob",
1070
+ request_serializer=job_service.CreateBatchPredictionJobRequest.serialize,
1071
+ response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize,
1072
+ )
1073
+ )
1074
+ return self._stubs["create_batch_prediction_job"]
1075
+
1076
+ @property
1077
+ def get_batch_prediction_job(
1078
+ self,
1079
+ ) -> Callable[
1080
+ [job_service.GetBatchPredictionJobRequest],
1081
+ Awaitable[batch_prediction_job.BatchPredictionJob],
1082
+ ]:
1083
+ r"""Return a callable for the get batch prediction job method over gRPC.
1084
+
1085
+ Gets a BatchPredictionJob
1086
+
1087
+ Returns:
1088
+ Callable[[~.GetBatchPredictionJobRequest],
1089
+ Awaitable[~.BatchPredictionJob]]:
1090
+ A function that, when called, will call the underlying RPC
1091
+ on the server.
1092
+ """
1093
+ # Generate a "stub function" on-the-fly which will actually make
1094
+ # the request.
1095
+ # gRPC handles serialization and deserialization, so we just need
1096
+ # to pass in the functions for each.
1097
+ if "get_batch_prediction_job" not in self._stubs:
1098
+ self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary(
1099
+ "/google.cloud.aiplatform.v1beta1.JobService/GetBatchPredictionJob",
1100
+ request_serializer=job_service.GetBatchPredictionJobRequest.serialize,
1101
+ response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize,
1102
+ )
1103
+ return self._stubs["get_batch_prediction_job"]
1104
+
1105
+ @property
1106
+ def list_batch_prediction_jobs(
1107
+ self,
1108
+ ) -> Callable[
1109
+ [job_service.ListBatchPredictionJobsRequest],
1110
+ Awaitable[job_service.ListBatchPredictionJobsResponse],
1111
+ ]:
1112
+ r"""Return a callable for the list batch prediction jobs method over gRPC.
1113
+
1114
+ Lists BatchPredictionJobs in a Location.
1115
+
1116
+ Returns:
1117
+ Callable[[~.ListBatchPredictionJobsRequest],
1118
+ Awaitable[~.ListBatchPredictionJobsResponse]]:
1119
+ A function that, when called, will call the underlying RPC
1120
+ on the server.
1121
+ """
1122
+ # Generate a "stub function" on-the-fly which will actually make
1123
+ # the request.
1124
+ # gRPC handles serialization and deserialization, so we just need
1125
+ # to pass in the functions for each.
1126
+ if "list_batch_prediction_jobs" not in self._stubs:
1127
+ self._stubs["list_batch_prediction_jobs"] = (
1128
+ self._logged_channel.unary_unary(
1129
+ "/google.cloud.aiplatform.v1beta1.JobService/ListBatchPredictionJobs",
1130
+ request_serializer=job_service.ListBatchPredictionJobsRequest.serialize,
1131
+ response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize,
1132
+ )
1133
+ )
1134
+ return self._stubs["list_batch_prediction_jobs"]
1135
+
1136
+ @property
1137
+ def delete_batch_prediction_job(
1138
+ self,
1139
+ ) -> Callable[
1140
+ [job_service.DeleteBatchPredictionJobRequest],
1141
+ Awaitable[operations_pb2.Operation],
1142
+ ]:
1143
+ r"""Return a callable for the delete batch prediction job method over gRPC.
1144
+
1145
+ Deletes a BatchPredictionJob. Can only be called on
1146
+ jobs that already finished.
1147
+
1148
+ Returns:
1149
+ Callable[[~.DeleteBatchPredictionJobRequest],
1150
+ Awaitable[~.Operation]]:
1151
+ A function that, when called, will call the underlying RPC
1152
+ on the server.
1153
+ """
1154
+ # Generate a "stub function" on-the-fly which will actually make
1155
+ # the request.
1156
+ # gRPC handles serialization and deserialization, so we just need
1157
+ # to pass in the functions for each.
1158
+ if "delete_batch_prediction_job" not in self._stubs:
1159
+ self._stubs["delete_batch_prediction_job"] = (
1160
+ self._logged_channel.unary_unary(
1161
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteBatchPredictionJob",
1162
+ request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize,
1163
+ response_deserializer=operations_pb2.Operation.FromString,
1164
+ )
1165
+ )
1166
+ return self._stubs["delete_batch_prediction_job"]
1167
+
1168
+ @property
1169
+ def cancel_batch_prediction_job(
1170
+ self,
1171
+ ) -> Callable[
1172
+ [job_service.CancelBatchPredictionJobRequest], Awaitable[empty_pb2.Empty]
1173
+ ]:
1174
+ r"""Return a callable for the cancel batch prediction job method over gRPC.
1175
+
1176
+ Cancels a BatchPredictionJob.
1177
+
1178
+ Starts asynchronous cancellation on the BatchPredictionJob. The
1179
+ server makes the best effort to cancel the job, but success is
1180
+ not guaranteed. Clients can use
1181
+ [JobService.GetBatchPredictionJob][google.cloud.aiplatform.v1beta1.JobService.GetBatchPredictionJob]
1182
+ or other methods to check whether the cancellation succeeded or
1183
+ whether the job completed despite cancellation. On a successful
1184
+ cancellation, the BatchPredictionJob is not deleted;instead its
1185
+ [BatchPredictionJob.state][google.cloud.aiplatform.v1beta1.BatchPredictionJob.state]
1186
+ is set to ``CANCELLED``. Any files already outputted by the job
1187
+ are not deleted.
1188
+
1189
+ Returns:
1190
+ Callable[[~.CancelBatchPredictionJobRequest],
1191
+ Awaitable[~.Empty]]:
1192
+ A function that, when called, will call the underlying RPC
1193
+ on the server.
1194
+ """
1195
+ # Generate a "stub function" on-the-fly which will actually make
1196
+ # the request.
1197
+ # gRPC handles serialization and deserialization, so we just need
1198
+ # to pass in the functions for each.
1199
+ if "cancel_batch_prediction_job" not in self._stubs:
1200
+ self._stubs["cancel_batch_prediction_job"] = (
1201
+ self._logged_channel.unary_unary(
1202
+ "/google.cloud.aiplatform.v1beta1.JobService/CancelBatchPredictionJob",
1203
+ request_serializer=job_service.CancelBatchPredictionJobRequest.serialize,
1204
+ response_deserializer=empty_pb2.Empty.FromString,
1205
+ )
1206
+ )
1207
+ return self._stubs["cancel_batch_prediction_job"]
1208
+
1209
+ @property
1210
+ def create_model_deployment_monitoring_job(
1211
+ self,
1212
+ ) -> Callable[
1213
+ [job_service.CreateModelDeploymentMonitoringJobRequest],
1214
+ Awaitable[gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob],
1215
+ ]:
1216
+ r"""Return a callable for the create model deployment
1217
+ monitoring job method over gRPC.
1218
+
1219
+ Creates a ModelDeploymentMonitoringJob. It will run
1220
+ periodically on a configured interval.
1221
+
1222
+ Returns:
1223
+ Callable[[~.CreateModelDeploymentMonitoringJobRequest],
1224
+ Awaitable[~.ModelDeploymentMonitoringJob]]:
1225
+ A function that, when called, will call the underlying RPC
1226
+ on the server.
1227
+ """
1228
+ # Generate a "stub function" on-the-fly which will actually make
1229
+ # the request.
1230
+ # gRPC handles serialization and deserialization, so we just need
1231
+ # to pass in the functions for each.
1232
+ if "create_model_deployment_monitoring_job" not in self._stubs:
1233
+ self._stubs["create_model_deployment_monitoring_job"] = (
1234
+ self._logged_channel.unary_unary(
1235
+ "/google.cloud.aiplatform.v1beta1.JobService/CreateModelDeploymentMonitoringJob",
1236
+ request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize,
1237
+ response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize,
1238
+ )
1239
+ )
1240
+ return self._stubs["create_model_deployment_monitoring_job"]
1241
+
1242
+ @property
1243
+ def search_model_deployment_monitoring_stats_anomalies(
1244
+ self,
1245
+ ) -> Callable[
1246
+ [job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest],
1247
+ Awaitable[job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse],
1248
+ ]:
1249
+ r"""Return a callable for the search model deployment
1250
+ monitoring stats anomalies method over gRPC.
1251
+
1252
+ Searches Model Monitoring Statistics generated within
1253
+ a given time window.
1254
+
1255
+ Returns:
1256
+ Callable[[~.SearchModelDeploymentMonitoringStatsAnomaliesRequest],
1257
+ Awaitable[~.SearchModelDeploymentMonitoringStatsAnomaliesResponse]]:
1258
+ A function that, when called, will call the underlying RPC
1259
+ on the server.
1260
+ """
1261
+ # Generate a "stub function" on-the-fly which will actually make
1262
+ # the request.
1263
+ # gRPC handles serialization and deserialization, so we just need
1264
+ # to pass in the functions for each.
1265
+ if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs:
1266
+ self._stubs["search_model_deployment_monitoring_stats_anomalies"] = (
1267
+ self._logged_channel.unary_unary(
1268
+ "/google.cloud.aiplatform.v1beta1.JobService/SearchModelDeploymentMonitoringStatsAnomalies",
1269
+ request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize,
1270
+ response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize,
1271
+ )
1272
+ )
1273
+ return self._stubs["search_model_deployment_monitoring_stats_anomalies"]
1274
+
1275
+ @property
1276
+ def get_model_deployment_monitoring_job(
1277
+ self,
1278
+ ) -> Callable[
1279
+ [job_service.GetModelDeploymentMonitoringJobRequest],
1280
+ Awaitable[model_deployment_monitoring_job.ModelDeploymentMonitoringJob],
1281
+ ]:
1282
+ r"""Return a callable for the get model deployment
1283
+ monitoring job method over gRPC.
1284
+
1285
+ Gets a ModelDeploymentMonitoringJob.
1286
+
1287
+ Returns:
1288
+ Callable[[~.GetModelDeploymentMonitoringJobRequest],
1289
+ Awaitable[~.ModelDeploymentMonitoringJob]]:
1290
+ A function that, when called, will call the underlying RPC
1291
+ on the server.
1292
+ """
1293
+ # Generate a "stub function" on-the-fly which will actually make
1294
+ # the request.
1295
+ # gRPC handles serialization and deserialization, so we just need
1296
+ # to pass in the functions for each.
1297
+ if "get_model_deployment_monitoring_job" not in self._stubs:
1298
+ self._stubs["get_model_deployment_monitoring_job"] = (
1299
+ self._logged_channel.unary_unary(
1300
+ "/google.cloud.aiplatform.v1beta1.JobService/GetModelDeploymentMonitoringJob",
1301
+ request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize,
1302
+ response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize,
1303
+ )
1304
+ )
1305
+ return self._stubs["get_model_deployment_monitoring_job"]
1306
+
1307
+ @property
1308
+ def list_model_deployment_monitoring_jobs(
1309
+ self,
1310
+ ) -> Callable[
1311
+ [job_service.ListModelDeploymentMonitoringJobsRequest],
1312
+ Awaitable[job_service.ListModelDeploymentMonitoringJobsResponse],
1313
+ ]:
1314
+ r"""Return a callable for the list model deployment
1315
+ monitoring jobs method over gRPC.
1316
+
1317
+ Lists ModelDeploymentMonitoringJobs in a Location.
1318
+
1319
+ Returns:
1320
+ Callable[[~.ListModelDeploymentMonitoringJobsRequest],
1321
+ Awaitable[~.ListModelDeploymentMonitoringJobsResponse]]:
1322
+ A function that, when called, will call the underlying RPC
1323
+ on the server.
1324
+ """
1325
+ # Generate a "stub function" on-the-fly which will actually make
1326
+ # the request.
1327
+ # gRPC handles serialization and deserialization, so we just need
1328
+ # to pass in the functions for each.
1329
+ if "list_model_deployment_monitoring_jobs" not in self._stubs:
1330
+ self._stubs["list_model_deployment_monitoring_jobs"] = (
1331
+ self._logged_channel.unary_unary(
1332
+ "/google.cloud.aiplatform.v1beta1.JobService/ListModelDeploymentMonitoringJobs",
1333
+ request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize,
1334
+ response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize,
1335
+ )
1336
+ )
1337
+ return self._stubs["list_model_deployment_monitoring_jobs"]
1338
+
1339
+ @property
1340
+ def update_model_deployment_monitoring_job(
1341
+ self,
1342
+ ) -> Callable[
1343
+ [job_service.UpdateModelDeploymentMonitoringJobRequest],
1344
+ Awaitable[operations_pb2.Operation],
1345
+ ]:
1346
+ r"""Return a callable for the update model deployment
1347
+ monitoring job method over gRPC.
1348
+
1349
+ Updates a ModelDeploymentMonitoringJob.
1350
+
1351
+ Returns:
1352
+ Callable[[~.UpdateModelDeploymentMonitoringJobRequest],
1353
+ Awaitable[~.Operation]]:
1354
+ A function that, when called, will call the underlying RPC
1355
+ on the server.
1356
+ """
1357
+ # Generate a "stub function" on-the-fly which will actually make
1358
+ # the request.
1359
+ # gRPC handles serialization and deserialization, so we just need
1360
+ # to pass in the functions for each.
1361
+ if "update_model_deployment_monitoring_job" not in self._stubs:
1362
+ self._stubs["update_model_deployment_monitoring_job"] = (
1363
+ self._logged_channel.unary_unary(
1364
+ "/google.cloud.aiplatform.v1beta1.JobService/UpdateModelDeploymentMonitoringJob",
1365
+ request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize,
1366
+ response_deserializer=operations_pb2.Operation.FromString,
1367
+ )
1368
+ )
1369
+ return self._stubs["update_model_deployment_monitoring_job"]
1370
+
1371
+ @property
1372
+ def delete_model_deployment_monitoring_job(
1373
+ self,
1374
+ ) -> Callable[
1375
+ [job_service.DeleteModelDeploymentMonitoringJobRequest],
1376
+ Awaitable[operations_pb2.Operation],
1377
+ ]:
1378
+ r"""Return a callable for the delete model deployment
1379
+ monitoring job method over gRPC.
1380
+
1381
+ Deletes a ModelDeploymentMonitoringJob.
1382
+
1383
+ Returns:
1384
+ Callable[[~.DeleteModelDeploymentMonitoringJobRequest],
1385
+ Awaitable[~.Operation]]:
1386
+ A function that, when called, will call the underlying RPC
1387
+ on the server.
1388
+ """
1389
+ # Generate a "stub function" on-the-fly which will actually make
1390
+ # the request.
1391
+ # gRPC handles serialization and deserialization, so we just need
1392
+ # to pass in the functions for each.
1393
+ if "delete_model_deployment_monitoring_job" not in self._stubs:
1394
+ self._stubs["delete_model_deployment_monitoring_job"] = (
1395
+ self._logged_channel.unary_unary(
1396
+ "/google.cloud.aiplatform.v1beta1.JobService/DeleteModelDeploymentMonitoringJob",
1397
+ request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize,
1398
+ response_deserializer=operations_pb2.Operation.FromString,
1399
+ )
1400
+ )
1401
+ return self._stubs["delete_model_deployment_monitoring_job"]
1402
+
1403
+ @property
1404
+ def pause_model_deployment_monitoring_job(
1405
+ self,
1406
+ ) -> Callable[
1407
+ [job_service.PauseModelDeploymentMonitoringJobRequest],
1408
+ Awaitable[empty_pb2.Empty],
1409
+ ]:
1410
+ r"""Return a callable for the pause model deployment
1411
+ monitoring job method over gRPC.
1412
+
1413
+ Pauses a ModelDeploymentMonitoringJob. If the job is running,
1414
+ the server makes a best effort to cancel the job. Will mark
1415
+ [ModelDeploymentMonitoringJob.state][google.cloud.aiplatform.v1beta1.ModelDeploymentMonitoringJob.state]
1416
+ to 'PAUSED'.
1417
+
1418
+ Returns:
1419
+ Callable[[~.PauseModelDeploymentMonitoringJobRequest],
1420
+ Awaitable[~.Empty]]:
1421
+ A function that, when called, will call the underlying RPC
1422
+ on the server.
1423
+ """
1424
+ # Generate a "stub function" on-the-fly which will actually make
1425
+ # the request.
1426
+ # gRPC handles serialization and deserialization, so we just need
1427
+ # to pass in the functions for each.
1428
+ if "pause_model_deployment_monitoring_job" not in self._stubs:
1429
+ self._stubs["pause_model_deployment_monitoring_job"] = (
1430
+ self._logged_channel.unary_unary(
1431
+ "/google.cloud.aiplatform.v1beta1.JobService/PauseModelDeploymentMonitoringJob",
1432
+ request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize,
1433
+ response_deserializer=empty_pb2.Empty.FromString,
1434
+ )
1435
+ )
1436
+ return self._stubs["pause_model_deployment_monitoring_job"]
1437
+
1438
+ @property
1439
+ def resume_model_deployment_monitoring_job(
1440
+ self,
1441
+ ) -> Callable[
1442
+ [job_service.ResumeModelDeploymentMonitoringJobRequest],
1443
+ Awaitable[empty_pb2.Empty],
1444
+ ]:
1445
+ r"""Return a callable for the resume model deployment
1446
+ monitoring job method over gRPC.
1447
+
1448
+ Resumes a paused ModelDeploymentMonitoringJob. It
1449
+ will start to run from next scheduled time. A deleted
1450
+ ModelDeploymentMonitoringJob can't be resumed.
1451
+
1452
+ Returns:
1453
+ Callable[[~.ResumeModelDeploymentMonitoringJobRequest],
1454
+ Awaitable[~.Empty]]:
1455
+ A function that, when called, will call the underlying RPC
1456
+ on the server.
1457
+ """
1458
+ # Generate a "stub function" on-the-fly which will actually make
1459
+ # the request.
1460
+ # gRPC handles serialization and deserialization, so we just need
1461
+ # to pass in the functions for each.
1462
+ if "resume_model_deployment_monitoring_job" not in self._stubs:
1463
+ self._stubs["resume_model_deployment_monitoring_job"] = (
1464
+ self._logged_channel.unary_unary(
1465
+ "/google.cloud.aiplatform.v1beta1.JobService/ResumeModelDeploymentMonitoringJob",
1466
+ request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize,
1467
+ response_deserializer=empty_pb2.Empty.FromString,
1468
+ )
1469
+ )
1470
+ return self._stubs["resume_model_deployment_monitoring_job"]
1471
+
1472
+ def _prep_wrapped_messages(self, client_info):
1473
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
1474
+ self._wrapped_methods = {
1475
+ self.create_custom_job: self._wrap_method(
1476
+ self.create_custom_job,
1477
+ default_timeout=5.0,
1478
+ client_info=client_info,
1479
+ ),
1480
+ self.get_custom_job: self._wrap_method(
1481
+ self.get_custom_job,
1482
+ default_timeout=5.0,
1483
+ client_info=client_info,
1484
+ ),
1485
+ self.list_custom_jobs: self._wrap_method(
1486
+ self.list_custom_jobs,
1487
+ default_timeout=5.0,
1488
+ client_info=client_info,
1489
+ ),
1490
+ self.delete_custom_job: self._wrap_method(
1491
+ self.delete_custom_job,
1492
+ default_timeout=5.0,
1493
+ client_info=client_info,
1494
+ ),
1495
+ self.cancel_custom_job: self._wrap_method(
1496
+ self.cancel_custom_job,
1497
+ default_timeout=5.0,
1498
+ client_info=client_info,
1499
+ ),
1500
+ self.create_data_labeling_job: self._wrap_method(
1501
+ self.create_data_labeling_job,
1502
+ default_timeout=5.0,
1503
+ client_info=client_info,
1504
+ ),
1505
+ self.get_data_labeling_job: self._wrap_method(
1506
+ self.get_data_labeling_job,
1507
+ default_timeout=5.0,
1508
+ client_info=client_info,
1509
+ ),
1510
+ self.list_data_labeling_jobs: self._wrap_method(
1511
+ self.list_data_labeling_jobs,
1512
+ default_timeout=5.0,
1513
+ client_info=client_info,
1514
+ ),
1515
+ self.delete_data_labeling_job: self._wrap_method(
1516
+ self.delete_data_labeling_job,
1517
+ default_timeout=5.0,
1518
+ client_info=client_info,
1519
+ ),
1520
+ self.cancel_data_labeling_job: self._wrap_method(
1521
+ self.cancel_data_labeling_job,
1522
+ default_timeout=5.0,
1523
+ client_info=client_info,
1524
+ ),
1525
+ self.create_hyperparameter_tuning_job: self._wrap_method(
1526
+ self.create_hyperparameter_tuning_job,
1527
+ default_timeout=5.0,
1528
+ client_info=client_info,
1529
+ ),
1530
+ self.get_hyperparameter_tuning_job: self._wrap_method(
1531
+ self.get_hyperparameter_tuning_job,
1532
+ default_timeout=5.0,
1533
+ client_info=client_info,
1534
+ ),
1535
+ self.list_hyperparameter_tuning_jobs: self._wrap_method(
1536
+ self.list_hyperparameter_tuning_jobs,
1537
+ default_timeout=5.0,
1538
+ client_info=client_info,
1539
+ ),
1540
+ self.delete_hyperparameter_tuning_job: self._wrap_method(
1541
+ self.delete_hyperparameter_tuning_job,
1542
+ default_timeout=5.0,
1543
+ client_info=client_info,
1544
+ ),
1545
+ self.cancel_hyperparameter_tuning_job: self._wrap_method(
1546
+ self.cancel_hyperparameter_tuning_job,
1547
+ default_timeout=5.0,
1548
+ client_info=client_info,
1549
+ ),
1550
+ self.create_nas_job: self._wrap_method(
1551
+ self.create_nas_job,
1552
+ default_timeout=None,
1553
+ client_info=client_info,
1554
+ ),
1555
+ self.get_nas_job: self._wrap_method(
1556
+ self.get_nas_job,
1557
+ default_timeout=None,
1558
+ client_info=client_info,
1559
+ ),
1560
+ self.list_nas_jobs: self._wrap_method(
1561
+ self.list_nas_jobs,
1562
+ default_timeout=None,
1563
+ client_info=client_info,
1564
+ ),
1565
+ self.delete_nas_job: self._wrap_method(
1566
+ self.delete_nas_job,
1567
+ default_timeout=None,
1568
+ client_info=client_info,
1569
+ ),
1570
+ self.cancel_nas_job: self._wrap_method(
1571
+ self.cancel_nas_job,
1572
+ default_timeout=None,
1573
+ client_info=client_info,
1574
+ ),
1575
+ self.get_nas_trial_detail: self._wrap_method(
1576
+ self.get_nas_trial_detail,
1577
+ default_timeout=None,
1578
+ client_info=client_info,
1579
+ ),
1580
+ self.list_nas_trial_details: self._wrap_method(
1581
+ self.list_nas_trial_details,
1582
+ default_timeout=None,
1583
+ client_info=client_info,
1584
+ ),
1585
+ self.create_batch_prediction_job: self._wrap_method(
1586
+ self.create_batch_prediction_job,
1587
+ default_timeout=5.0,
1588
+ client_info=client_info,
1589
+ ),
1590
+ self.get_batch_prediction_job: self._wrap_method(
1591
+ self.get_batch_prediction_job,
1592
+ default_timeout=5.0,
1593
+ client_info=client_info,
1594
+ ),
1595
+ self.list_batch_prediction_jobs: self._wrap_method(
1596
+ self.list_batch_prediction_jobs,
1597
+ default_timeout=5.0,
1598
+ client_info=client_info,
1599
+ ),
1600
+ self.delete_batch_prediction_job: self._wrap_method(
1601
+ self.delete_batch_prediction_job,
1602
+ default_timeout=5.0,
1603
+ client_info=client_info,
1604
+ ),
1605
+ self.cancel_batch_prediction_job: self._wrap_method(
1606
+ self.cancel_batch_prediction_job,
1607
+ default_timeout=5.0,
1608
+ client_info=client_info,
1609
+ ),
1610
+ self.create_model_deployment_monitoring_job: self._wrap_method(
1611
+ self.create_model_deployment_monitoring_job,
1612
+ default_timeout=60.0,
1613
+ client_info=client_info,
1614
+ ),
1615
+ self.search_model_deployment_monitoring_stats_anomalies: self._wrap_method(
1616
+ self.search_model_deployment_monitoring_stats_anomalies,
1617
+ default_timeout=5.0,
1618
+ client_info=client_info,
1619
+ ),
1620
+ self.get_model_deployment_monitoring_job: self._wrap_method(
1621
+ self.get_model_deployment_monitoring_job,
1622
+ default_timeout=5.0,
1623
+ client_info=client_info,
1624
+ ),
1625
+ self.list_model_deployment_monitoring_jobs: self._wrap_method(
1626
+ self.list_model_deployment_monitoring_jobs,
1627
+ default_timeout=5.0,
1628
+ client_info=client_info,
1629
+ ),
1630
+ self.update_model_deployment_monitoring_job: self._wrap_method(
1631
+ self.update_model_deployment_monitoring_job,
1632
+ default_timeout=5.0,
1633
+ client_info=client_info,
1634
+ ),
1635
+ self.delete_model_deployment_monitoring_job: self._wrap_method(
1636
+ self.delete_model_deployment_monitoring_job,
1637
+ default_timeout=5.0,
1638
+ client_info=client_info,
1639
+ ),
1640
+ self.pause_model_deployment_monitoring_job: self._wrap_method(
1641
+ self.pause_model_deployment_monitoring_job,
1642
+ default_timeout=5.0,
1643
+ client_info=client_info,
1644
+ ),
1645
+ self.resume_model_deployment_monitoring_job: self._wrap_method(
1646
+ self.resume_model_deployment_monitoring_job,
1647
+ default_timeout=5.0,
1648
+ client_info=client_info,
1649
+ ),
1650
+ self.get_location: self._wrap_method(
1651
+ self.get_location,
1652
+ default_timeout=None,
1653
+ client_info=client_info,
1654
+ ),
1655
+ self.list_locations: self._wrap_method(
1656
+ self.list_locations,
1657
+ default_timeout=None,
1658
+ client_info=client_info,
1659
+ ),
1660
+ self.get_iam_policy: self._wrap_method(
1661
+ self.get_iam_policy,
1662
+ default_timeout=None,
1663
+ client_info=client_info,
1664
+ ),
1665
+ self.set_iam_policy: self._wrap_method(
1666
+ self.set_iam_policy,
1667
+ default_timeout=None,
1668
+ client_info=client_info,
1669
+ ),
1670
+ self.test_iam_permissions: self._wrap_method(
1671
+ self.test_iam_permissions,
1672
+ default_timeout=None,
1673
+ client_info=client_info,
1674
+ ),
1675
+ self.cancel_operation: self._wrap_method(
1676
+ self.cancel_operation,
1677
+ default_timeout=None,
1678
+ client_info=client_info,
1679
+ ),
1680
+ self.delete_operation: self._wrap_method(
1681
+ self.delete_operation,
1682
+ default_timeout=None,
1683
+ client_info=client_info,
1684
+ ),
1685
+ self.get_operation: self._wrap_method(
1686
+ self.get_operation,
1687
+ default_timeout=None,
1688
+ client_info=client_info,
1689
+ ),
1690
+ self.list_operations: self._wrap_method(
1691
+ self.list_operations,
1692
+ default_timeout=None,
1693
+ client_info=client_info,
1694
+ ),
1695
+ self.wait_operation: self._wrap_method(
1696
+ self.wait_operation,
1697
+ default_timeout=None,
1698
+ client_info=client_info,
1699
+ ),
1700
+ }
1701
+
1702
+ def _wrap_method(self, func, *args, **kwargs):
1703
+ if self._wrap_with_kind: # pragma: NO COVER
1704
+ kwargs["kind"] = self.kind
1705
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
1706
+
1707
+ def close(self):
1708
+ return self._logged_channel.close()
1709
+
1710
+ @property
1711
+ def kind(self) -> str:
1712
+ return "grpc_asyncio"
1713
+
1714
+ @property
1715
+ def delete_operation(
1716
+ self,
1717
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
1718
+ r"""Return a callable for the delete_operation method over gRPC."""
1719
+ # Generate a "stub function" on-the-fly which will actually make
1720
+ # the request.
1721
+ # gRPC handles serialization and deserialization, so we just need
1722
+ # to pass in the functions for each.
1723
+ if "delete_operation" not in self._stubs:
1724
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
1725
+ "/google.longrunning.Operations/DeleteOperation",
1726
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
1727
+ response_deserializer=None,
1728
+ )
1729
+ return self._stubs["delete_operation"]
1730
+
1731
+ @property
1732
+ def cancel_operation(
1733
+ self,
1734
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
1735
+ r"""Return a callable for the cancel_operation method over gRPC."""
1736
+ # Generate a "stub function" on-the-fly which will actually make
1737
+ # the request.
1738
+ # gRPC handles serialization and deserialization, so we just need
1739
+ # to pass in the functions for each.
1740
+ if "cancel_operation" not in self._stubs:
1741
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
1742
+ "/google.longrunning.Operations/CancelOperation",
1743
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
1744
+ response_deserializer=None,
1745
+ )
1746
+ return self._stubs["cancel_operation"]
1747
+
1748
+ @property
1749
+ def wait_operation(
1750
+ self,
1751
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
1752
+ r"""Return a callable for the wait_operation method over gRPC."""
1753
+ # Generate a "stub function" on-the-fly which will actually make
1754
+ # the request.
1755
+ # gRPC handles serialization and deserialization, so we just need
1756
+ # to pass in the functions for each.
1757
+ if "wait_operation" not in self._stubs:
1758
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
1759
+ "/google.longrunning.Operations/WaitOperation",
1760
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
1761
+ response_deserializer=None,
1762
+ )
1763
+ return self._stubs["wait_operation"]
1764
+
1765
+ @property
1766
+ def get_operation(
1767
+ self,
1768
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
1769
+ r"""Return a callable for the get_operation method over gRPC."""
1770
+ # Generate a "stub function" on-the-fly which will actually make
1771
+ # the request.
1772
+ # gRPC handles serialization and deserialization, so we just need
1773
+ # to pass in the functions for each.
1774
+ if "get_operation" not in self._stubs:
1775
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
1776
+ "/google.longrunning.Operations/GetOperation",
1777
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
1778
+ response_deserializer=operations_pb2.Operation.FromString,
1779
+ )
1780
+ return self._stubs["get_operation"]
1781
+
1782
+ @property
1783
+ def list_operations(
1784
+ self,
1785
+ ) -> Callable[
1786
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
1787
+ ]:
1788
+ r"""Return a callable for the list_operations method over gRPC."""
1789
+ # Generate a "stub function" on-the-fly which will actually make
1790
+ # the request.
1791
+ # gRPC handles serialization and deserialization, so we just need
1792
+ # to pass in the functions for each.
1793
+ if "list_operations" not in self._stubs:
1794
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
1795
+ "/google.longrunning.Operations/ListOperations",
1796
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
1797
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
1798
+ )
1799
+ return self._stubs["list_operations"]
1800
+
1801
+ @property
1802
+ def list_locations(
1803
+ self,
1804
+ ) -> Callable[
1805
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
1806
+ ]:
1807
+ r"""Return a callable for the list locations method over gRPC."""
1808
+ # Generate a "stub function" on-the-fly which will actually make
1809
+ # the request.
1810
+ # gRPC handles serialization and deserialization, so we just need
1811
+ # to pass in the functions for each.
1812
+ if "list_locations" not in self._stubs:
1813
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
1814
+ "/google.cloud.location.Locations/ListLocations",
1815
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
1816
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
1817
+ )
1818
+ return self._stubs["list_locations"]
1819
+
1820
+ @property
1821
+ def get_location(
1822
+ self,
1823
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
1824
+ r"""Return a callable for the list locations method over gRPC."""
1825
+ # Generate a "stub function" on-the-fly which will actually make
1826
+ # the request.
1827
+ # gRPC handles serialization and deserialization, so we just need
1828
+ # to pass in the functions for each.
1829
+ if "get_location" not in self._stubs:
1830
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
1831
+ "/google.cloud.location.Locations/GetLocation",
1832
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
1833
+ response_deserializer=locations_pb2.Location.FromString,
1834
+ )
1835
+ return self._stubs["get_location"]
1836
+
1837
+ @property
1838
+ def set_iam_policy(
1839
+ self,
1840
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
1841
+ r"""Return a callable for the set iam policy method over gRPC.
1842
+ Sets the IAM access control policy on the specified
1843
+ function. Replaces any existing policy.
1844
+ Returns:
1845
+ Callable[[~.SetIamPolicyRequest],
1846
+ ~.Policy]:
1847
+ A function that, when called, will call the underlying RPC
1848
+ on the server.
1849
+ """
1850
+ # Generate a "stub function" on-the-fly which will actually make
1851
+ # the request.
1852
+ # gRPC handles serialization and deserialization, so we just need
1853
+ # to pass in the functions for each.
1854
+ if "set_iam_policy" not in self._stubs:
1855
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
1856
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
1857
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
1858
+ response_deserializer=policy_pb2.Policy.FromString,
1859
+ )
1860
+ return self._stubs["set_iam_policy"]
1861
+
1862
+ @property
1863
+ def get_iam_policy(
1864
+ self,
1865
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
1866
+ r"""Return a callable for the get iam policy method over gRPC.
1867
+ Gets the IAM access control policy for a function.
1868
+ Returns an empty policy if the function exists and does
1869
+ not have a policy set.
1870
+ Returns:
1871
+ Callable[[~.GetIamPolicyRequest],
1872
+ ~.Policy]:
1873
+ A function that, when called, will call the underlying RPC
1874
+ on the server.
1875
+ """
1876
+ # Generate a "stub function" on-the-fly which will actually make
1877
+ # the request.
1878
+ # gRPC handles serialization and deserialization, so we just need
1879
+ # to pass in the functions for each.
1880
+ if "get_iam_policy" not in self._stubs:
1881
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
1882
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
1883
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
1884
+ response_deserializer=policy_pb2.Policy.FromString,
1885
+ )
1886
+ return self._stubs["get_iam_policy"]
1887
+
1888
+ @property
1889
+ def test_iam_permissions(
1890
+ self,
1891
+ ) -> Callable[
1892
+ [iam_policy_pb2.TestIamPermissionsRequest],
1893
+ iam_policy_pb2.TestIamPermissionsResponse,
1894
+ ]:
1895
+ r"""Return a callable for the test iam permissions method over gRPC.
1896
+ Tests the specified permissions against the IAM access control
1897
+ policy for a function. If the function does not exist, this will
1898
+ return an empty set of permissions, not a NOT_FOUND error.
1899
+ Returns:
1900
+ Callable[[~.TestIamPermissionsRequest],
1901
+ ~.TestIamPermissionsResponse]:
1902
+ A function that, when called, will call the underlying RPC
1903
+ on the server.
1904
+ """
1905
+ # Generate a "stub function" on-the-fly which will actually make
1906
+ # the request.
1907
+ # gRPC handles serialization and deserialization, so we just need
1908
+ # to pass in the functions for each.
1909
+ if "test_iam_permissions" not in self._stubs:
1910
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
1911
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
1912
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
1913
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
1914
+ )
1915
+ return self._stubs["test_iam_permissions"]
1916
+
1917
+
1918
+ __all__ = ("JobServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py ADDED
The diff for this file is too large to render. See raw diff
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .client import LlmUtilityServiceClient
17
+ from .async_client import LlmUtilityServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "LlmUtilityServiceClient",
21
+ "LlmUtilityServiceAsyncClient",
22
+ )
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (394 Bytes). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/async_client.cpython-312.pyc ADDED
Binary file (47.1 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/__pycache__/client.cpython-312.pyc ADDED
Binary file (66.7 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py ADDED
@@ -0,0 +1,1144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ from collections import OrderedDict
18
+ import re
19
+ from typing import (
20
+ Dict,
21
+ Callable,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.cloud.aiplatform_v1beta1 import gapic_version as package_version
33
+
34
+ from google.api_core.client_options import ClientOptions
35
+ from google.api_core import exceptions as core_exceptions
36
+ from google.api_core import gapic_v1
37
+ from google.api_core import retry_async as retries
38
+ from google.auth import credentials as ga_credentials # type: ignore
39
+ from google.oauth2 import service_account # type: ignore
40
+ import google.protobuf
41
+
42
+
43
+ try:
44
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
45
+ except AttributeError: # pragma: NO COVER
46
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
47
+
48
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
49
+ from google.cloud.location import locations_pb2 # type: ignore
50
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
51
+ from google.iam.v1 import policy_pb2 # type: ignore
52
+ from google.longrunning import operations_pb2 # type: ignore
53
+ import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
54
+ from .transports.base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO
55
+ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport
56
+ from .client import LlmUtilityServiceClient
57
+
58
+ try:
59
+ from google.api_core import client_logging # type: ignore
60
+
61
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
62
+ except ImportError: # pragma: NO COVER
63
+ CLIENT_LOGGING_SUPPORTED = False
64
+
65
+ _LOGGER = std_logging.getLogger(__name__)
66
+
67
+
68
+ class LlmUtilityServiceAsyncClient:
69
+ """Service for LLM related utility functions."""
70
+
71
+ _client: LlmUtilityServiceClient
72
+
73
+ # Copy defaults from the synchronous client for use here.
74
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
75
+ DEFAULT_ENDPOINT = LlmUtilityServiceClient.DEFAULT_ENDPOINT
76
+ DEFAULT_MTLS_ENDPOINT = LlmUtilityServiceClient.DEFAULT_MTLS_ENDPOINT
77
+ _DEFAULT_ENDPOINT_TEMPLATE = LlmUtilityServiceClient._DEFAULT_ENDPOINT_TEMPLATE
78
+ _DEFAULT_UNIVERSE = LlmUtilityServiceClient._DEFAULT_UNIVERSE
79
+
80
+ endpoint_path = staticmethod(LlmUtilityServiceClient.endpoint_path)
81
+ parse_endpoint_path = staticmethod(LlmUtilityServiceClient.parse_endpoint_path)
82
+ common_billing_account_path = staticmethod(
83
+ LlmUtilityServiceClient.common_billing_account_path
84
+ )
85
+ parse_common_billing_account_path = staticmethod(
86
+ LlmUtilityServiceClient.parse_common_billing_account_path
87
+ )
88
+ common_folder_path = staticmethod(LlmUtilityServiceClient.common_folder_path)
89
+ parse_common_folder_path = staticmethod(
90
+ LlmUtilityServiceClient.parse_common_folder_path
91
+ )
92
+ common_organization_path = staticmethod(
93
+ LlmUtilityServiceClient.common_organization_path
94
+ )
95
+ parse_common_organization_path = staticmethod(
96
+ LlmUtilityServiceClient.parse_common_organization_path
97
+ )
98
+ common_project_path = staticmethod(LlmUtilityServiceClient.common_project_path)
99
+ parse_common_project_path = staticmethod(
100
+ LlmUtilityServiceClient.parse_common_project_path
101
+ )
102
+ common_location_path = staticmethod(LlmUtilityServiceClient.common_location_path)
103
+ parse_common_location_path = staticmethod(
104
+ LlmUtilityServiceClient.parse_common_location_path
105
+ )
106
+
107
+ @classmethod
108
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
109
+ """Creates an instance of this client using the provided credentials
110
+ info.
111
+
112
+ Args:
113
+ info (dict): The service account private key info.
114
+ args: Additional arguments to pass to the constructor.
115
+ kwargs: Additional arguments to pass to the constructor.
116
+
117
+ Returns:
118
+ LlmUtilityServiceAsyncClient: The constructed client.
119
+ """
120
+ sa_info_func = (
121
+ LlmUtilityServiceClient.from_service_account_info.__func__ # type: ignore
122
+ )
123
+ return sa_info_func(LlmUtilityServiceAsyncClient, info, *args, **kwargs)
124
+
125
+ @classmethod
126
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
127
+ """Creates an instance of this client using the provided credentials
128
+ file.
129
+
130
+ Args:
131
+ filename (str): The path to the service account private key json
132
+ file.
133
+ args: Additional arguments to pass to the constructor.
134
+ kwargs: Additional arguments to pass to the constructor.
135
+
136
+ Returns:
137
+ LlmUtilityServiceAsyncClient: The constructed client.
138
+ """
139
+ sa_file_func = (
140
+ LlmUtilityServiceClient.from_service_account_file.__func__ # type: ignore
141
+ )
142
+ return sa_file_func(LlmUtilityServiceAsyncClient, filename, *args, **kwargs)
143
+
144
+ from_service_account_json = from_service_account_file
145
+
146
+ @classmethod
147
+ def get_mtls_endpoint_and_cert_source(
148
+ cls, client_options: Optional[ClientOptions] = None
149
+ ):
150
+ """Return the API endpoint and client cert source for mutual TLS.
151
+
152
+ The client cert source is determined in the following order:
153
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
154
+ client cert source is None.
155
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
156
+ default client cert source exists, use the default one; otherwise the client cert
157
+ source is None.
158
+
159
+ The API endpoint is determined in the following order:
160
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
161
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
162
+ default mTLS endpoint; if the environment variable is "never", use the default API
163
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
164
+ use the default API endpoint.
165
+
166
+ More details can be found at https://google.aip.dev/auth/4114.
167
+
168
+ Args:
169
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
170
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
171
+ in this method.
172
+
173
+ Returns:
174
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
175
+ client cert source to use.
176
+
177
+ Raises:
178
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
179
+ """
180
+ return LlmUtilityServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
181
+
182
+ @property
183
+ def transport(self) -> LlmUtilityServiceTransport:
184
+ """Returns the transport used by the client instance.
185
+
186
+ Returns:
187
+ LlmUtilityServiceTransport: The transport used by the client instance.
188
+ """
189
+ return self._client.transport
190
+
191
+ @property
192
+ def api_endpoint(self):
193
+ """Return the API endpoint used by the client instance.
194
+
195
+ Returns:
196
+ str: The API endpoint used by the client instance.
197
+ """
198
+ return self._client._api_endpoint
199
+
200
+ @property
201
+ def universe_domain(self) -> str:
202
+ """Return the universe domain used by the client instance.
203
+
204
+ Returns:
205
+ str: The universe domain used
206
+ by the client instance.
207
+ """
208
+ return self._client._universe_domain
209
+
210
+ get_transport_class = LlmUtilityServiceClient.get_transport_class
211
+
212
+ def __init__(
213
+ self,
214
+ *,
215
+ credentials: Optional[ga_credentials.Credentials] = None,
216
+ transport: Optional[
217
+ Union[
218
+ str,
219
+ LlmUtilityServiceTransport,
220
+ Callable[..., LlmUtilityServiceTransport],
221
+ ]
222
+ ] = "grpc_asyncio",
223
+ client_options: Optional[ClientOptions] = None,
224
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
225
+ ) -> None:
226
+ """Instantiates the llm utility service async client.
227
+
228
+ Args:
229
+ credentials (Optional[google.auth.credentials.Credentials]): The
230
+ authorization credentials to attach to requests. These
231
+ credentials identify the application to the service; if none
232
+ are specified, the client will attempt to ascertain the
233
+ credentials from the environment.
234
+ transport (Optional[Union[str,LlmUtilityServiceTransport,Callable[..., LlmUtilityServiceTransport]]]):
235
+ The transport to use, or a Callable that constructs and returns a new transport to use.
236
+ If a Callable is given, it will be called with the same set of initialization
237
+ arguments as used in the LlmUtilityServiceTransport constructor.
238
+ If set to None, a transport is chosen automatically.
239
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
240
+ Custom options for the client.
241
+
242
+ 1. The ``api_endpoint`` property can be used to override the
243
+ default endpoint provided by the client when ``transport`` is
244
+ not explicitly provided. Only if this property is not set and
245
+ ``transport`` was not explicitly provided, the endpoint is
246
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
247
+ variable, which have one of the following values:
248
+ "always" (always use the default mTLS endpoint), "never" (always
249
+ use the default regular endpoint) and "auto" (auto-switch to the
250
+ default mTLS endpoint if client certificate is present; this is
251
+ the default value).
252
+
253
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
254
+ is "true", then the ``client_cert_source`` property can be used
255
+ to provide a client certificate for mTLS transport. If
256
+ not provided, the default SSL client certificate will be used if
257
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
258
+ set, no client certificate will be used.
259
+
260
+ 3. The ``universe_domain`` property can be used to override the
261
+ default "googleapis.com" universe. Note that ``api_endpoint``
262
+ property still takes precedence; and ``universe_domain`` is
263
+ currently not supported for mTLS.
264
+
265
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
266
+ The client info used to send a user-agent string along with
267
+ API requests. If ``None``, then default info will be used.
268
+ Generally, you only need to set this if you're developing
269
+ your own client library.
270
+
271
+ Raises:
272
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
273
+ creation failed for any reason.
274
+ """
275
+ self._client = LlmUtilityServiceClient(
276
+ credentials=credentials,
277
+ transport=transport,
278
+ client_options=client_options,
279
+ client_info=client_info,
280
+ )
281
+
282
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
283
+ std_logging.DEBUG
284
+ ): # pragma: NO COVER
285
+ _LOGGER.debug(
286
+ "Created client `google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient`.",
287
+ extra=(
288
+ {
289
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
290
+ "universeDomain": getattr(
291
+ self._client._transport._credentials, "universe_domain", ""
292
+ ),
293
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
294
+ "credentialsInfo": getattr(
295
+ self.transport._credentials, "get_cred_info", lambda: None
296
+ )(),
297
+ }
298
+ if hasattr(self._client._transport, "_credentials")
299
+ else {
300
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
301
+ "credentialsType": None,
302
+ }
303
+ ),
304
+ )
305
+
306
+ async def compute_tokens(
307
+ self,
308
+ request: Optional[Union[llm_utility_service.ComputeTokensRequest, dict]] = None,
309
+ *,
310
+ endpoint: Optional[str] = None,
311
+ instances: Optional[MutableSequence[struct_pb2.Value]] = None,
312
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
313
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
314
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
315
+ ) -> llm_utility_service.ComputeTokensResponse:
316
+ r"""Return a list of tokens based on the input text.
317
+
318
+ .. code-block:: python
319
+
320
+ # This snippet has been automatically generated and should be regarded as a
321
+ # code template only.
322
+ # It will require modifications to work:
323
+ # - It may require correct/in-range values for request initialization.
324
+ # - It may require specifying regional endpoints when creating the service
325
+ # client as shown in:
326
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
327
+ from google.cloud import aiplatform_v1beta1
328
+
329
+ async def sample_compute_tokens():
330
+ # Create a client
331
+ client = aiplatform_v1beta1.LlmUtilityServiceAsyncClient()
332
+
333
+ # Initialize request argument(s)
334
+ request = aiplatform_v1beta1.ComputeTokensRequest(
335
+ endpoint="endpoint_value",
336
+ )
337
+
338
+ # Make the request
339
+ response = await client.compute_tokens(request=request)
340
+
341
+ # Handle the response
342
+ print(response)
343
+
344
+ Args:
345
+ request (Optional[Union[google.cloud.aiplatform_v1beta1.types.ComputeTokensRequest, dict]]):
346
+ The request object. Request message for ComputeTokens RPC
347
+ call.
348
+ endpoint (:class:`str`):
349
+ Required. The name of the Endpoint
350
+ requested to get lists of tokens and
351
+ token ids.
352
+
353
+ This corresponds to the ``endpoint`` field
354
+ on the ``request`` instance; if ``request`` is provided, this
355
+ should not be set.
356
+ instances (:class:`MutableSequence[google.protobuf.struct_pb2.Value]`):
357
+ Optional. The instances that are the
358
+ input to token computing API call.
359
+ Schema is identical to the prediction
360
+ schema of the text model, even for the
361
+ non-text models, like chat models, or
362
+ Codey models.
363
+
364
+ This corresponds to the ``instances`` field
365
+ on the ``request`` instance; if ``request`` is provided, this
366
+ should not be set.
367
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
368
+ should be retried.
369
+ timeout (float): The timeout for this request.
370
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
371
+ sent along with the request as metadata. Normally, each value must be of type `str`,
372
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
373
+ be of type `bytes`.
374
+
375
+ Returns:
376
+ google.cloud.aiplatform_v1beta1.types.ComputeTokensResponse:
377
+ Response message for ComputeTokens
378
+ RPC call.
379
+
380
+ """
381
+ # Create or coerce a protobuf request object.
382
+ # - Quick check: If we got a request object, we should *not* have
383
+ # gotten any keyword arguments that map to the request.
384
+ flattened_params = [endpoint, instances]
385
+ has_flattened_params = (
386
+ len([param for param in flattened_params if param is not None]) > 0
387
+ )
388
+ if request is not None and has_flattened_params:
389
+ raise ValueError(
390
+ "If the `request` argument is set, then none of "
391
+ "the individual field arguments should be set."
392
+ )
393
+
394
+ # - Use the request object if provided (there's no risk of modifying the input as
395
+ # there are no flattened fields), or create one.
396
+ if not isinstance(request, llm_utility_service.ComputeTokensRequest):
397
+ request = llm_utility_service.ComputeTokensRequest(request)
398
+
399
+ # If we have keyword arguments corresponding to fields on the
400
+ # request, apply these.
401
+ if endpoint is not None:
402
+ request.endpoint = endpoint
403
+ if instances:
404
+ request.instances.extend(instances)
405
+
406
+ # Wrap the RPC method; this adds retry and timeout information,
407
+ # and friendly error handling.
408
+ rpc = self._client._transport._wrapped_methods[
409
+ self._client._transport.compute_tokens
410
+ ]
411
+
412
+ # Certain fields should be provided within the metadata header;
413
+ # add these here.
414
+ metadata = tuple(metadata) + (
415
+ gapic_v1.routing_header.to_grpc_metadata((("endpoint", request.endpoint),)),
416
+ )
417
+
418
+ # Validate the universe domain.
419
+ self._client._validate_universe_domain()
420
+
421
+ # Send the request.
422
+ response = await rpc(
423
+ request,
424
+ retry=retry,
425
+ timeout=timeout,
426
+ metadata=metadata,
427
+ )
428
+
429
+ # Done; return the response.
430
+ return response
431
+
432
+ async def list_operations(
433
+ self,
434
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
435
+ *,
436
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
437
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
438
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
439
+ ) -> operations_pb2.ListOperationsResponse:
440
+ r"""Lists operations that match the specified filter in the request.
441
+
442
+ Args:
443
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
444
+ The request object. Request message for
445
+ `ListOperations` method.
446
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
447
+ if any, should be retried.
448
+ timeout (float): The timeout for this request.
449
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
450
+ sent along with the request as metadata. Normally, each value must be of type `str`,
451
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
452
+ be of type `bytes`.
453
+ Returns:
454
+ ~.operations_pb2.ListOperationsResponse:
455
+ Response message for ``ListOperations`` method.
456
+ """
457
+ # Create or coerce a protobuf request object.
458
+ # The request isn't a proto-plus wrapped type,
459
+ # so it must be constructed via keyword expansion.
460
+ if isinstance(request, dict):
461
+ request = operations_pb2.ListOperationsRequest(**request)
462
+
463
+ # Wrap the RPC method; this adds retry and timeout information,
464
+ # and friendly error handling.
465
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
466
+
467
+ # Certain fields should be provided within the metadata header;
468
+ # add these here.
469
+ metadata = tuple(metadata) + (
470
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
471
+ )
472
+
473
+ # Validate the universe domain.
474
+ self._client._validate_universe_domain()
475
+
476
+ # Send the request.
477
+ response = await rpc(
478
+ request,
479
+ retry=retry,
480
+ timeout=timeout,
481
+ metadata=metadata,
482
+ )
483
+
484
+ # Done; return the response.
485
+ return response
486
+
487
+ async def get_operation(
488
+ self,
489
+ request: Optional[operations_pb2.GetOperationRequest] = None,
490
+ *,
491
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
492
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
493
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
494
+ ) -> operations_pb2.Operation:
495
+ r"""Gets the latest state of a long-running operation.
496
+
497
+ Args:
498
+ request (:class:`~.operations_pb2.GetOperationRequest`):
499
+ The request object. Request message for
500
+ `GetOperation` method.
501
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
502
+ if any, should be retried.
503
+ timeout (float): The timeout for this request.
504
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
505
+ sent along with the request as metadata. Normally, each value must be of type `str`,
506
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
507
+ be of type `bytes`.
508
+ Returns:
509
+ ~.operations_pb2.Operation:
510
+ An ``Operation`` object.
511
+ """
512
+ # Create or coerce a protobuf request object.
513
+ # The request isn't a proto-plus wrapped type,
514
+ # so it must be constructed via keyword expansion.
515
+ if isinstance(request, dict):
516
+ request = operations_pb2.GetOperationRequest(**request)
517
+
518
+ # Wrap the RPC method; this adds retry and timeout information,
519
+ # and friendly error handling.
520
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
521
+
522
+ # Certain fields should be provided within the metadata header;
523
+ # add these here.
524
+ metadata = tuple(metadata) + (
525
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
526
+ )
527
+
528
+ # Validate the universe domain.
529
+ self._client._validate_universe_domain()
530
+
531
+ # Send the request.
532
+ response = await rpc(
533
+ request,
534
+ retry=retry,
535
+ timeout=timeout,
536
+ metadata=metadata,
537
+ )
538
+
539
+ # Done; return the response.
540
+ return response
541
+
542
+ async def delete_operation(
543
+ self,
544
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
545
+ *,
546
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
547
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
548
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
549
+ ) -> None:
550
+ r"""Deletes a long-running operation.
551
+
552
+ This method indicates that the client is no longer interested
553
+ in the operation result. It does not cancel the operation.
554
+ If the server doesn't support this method, it returns
555
+ `google.rpc.Code.UNIMPLEMENTED`.
556
+
557
+ Args:
558
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
559
+ The request object. Request message for
560
+ `DeleteOperation` method.
561
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
562
+ if any, should be retried.
563
+ timeout (float): The timeout for this request.
564
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
565
+ sent along with the request as metadata. Normally, each value must be of type `str`,
566
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
567
+ be of type `bytes`.
568
+ Returns:
569
+ None
570
+ """
571
+ # Create or coerce a protobuf request object.
572
+ # The request isn't a proto-plus wrapped type,
573
+ # so it must be constructed via keyword expansion.
574
+ if isinstance(request, dict):
575
+ request = operations_pb2.DeleteOperationRequest(**request)
576
+
577
+ # Wrap the RPC method; this adds retry and timeout information,
578
+ # and friendly error handling.
579
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
580
+
581
+ # Certain fields should be provided within the metadata header;
582
+ # add these here.
583
+ metadata = tuple(metadata) + (
584
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
585
+ )
586
+
587
+ # Validate the universe domain.
588
+ self._client._validate_universe_domain()
589
+
590
+ # Send the request.
591
+ await rpc(
592
+ request,
593
+ retry=retry,
594
+ timeout=timeout,
595
+ metadata=metadata,
596
+ )
597
+
598
+ async def cancel_operation(
599
+ self,
600
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
601
+ *,
602
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
603
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
604
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
605
+ ) -> None:
606
+ r"""Starts asynchronous cancellation on a long-running operation.
607
+
608
+ The server makes a best effort to cancel the operation, but success
609
+ is not guaranteed. If the server doesn't support this method, it returns
610
+ `google.rpc.Code.UNIMPLEMENTED`.
611
+
612
+ Args:
613
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
614
+ The request object. Request message for
615
+ `CancelOperation` method.
616
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
617
+ if any, should be retried.
618
+ timeout (float): The timeout for this request.
619
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
620
+ sent along with the request as metadata. Normally, each value must be of type `str`,
621
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
622
+ be of type `bytes`.
623
+ Returns:
624
+ None
625
+ """
626
+ # Create or coerce a protobuf request object.
627
+ # The request isn't a proto-plus wrapped type,
628
+ # so it must be constructed via keyword expansion.
629
+ if isinstance(request, dict):
630
+ request = operations_pb2.CancelOperationRequest(**request)
631
+
632
+ # Wrap the RPC method; this adds retry and timeout information,
633
+ # and friendly error handling.
634
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
635
+
636
+ # Certain fields should be provided within the metadata header;
637
+ # add these here.
638
+ metadata = tuple(metadata) + (
639
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
640
+ )
641
+
642
+ # Validate the universe domain.
643
+ self._client._validate_universe_domain()
644
+
645
+ # Send the request.
646
+ await rpc(
647
+ request,
648
+ retry=retry,
649
+ timeout=timeout,
650
+ metadata=metadata,
651
+ )
652
+
653
+ async def wait_operation(
654
+ self,
655
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
656
+ *,
657
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
658
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
659
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
660
+ ) -> operations_pb2.Operation:
661
+ r"""Waits until the specified long-running operation is done or reaches at most
662
+ a specified timeout, returning the latest state.
663
+
664
+ If the operation is already done, the latest state is immediately returned.
665
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
666
+ timeout is used. If the server does not support this method, it returns
667
+ `google.rpc.Code.UNIMPLEMENTED`.
668
+
669
+ Args:
670
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
671
+ The request object. Request message for
672
+ `WaitOperation` method.
673
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
674
+ if any, should be retried.
675
+ timeout (float): The timeout for this request.
676
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
677
+ sent along with the request as metadata. Normally, each value must be of type `str`,
678
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
679
+ be of type `bytes`.
680
+ Returns:
681
+ ~.operations_pb2.Operation:
682
+ An ``Operation`` object.
683
+ """
684
+ # Create or coerce a protobuf request object.
685
+ # The request isn't a proto-plus wrapped type,
686
+ # so it must be constructed via keyword expansion.
687
+ if isinstance(request, dict):
688
+ request = operations_pb2.WaitOperationRequest(**request)
689
+
690
+ # Wrap the RPC method; this adds retry and timeout information,
691
+ # and friendly error handling.
692
+ rpc = self.transport._wrapped_methods[self._client._transport.wait_operation]
693
+
694
+ # Certain fields should be provided within the metadata header;
695
+ # add these here.
696
+ metadata = tuple(metadata) + (
697
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
698
+ )
699
+
700
+ # Validate the universe domain.
701
+ self._client._validate_universe_domain()
702
+
703
+ # Send the request.
704
+ response = await rpc(
705
+ request,
706
+ retry=retry,
707
+ timeout=timeout,
708
+ metadata=metadata,
709
+ )
710
+
711
+ # Done; return the response.
712
+ return response
713
+
714
+ async def set_iam_policy(
715
+ self,
716
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
717
+ *,
718
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
719
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
720
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
721
+ ) -> policy_pb2.Policy:
722
+ r"""Sets the IAM access control policy on the specified function.
723
+
724
+ Replaces any existing policy.
725
+
726
+ Args:
727
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
728
+ The request object. Request message for `SetIamPolicy`
729
+ method.
730
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
731
+ should be retried.
732
+ timeout (float): The timeout for this request.
733
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
734
+ sent along with the request as metadata. Normally, each value must be of type `str`,
735
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
736
+ be of type `bytes`.
737
+ Returns:
738
+ ~.policy_pb2.Policy:
739
+ Defines an Identity and Access Management (IAM) policy.
740
+ It is used to specify access control policies for Cloud
741
+ Platform resources.
742
+ A ``Policy`` is a collection of ``bindings``. A
743
+ ``binding`` binds one or more ``members`` to a single
744
+ ``role``. Members can be user accounts, service
745
+ accounts, Google groups, and domains (such as G Suite).
746
+ A ``role`` is a named list of permissions (defined by
747
+ IAM or configured by users). A ``binding`` can
748
+ optionally specify a ``condition``, which is a logic
749
+ expression that further constrains the role binding
750
+ based on attributes about the request and/or target
751
+ resource.
752
+
753
+ **JSON Example**
754
+
755
+ ::
756
+
757
+ {
758
+ "bindings": [
759
+ {
760
+ "role": "roles/resourcemanager.organizationAdmin",
761
+ "members": [
762
+ "user:mike@example.com",
763
+ "group:admins@example.com",
764
+ "domain:google.com",
765
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
766
+ ]
767
+ },
768
+ {
769
+ "role": "roles/resourcemanager.organizationViewer",
770
+ "members": ["user:eve@example.com"],
771
+ "condition": {
772
+ "title": "expirable access",
773
+ "description": "Does not grant access after Sep 2020",
774
+ "expression": "request.time <
775
+ timestamp('2020-10-01T00:00:00.000Z')",
776
+ }
777
+ }
778
+ ]
779
+ }
780
+
781
+ **YAML Example**
782
+
783
+ ::
784
+
785
+ bindings:
786
+ - members:
787
+ - user:mike@example.com
788
+ - group:admins@example.com
789
+ - domain:google.com
790
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
791
+ role: roles/resourcemanager.organizationAdmin
792
+ - members:
793
+ - user:eve@example.com
794
+ role: roles/resourcemanager.organizationViewer
795
+ condition:
796
+ title: expirable access
797
+ description: Does not grant access after Sep 2020
798
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
799
+
800
+ For a description of IAM and its features, see the `IAM
801
+ developer's
802
+ guide <https://cloud.google.com/iam/docs>`__.
803
+ """
804
+ # Create or coerce a protobuf request object.
805
+
806
+ # The request isn't a proto-plus wrapped type,
807
+ # so it must be constructed via keyword expansion.
808
+ if isinstance(request, dict):
809
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
810
+
811
+ # Wrap the RPC method; this adds retry and timeout information,
812
+ # and friendly error handling.
813
+ rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy]
814
+
815
+ # Certain fields should be provided within the metadata header;
816
+ # add these here.
817
+ metadata = tuple(metadata) + (
818
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
819
+ )
820
+
821
+ # Validate the universe domain.
822
+ self._client._validate_universe_domain()
823
+
824
+ # Send the request.
825
+ response = await rpc(
826
+ request,
827
+ retry=retry,
828
+ timeout=timeout,
829
+ metadata=metadata,
830
+ )
831
+
832
+ # Done; return the response.
833
+ return response
834
+
835
+ async def get_iam_policy(
836
+ self,
837
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
838
+ *,
839
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
840
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
841
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
842
+ ) -> policy_pb2.Policy:
843
+ r"""Gets the IAM access control policy for a function.
844
+
845
+ Returns an empty policy if the function exists and does not have a
846
+ policy set.
847
+
848
+ Args:
849
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
850
+ The request object. Request message for `GetIamPolicy`
851
+ method.
852
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
853
+ any, should be retried.
854
+ timeout (float): The timeout for this request.
855
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
856
+ sent along with the request as metadata. Normally, each value must be of type `str`,
857
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
858
+ be of type `bytes`.
859
+ Returns:
860
+ ~.policy_pb2.Policy:
861
+ Defines an Identity and Access Management (IAM) policy.
862
+ It is used to specify access control policies for Cloud
863
+ Platform resources.
864
+ A ``Policy`` is a collection of ``bindings``. A
865
+ ``binding`` binds one or more ``members`` to a single
866
+ ``role``. Members can be user accounts, service
867
+ accounts, Google groups, and domains (such as G Suite).
868
+ A ``role`` is a named list of permissions (defined by
869
+ IAM or configured by users). A ``binding`` can
870
+ optionally specify a ``condition``, which is a logic
871
+ expression that further constrains the role binding
872
+ based on attributes about the request and/or target
873
+ resource.
874
+
875
+ **JSON Example**
876
+
877
+ ::
878
+
879
+ {
880
+ "bindings": [
881
+ {
882
+ "role": "roles/resourcemanager.organizationAdmin",
883
+ "members": [
884
+ "user:mike@example.com",
885
+ "group:admins@example.com",
886
+ "domain:google.com",
887
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
888
+ ]
889
+ },
890
+ {
891
+ "role": "roles/resourcemanager.organizationViewer",
892
+ "members": ["user:eve@example.com"],
893
+ "condition": {
894
+ "title": "expirable access",
895
+ "description": "Does not grant access after Sep 2020",
896
+ "expression": "request.time <
897
+ timestamp('2020-10-01T00:00:00.000Z')",
898
+ }
899
+ }
900
+ ]
901
+ }
902
+
903
+ **YAML Example**
904
+
905
+ ::
906
+
907
+ bindings:
908
+ - members:
909
+ - user:mike@example.com
910
+ - group:admins@example.com
911
+ - domain:google.com
912
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
913
+ role: roles/resourcemanager.organizationAdmin
914
+ - members:
915
+ - user:eve@example.com
916
+ role: roles/resourcemanager.organizationViewer
917
+ condition:
918
+ title: expirable access
919
+ description: Does not grant access after Sep 2020
920
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
921
+
922
+ For a description of IAM and its features, see the `IAM
923
+ developer's
924
+ guide <https://cloud.google.com/iam/docs>`__.
925
+ """
926
+ # Create or coerce a protobuf request object.
927
+
928
+ # The request isn't a proto-plus wrapped type,
929
+ # so it must be constructed via keyword expansion.
930
+ if isinstance(request, dict):
931
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
932
+
933
+ # Wrap the RPC method; this adds retry and timeout information,
934
+ # and friendly error handling.
935
+ rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy]
936
+
937
+ # Certain fields should be provided within the metadata header;
938
+ # add these here.
939
+ metadata = tuple(metadata) + (
940
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
941
+ )
942
+
943
+ # Validate the universe domain.
944
+ self._client._validate_universe_domain()
945
+
946
+ # Send the request.
947
+ response = await rpc(
948
+ request,
949
+ retry=retry,
950
+ timeout=timeout,
951
+ metadata=metadata,
952
+ )
953
+
954
+ # Done; return the response.
955
+ return response
956
+
957
+ async def test_iam_permissions(
958
+ self,
959
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
960
+ *,
961
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
962
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
963
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
964
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
965
+ r"""Tests the specified IAM permissions against the IAM access control
966
+ policy for a function.
967
+
968
+ If the function does not exist, this will return an empty set
969
+ of permissions, not a NOT_FOUND error.
970
+
971
+ Args:
972
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
973
+ The request object. Request message for
974
+ `TestIamPermissions` method.
975
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
976
+ if any, should be retried.
977
+ timeout (float): The timeout for this request.
978
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
979
+ sent along with the request as metadata. Normally, each value must be of type `str`,
980
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
981
+ be of type `bytes`.
982
+ Returns:
983
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
984
+ Response message for ``TestIamPermissions`` method.
985
+ """
986
+ # Create or coerce a protobuf request object.
987
+
988
+ # The request isn't a proto-plus wrapped type,
989
+ # so it must be constructed via keyword expansion.
990
+ if isinstance(request, dict):
991
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
992
+
993
+ # Wrap the RPC method; this adds retry and timeout information,
994
+ # and friendly error handling.
995
+ rpc = self.transport._wrapped_methods[
996
+ self._client._transport.test_iam_permissions
997
+ ]
998
+
999
+ # Certain fields should be provided within the metadata header;
1000
+ # add these here.
1001
+ metadata = tuple(metadata) + (
1002
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1003
+ )
1004
+
1005
+ # Validate the universe domain.
1006
+ self._client._validate_universe_domain()
1007
+
1008
+ # Send the request.
1009
+ response = await rpc(
1010
+ request,
1011
+ retry=retry,
1012
+ timeout=timeout,
1013
+ metadata=metadata,
1014
+ )
1015
+
1016
+ # Done; return the response.
1017
+ return response
1018
+
1019
+ async def get_location(
1020
+ self,
1021
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1022
+ *,
1023
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1024
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1025
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1026
+ ) -> locations_pb2.Location:
1027
+ r"""Gets information about a location.
1028
+
1029
+ Args:
1030
+ request (:class:`~.location_pb2.GetLocationRequest`):
1031
+ The request object. Request message for
1032
+ `GetLocation` method.
1033
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1034
+ if any, should be retried.
1035
+ timeout (float): The timeout for this request.
1036
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1037
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1038
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1039
+ be of type `bytes`.
1040
+ Returns:
1041
+ ~.location_pb2.Location:
1042
+ Location object.
1043
+ """
1044
+ # Create or coerce a protobuf request object.
1045
+ # The request isn't a proto-plus wrapped type,
1046
+ # so it must be constructed via keyword expansion.
1047
+ if isinstance(request, dict):
1048
+ request = locations_pb2.GetLocationRequest(**request)
1049
+
1050
+ # Wrap the RPC method; this adds retry and timeout information,
1051
+ # and friendly error handling.
1052
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1053
+
1054
+ # Certain fields should be provided within the metadata header;
1055
+ # add these here.
1056
+ metadata = tuple(metadata) + (
1057
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1058
+ )
1059
+
1060
+ # Validate the universe domain.
1061
+ self._client._validate_universe_domain()
1062
+
1063
+ # Send the request.
1064
+ response = await rpc(
1065
+ request,
1066
+ retry=retry,
1067
+ timeout=timeout,
1068
+ metadata=metadata,
1069
+ )
1070
+
1071
+ # Done; return the response.
1072
+ return response
1073
+
1074
+ async def list_locations(
1075
+ self,
1076
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1077
+ *,
1078
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1079
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1080
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1081
+ ) -> locations_pb2.ListLocationsResponse:
1082
+ r"""Lists information about the supported locations for this service.
1083
+
1084
+ Args:
1085
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1086
+ The request object. Request message for
1087
+ `ListLocations` method.
1088
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1089
+ if any, should be retried.
1090
+ timeout (float): The timeout for this request.
1091
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1092
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1093
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1094
+ be of type `bytes`.
1095
+ Returns:
1096
+ ~.location_pb2.ListLocationsResponse:
1097
+ Response message for ``ListLocations`` method.
1098
+ """
1099
+ # Create or coerce a protobuf request object.
1100
+ # The request isn't a proto-plus wrapped type,
1101
+ # so it must be constructed via keyword expansion.
1102
+ if isinstance(request, dict):
1103
+ request = locations_pb2.ListLocationsRequest(**request)
1104
+
1105
+ # Wrap the RPC method; this adds retry and timeout information,
1106
+ # and friendly error handling.
1107
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1108
+
1109
+ # Certain fields should be provided within the metadata header;
1110
+ # add these here.
1111
+ metadata = tuple(metadata) + (
1112
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1113
+ )
1114
+
1115
+ # Validate the universe domain.
1116
+ self._client._validate_universe_domain()
1117
+
1118
+ # Send the request.
1119
+ response = await rpc(
1120
+ request,
1121
+ retry=retry,
1122
+ timeout=timeout,
1123
+ metadata=metadata,
1124
+ )
1125
+
1126
+ # Done; return the response.
1127
+ return response
1128
+
1129
+ async def __aenter__(self) -> "LlmUtilityServiceAsyncClient":
1130
+ return self
1131
+
1132
+ async def __aexit__(self, exc_type, exc, tb):
1133
+ await self.transport.close()
1134
+
1135
+
1136
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1137
+ gapic_version=package_version.__version__
1138
+ )
1139
+
1140
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1141
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1142
+
1143
+
1144
+ __all__ = ("LlmUtilityServiceAsyncClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py ADDED
@@ -0,0 +1,1651 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Dict,
24
+ Callable,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.cloud.aiplatform_v1beta1 import gapic_version as package_version
38
+
39
+ from google.api_core import client_options as client_options_lib
40
+ from google.api_core import exceptions as core_exceptions
41
+ from google.api_core import gapic_v1
42
+ from google.api_core import retry as retries
43
+ from google.auth import credentials as ga_credentials # type: ignore
44
+ from google.auth.transport import mtls # type: ignore
45
+ from google.auth.transport.grpc import SslCredentials # type: ignore
46
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
47
+ from google.oauth2 import service_account # type: ignore
48
+ import google.protobuf
49
+
50
+ try:
51
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
52
+ except AttributeError: # pragma: NO COVER
53
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
54
+
55
+ try:
56
+ from google.api_core import client_logging # type: ignore
57
+
58
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
59
+ except ImportError: # pragma: NO COVER
60
+ CLIENT_LOGGING_SUPPORTED = False
61
+
62
+ _LOGGER = std_logging.getLogger(__name__)
63
+
64
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
65
+ from google.cloud.location import locations_pb2 # type: ignore
66
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
67
+ from google.iam.v1 import policy_pb2 # type: ignore
68
+ from google.longrunning import operations_pb2 # type: ignore
69
+ import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
70
+ from .transports.base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO
71
+ from .transports.grpc import LlmUtilityServiceGrpcTransport
72
+ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport
73
+ from .transports.rest import LlmUtilityServiceRestTransport
74
+
75
+ try:
76
+ from .transports.rest_asyncio import AsyncLlmUtilityServiceRestTransport
77
+
78
+ HAS_ASYNC_REST_DEPENDENCIES = True
79
+ except ImportError as e: # pragma: NO COVER
80
+ HAS_ASYNC_REST_DEPENDENCIES = False
81
+ ASYNC_REST_EXCEPTION = e
82
+
83
+
84
+ class LlmUtilityServiceClientMeta(type):
85
+ """Metaclass for the LlmUtilityService client.
86
+
87
+ This provides class-level methods for building and retrieving
88
+ support objects (e.g. transport) without polluting the client instance
89
+ objects.
90
+ """
91
+
92
+ _transport_registry = (
93
+ OrderedDict()
94
+ ) # type: Dict[str, Type[LlmUtilityServiceTransport]]
95
+ _transport_registry["grpc"] = LlmUtilityServiceGrpcTransport
96
+ _transport_registry["grpc_asyncio"] = LlmUtilityServiceGrpcAsyncIOTransport
97
+ _transport_registry["rest"] = LlmUtilityServiceRestTransport
98
+ if HAS_ASYNC_REST_DEPENDENCIES: # pragma: NO COVER
99
+ _transport_registry["rest_asyncio"] = AsyncLlmUtilityServiceRestTransport
100
+
101
+ def get_transport_class(
102
+ cls,
103
+ label: Optional[str] = None,
104
+ ) -> Type[LlmUtilityServiceTransport]:
105
+ """Returns an appropriate transport class.
106
+
107
+ Args:
108
+ label: The name of the desired transport. If none is
109
+ provided, then the first transport in the registry is used.
110
+
111
+ Returns:
112
+ The transport class to use.
113
+ """
114
+ # If a specific transport is requested, return that one.
115
+ if (
116
+ label == "rest_asyncio" and not HAS_ASYNC_REST_DEPENDENCIES
117
+ ): # pragma: NO COVER
118
+ raise ASYNC_REST_EXCEPTION
119
+ if label:
120
+ return cls._transport_registry[label]
121
+
122
+ # No transport is requested; return the default (that is, the first one
123
+ # in the dictionary).
124
+ return next(iter(cls._transport_registry.values()))
125
+
126
+
127
+ class LlmUtilityServiceClient(metaclass=LlmUtilityServiceClientMeta):
128
+ """Service for LLM related utility functions."""
129
+
130
+ @staticmethod
131
+ def _get_default_mtls_endpoint(api_endpoint):
132
+ """Converts api endpoint to mTLS endpoint.
133
+
134
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
135
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
136
+ Args:
137
+ api_endpoint (Optional[str]): the api endpoint to convert.
138
+ Returns:
139
+ str: converted mTLS api endpoint.
140
+ """
141
+ if not api_endpoint:
142
+ return api_endpoint
143
+
144
+ mtls_endpoint_re = re.compile(
145
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
146
+ )
147
+
148
+ m = mtls_endpoint_re.match(api_endpoint)
149
+ name, mtls, sandbox, googledomain = m.groups()
150
+ if mtls or not googledomain:
151
+ return api_endpoint
152
+
153
+ if sandbox:
154
+ return api_endpoint.replace(
155
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
156
+ )
157
+
158
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
159
+
160
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
161
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
162
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
163
+ DEFAULT_ENDPOINT
164
+ )
165
+
166
+ _DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.{UNIVERSE_DOMAIN}"
167
+ _DEFAULT_UNIVERSE = "googleapis.com"
168
+
169
+ @staticmethod
170
+ def _use_client_cert_effective():
171
+ """Returns whether client certificate should be used for mTLS if the
172
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
173
+
174
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
175
+
176
+ Returns:
177
+ bool: whether client certificate should be used for mTLS
178
+ Raises:
179
+ ValueError: (If using a version of google-auth without should_use_client_cert and
180
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
181
+ """
182
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
183
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
184
+ return mtls.should_use_client_cert()
185
+ else: # pragma: NO COVER
186
+ # if unsupported, fallback to reading from env var
187
+ use_client_cert_str = os.getenv(
188
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
189
+ ).lower()
190
+ if use_client_cert_str not in ("true", "false"):
191
+ raise ValueError(
192
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
193
+ " either `true` or `false`"
194
+ )
195
+ return use_client_cert_str == "true"
196
+
197
+ @classmethod
198
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
199
+ """Creates an instance of this client using the provided credentials
200
+ info.
201
+
202
+ Args:
203
+ info (dict): The service account private key info.
204
+ args: Additional arguments to pass to the constructor.
205
+ kwargs: Additional arguments to pass to the constructor.
206
+
207
+ Returns:
208
+ LlmUtilityServiceClient: The constructed client.
209
+ """
210
+ credentials = service_account.Credentials.from_service_account_info(info)
211
+ kwargs["credentials"] = credentials
212
+ return cls(*args, **kwargs)
213
+
214
+ @classmethod
215
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
216
+ """Creates an instance of this client using the provided credentials
217
+ file.
218
+
219
+ Args:
220
+ filename (str): The path to the service account private key json
221
+ file.
222
+ args: Additional arguments to pass to the constructor.
223
+ kwargs: Additional arguments to pass to the constructor.
224
+
225
+ Returns:
226
+ LlmUtilityServiceClient: The constructed client.
227
+ """
228
+ credentials = service_account.Credentials.from_service_account_file(filename)
229
+ kwargs["credentials"] = credentials
230
+ return cls(*args, **kwargs)
231
+
232
+ from_service_account_json = from_service_account_file
233
+
234
+ @property
235
+ def transport(self) -> LlmUtilityServiceTransport:
236
+ """Returns the transport used by the client instance.
237
+
238
+ Returns:
239
+ LlmUtilityServiceTransport: The transport used by the client
240
+ instance.
241
+ """
242
+ return self._transport
243
+
244
+ @staticmethod
245
+ def endpoint_path(
246
+ project: str,
247
+ location: str,
248
+ endpoint: str,
249
+ ) -> str:
250
+ """Returns a fully-qualified endpoint string."""
251
+ return "projects/{project}/locations/{location}/endpoints/{endpoint}".format(
252
+ project=project,
253
+ location=location,
254
+ endpoint=endpoint,
255
+ )
256
+
257
+ @staticmethod
258
+ def parse_endpoint_path(path: str) -> Dict[str, str]:
259
+ """Parses a endpoint path into its component segments."""
260
+ m = re.match(
261
+ r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/endpoints/(?P<endpoint>.+?)$",
262
+ path,
263
+ )
264
+ return m.groupdict() if m else {}
265
+
266
+ @staticmethod
267
+ def common_billing_account_path(
268
+ billing_account: str,
269
+ ) -> str:
270
+ """Returns a fully-qualified billing_account string."""
271
+ return "billingAccounts/{billing_account}".format(
272
+ billing_account=billing_account,
273
+ )
274
+
275
+ @staticmethod
276
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
277
+ """Parse a billing_account path into its component segments."""
278
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
279
+ return m.groupdict() if m else {}
280
+
281
+ @staticmethod
282
+ def common_folder_path(
283
+ folder: str,
284
+ ) -> str:
285
+ """Returns a fully-qualified folder string."""
286
+ return "folders/{folder}".format(
287
+ folder=folder,
288
+ )
289
+
290
+ @staticmethod
291
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
292
+ """Parse a folder path into its component segments."""
293
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
294
+ return m.groupdict() if m else {}
295
+
296
+ @staticmethod
297
+ def common_organization_path(
298
+ organization: str,
299
+ ) -> str:
300
+ """Returns a fully-qualified organization string."""
301
+ return "organizations/{organization}".format(
302
+ organization=organization,
303
+ )
304
+
305
+ @staticmethod
306
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
307
+ """Parse a organization path into its component segments."""
308
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
309
+ return m.groupdict() if m else {}
310
+
311
+ @staticmethod
312
+ def common_project_path(
313
+ project: str,
314
+ ) -> str:
315
+ """Returns a fully-qualified project string."""
316
+ return "projects/{project}".format(
317
+ project=project,
318
+ )
319
+
320
+ @staticmethod
321
+ def parse_common_project_path(path: str) -> Dict[str, str]:
322
+ """Parse a project path into its component segments."""
323
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
324
+ return m.groupdict() if m else {}
325
+
326
+ @staticmethod
327
+ def common_location_path(
328
+ project: str,
329
+ location: str,
330
+ ) -> str:
331
+ """Returns a fully-qualified location string."""
332
+ return "projects/{project}/locations/{location}".format(
333
+ project=project,
334
+ location=location,
335
+ )
336
+
337
+ @staticmethod
338
+ def parse_common_location_path(path: str) -> Dict[str, str]:
339
+ """Parse a location path into its component segments."""
340
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
341
+ return m.groupdict() if m else {}
342
+
343
+ @classmethod
344
+ def get_mtls_endpoint_and_cert_source(
345
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
346
+ ):
347
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
348
+
349
+ The client cert source is determined in the following order:
350
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
351
+ client cert source is None.
352
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
353
+ default client cert source exists, use the default one; otherwise the client cert
354
+ source is None.
355
+
356
+ The API endpoint is determined in the following order:
357
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
358
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
359
+ default mTLS endpoint; if the environment variable is "never", use the default API
360
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
361
+ use the default API endpoint.
362
+
363
+ More details can be found at https://google.aip.dev/auth/4114.
364
+
365
+ Args:
366
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
367
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
368
+ in this method.
369
+
370
+ Returns:
371
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
372
+ client cert source to use.
373
+
374
+ Raises:
375
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
376
+ """
377
+
378
+ warnings.warn(
379
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
380
+ DeprecationWarning,
381
+ )
382
+ if client_options is None:
383
+ client_options = client_options_lib.ClientOptions()
384
+ use_client_cert = LlmUtilityServiceClient._use_client_cert_effective()
385
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
386
+ if use_mtls_endpoint not in ("auto", "never", "always"):
387
+ raise MutualTLSChannelError(
388
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
389
+ )
390
+
391
+ # Figure out the client cert source to use.
392
+ client_cert_source = None
393
+ if use_client_cert:
394
+ if client_options.client_cert_source:
395
+ client_cert_source = client_options.client_cert_source
396
+ elif mtls.has_default_client_cert_source():
397
+ client_cert_source = mtls.default_client_cert_source()
398
+
399
+ # Figure out which api endpoint to use.
400
+ if client_options.api_endpoint is not None:
401
+ api_endpoint = client_options.api_endpoint
402
+ elif use_mtls_endpoint == "always" or (
403
+ use_mtls_endpoint == "auto" and client_cert_source
404
+ ):
405
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
406
+ else:
407
+ api_endpoint = cls.DEFAULT_ENDPOINT
408
+
409
+ return api_endpoint, client_cert_source
410
+
411
+ @staticmethod
412
+ def _read_environment_variables():
413
+ """Returns the environment variables used by the client.
414
+
415
+ Returns:
416
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
417
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
418
+
419
+ Raises:
420
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
421
+ any of ["true", "false"].
422
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
423
+ is not any of ["auto", "never", "always"].
424
+ """
425
+ use_client_cert = LlmUtilityServiceClient._use_client_cert_effective()
426
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
427
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
428
+ if use_mtls_endpoint not in ("auto", "never", "always"):
429
+ raise MutualTLSChannelError(
430
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
431
+ )
432
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
433
+
434
+ @staticmethod
435
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
436
+ """Return the client cert source to be used by the client.
437
+
438
+ Args:
439
+ provided_cert_source (bytes): The client certificate source provided.
440
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
441
+
442
+ Returns:
443
+ bytes or None: The client cert source to be used by the client.
444
+ """
445
+ client_cert_source = None
446
+ if use_cert_flag:
447
+ if provided_cert_source:
448
+ client_cert_source = provided_cert_source
449
+ elif mtls.has_default_client_cert_source():
450
+ client_cert_source = mtls.default_client_cert_source()
451
+ return client_cert_source
452
+
453
+ @staticmethod
454
+ def _get_api_endpoint(
455
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
456
+ ):
457
+ """Return the API endpoint used by the client.
458
+
459
+ Args:
460
+ api_override (str): The API endpoint override. If specified, this is always
461
+ the return value of this function and the other arguments are not used.
462
+ client_cert_source (bytes): The client certificate source used by the client.
463
+ universe_domain (str): The universe domain used by the client.
464
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
465
+ Possible values are "always", "auto", or "never".
466
+
467
+ Returns:
468
+ str: The API endpoint to be used by the client.
469
+ """
470
+ if api_override is not None:
471
+ api_endpoint = api_override
472
+ elif use_mtls_endpoint == "always" or (
473
+ use_mtls_endpoint == "auto" and client_cert_source
474
+ ):
475
+ _default_universe = LlmUtilityServiceClient._DEFAULT_UNIVERSE
476
+ if universe_domain != _default_universe:
477
+ raise MutualTLSChannelError(
478
+ f"mTLS is not supported in any universe other than {_default_universe}."
479
+ )
480
+ api_endpoint = LlmUtilityServiceClient.DEFAULT_MTLS_ENDPOINT
481
+ else:
482
+ api_endpoint = LlmUtilityServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format(
483
+ UNIVERSE_DOMAIN=universe_domain
484
+ )
485
+ return api_endpoint
486
+
487
+ @staticmethod
488
+ def _get_universe_domain(
489
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
490
+ ) -> str:
491
+ """Return the universe domain used by the client.
492
+
493
+ Args:
494
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
495
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
496
+
497
+ Returns:
498
+ str: The universe domain to be used by the client.
499
+
500
+ Raises:
501
+ ValueError: If the universe domain is an empty string.
502
+ """
503
+ universe_domain = LlmUtilityServiceClient._DEFAULT_UNIVERSE
504
+ if client_universe_domain is not None:
505
+ universe_domain = client_universe_domain
506
+ elif universe_domain_env is not None:
507
+ universe_domain = universe_domain_env
508
+ if len(universe_domain.strip()) == 0:
509
+ raise ValueError("Universe Domain cannot be an empty string.")
510
+ return universe_domain
511
+
512
+ def _validate_universe_domain(self):
513
+ """Validates client's and credentials' universe domains are consistent.
514
+
515
+ Returns:
516
+ bool: True iff the configured universe domain is valid.
517
+
518
+ Raises:
519
+ ValueError: If the configured universe domain is not valid.
520
+ """
521
+
522
+ # NOTE (b/349488459): universe validation is disabled until further notice.
523
+ return True
524
+
525
+ def _add_cred_info_for_auth_errors(
526
+ self, error: core_exceptions.GoogleAPICallError
527
+ ) -> None:
528
+ """Adds credential info string to error details for 401/403/404 errors.
529
+
530
+ Args:
531
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
532
+ """
533
+ if error.code not in [
534
+ HTTPStatus.UNAUTHORIZED,
535
+ HTTPStatus.FORBIDDEN,
536
+ HTTPStatus.NOT_FOUND,
537
+ ]:
538
+ return
539
+
540
+ cred = self._transport._credentials
541
+
542
+ # get_cred_info is only available in google-auth>=2.35.0
543
+ if not hasattr(cred, "get_cred_info"):
544
+ return
545
+
546
+ # ignore the type check since pypy test fails when get_cred_info
547
+ # is not available
548
+ cred_info = cred.get_cred_info() # type: ignore
549
+ if cred_info and hasattr(error._details, "append"):
550
+ error._details.append(json.dumps(cred_info))
551
+
552
+ @property
553
+ def api_endpoint(self):
554
+ """Return the API endpoint used by the client instance.
555
+
556
+ Returns:
557
+ str: The API endpoint used by the client instance.
558
+ """
559
+ return self._api_endpoint
560
+
561
+ @property
562
+ def universe_domain(self) -> str:
563
+ """Return the universe domain used by the client instance.
564
+
565
+ Returns:
566
+ str: The universe domain used by the client instance.
567
+ """
568
+ return self._universe_domain
569
+
570
+ def __init__(
571
+ self,
572
+ *,
573
+ credentials: Optional[ga_credentials.Credentials] = None,
574
+ transport: Optional[
575
+ Union[
576
+ str,
577
+ LlmUtilityServiceTransport,
578
+ Callable[..., LlmUtilityServiceTransport],
579
+ ]
580
+ ] = None,
581
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
582
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
583
+ ) -> None:
584
+ """Instantiates the llm utility service client.
585
+
586
+ Args:
587
+ credentials (Optional[google.auth.credentials.Credentials]): The
588
+ authorization credentials to attach to requests. These
589
+ credentials identify the application to the service; if none
590
+ are specified, the client will attempt to ascertain the
591
+ credentials from the environment.
592
+ transport (Optional[Union[str,LlmUtilityServiceTransport,Callable[..., LlmUtilityServiceTransport]]]):
593
+ The transport to use, or a Callable that constructs and returns a new transport.
594
+ If a Callable is given, it will be called with the same set of initialization
595
+ arguments as used in the LlmUtilityServiceTransport constructor.
596
+ If set to None, a transport is chosen automatically.
597
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
598
+ Custom options for the client.
599
+
600
+ 1. The ``api_endpoint`` property can be used to override the
601
+ default endpoint provided by the client when ``transport`` is
602
+ not explicitly provided. Only if this property is not set and
603
+ ``transport`` was not explicitly provided, the endpoint is
604
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
605
+ variable, which have one of the following values:
606
+ "always" (always use the default mTLS endpoint), "never" (always
607
+ use the default regular endpoint) and "auto" (auto-switch to the
608
+ default mTLS endpoint if client certificate is present; this is
609
+ the default value).
610
+
611
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
612
+ is "true", then the ``client_cert_source`` property can be used
613
+ to provide a client certificate for mTLS transport. If
614
+ not provided, the default SSL client certificate will be used if
615
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
616
+ set, no client certificate will be used.
617
+
618
+ 3. The ``universe_domain`` property can be used to override the
619
+ default "googleapis.com" universe. Note that the ``api_endpoint``
620
+ property still takes precedence; and ``universe_domain`` is
621
+ currently not supported for mTLS.
622
+
623
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
624
+ The client info used to send a user-agent string along with
625
+ API requests. If ``None``, then default info will be used.
626
+ Generally, you only need to set this if you're developing
627
+ your own client library.
628
+
629
+ Raises:
630
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
631
+ creation failed for any reason.
632
+ """
633
+ self._client_options = client_options
634
+ if isinstance(self._client_options, dict):
635
+ self._client_options = client_options_lib.from_dict(self._client_options)
636
+ if self._client_options is None:
637
+ self._client_options = client_options_lib.ClientOptions()
638
+ self._client_options = cast(
639
+ client_options_lib.ClientOptions, self._client_options
640
+ )
641
+
642
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
643
+
644
+ self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
645
+ LlmUtilityServiceClient._read_environment_variables()
646
+ )
647
+ self._client_cert_source = LlmUtilityServiceClient._get_client_cert_source(
648
+ self._client_options.client_cert_source, self._use_client_cert
649
+ )
650
+ self._universe_domain = LlmUtilityServiceClient._get_universe_domain(
651
+ universe_domain_opt, self._universe_domain_env
652
+ )
653
+ self._api_endpoint = None # updated below, depending on `transport`
654
+
655
+ # Initialize the universe domain validation.
656
+ self._is_universe_domain_valid = False
657
+
658
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
659
+ # Setup logging.
660
+ client_logging.initialize_logging()
661
+
662
+ api_key_value = getattr(self._client_options, "api_key", None)
663
+ if api_key_value and credentials:
664
+ raise ValueError(
665
+ "client_options.api_key and credentials are mutually exclusive"
666
+ )
667
+
668
+ # Save or instantiate the transport.
669
+ # Ordinarily, we provide the transport, but allowing a custom transport
670
+ # instance provides an extensibility point for unusual situations.
671
+ transport_provided = isinstance(transport, LlmUtilityServiceTransport)
672
+ if transport_provided:
673
+ # transport is a LlmUtilityServiceTransport instance.
674
+ if credentials or self._client_options.credentials_file or api_key_value:
675
+ raise ValueError(
676
+ "When providing a transport instance, "
677
+ "provide its credentials directly."
678
+ )
679
+ if self._client_options.scopes:
680
+ raise ValueError(
681
+ "When providing a transport instance, provide its scopes "
682
+ "directly."
683
+ )
684
+ self._transport = cast(LlmUtilityServiceTransport, transport)
685
+ self._api_endpoint = self._transport.host
686
+
687
+ self._api_endpoint = (
688
+ self._api_endpoint
689
+ or LlmUtilityServiceClient._get_api_endpoint(
690
+ self._client_options.api_endpoint,
691
+ self._client_cert_source,
692
+ self._universe_domain,
693
+ self._use_mtls_endpoint,
694
+ )
695
+ )
696
+
697
+ if not transport_provided:
698
+ transport_init: Union[
699
+ Type[LlmUtilityServiceTransport],
700
+ Callable[..., LlmUtilityServiceTransport],
701
+ ] = (
702
+ LlmUtilityServiceClient.get_transport_class(transport)
703
+ if isinstance(transport, str) or transport is None
704
+ else cast(Callable[..., LlmUtilityServiceTransport], transport)
705
+ )
706
+
707
+ if "rest_asyncio" in str(transport_init):
708
+ unsupported_params = {
709
+ "google.api_core.client_options.ClientOptions.credentials_file": self._client_options.credentials_file,
710
+ "google.api_core.client_options.ClientOptions.scopes": self._client_options.scopes,
711
+ "google.api_core.client_options.ClientOptions.quota_project_id": self._client_options.quota_project_id,
712
+ "google.api_core.client_options.ClientOptions.client_cert_source": self._client_options.client_cert_source,
713
+ "google.api_core.client_options.ClientOptions.api_audience": self._client_options.api_audience,
714
+ }
715
+ provided_unsupported_params = [
716
+ name
717
+ for name, value in unsupported_params.items()
718
+ if value is not None
719
+ ]
720
+ if provided_unsupported_params:
721
+ raise core_exceptions.AsyncRestUnsupportedParameterError( # type: ignore
722
+ f"The following provided parameters are not supported for `transport=rest_asyncio`: {', '.join(provided_unsupported_params)}"
723
+ )
724
+ self._transport = transport_init(
725
+ credentials=credentials,
726
+ host=self._api_endpoint,
727
+ client_info=client_info,
728
+ )
729
+ return
730
+
731
+ import google.auth._default # type: ignore
732
+
733
+ if api_key_value and hasattr(
734
+ google.auth._default, "get_api_key_credentials"
735
+ ):
736
+ credentials = google.auth._default.get_api_key_credentials(
737
+ api_key_value
738
+ )
739
+
740
+ # initialize with the provided callable or the passed in class
741
+ self._transport = transport_init(
742
+ credentials=credentials,
743
+ credentials_file=self._client_options.credentials_file,
744
+ host=self._api_endpoint,
745
+ scopes=self._client_options.scopes,
746
+ client_cert_source_for_mtls=self._client_cert_source,
747
+ quota_project_id=self._client_options.quota_project_id,
748
+ client_info=client_info,
749
+ always_use_jwt_access=True,
750
+ api_audience=self._client_options.api_audience,
751
+ )
752
+
753
+ if "async" not in str(self._transport):
754
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
755
+ std_logging.DEBUG
756
+ ): # pragma: NO COVER
757
+ _LOGGER.debug(
758
+ "Created client `google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient`.",
759
+ extra=(
760
+ {
761
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
762
+ "universeDomain": getattr(
763
+ self._transport._credentials, "universe_domain", ""
764
+ ),
765
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
766
+ "credentialsInfo": getattr(
767
+ self.transport._credentials,
768
+ "get_cred_info",
769
+ lambda: None,
770
+ )(),
771
+ }
772
+ if hasattr(self._transport, "_credentials")
773
+ else {
774
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
775
+ "credentialsType": None,
776
+ }
777
+ ),
778
+ )
779
+
780
+ def compute_tokens(
781
+ self,
782
+ request: Optional[Union[llm_utility_service.ComputeTokensRequest, dict]] = None,
783
+ *,
784
+ endpoint: Optional[str] = None,
785
+ instances: Optional[MutableSequence[struct_pb2.Value]] = None,
786
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
787
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
788
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
789
+ ) -> llm_utility_service.ComputeTokensResponse:
790
+ r"""Return a list of tokens based on the input text.
791
+
792
+ .. code-block:: python
793
+
794
+ # This snippet has been automatically generated and should be regarded as a
795
+ # code template only.
796
+ # It will require modifications to work:
797
+ # - It may require correct/in-range values for request initialization.
798
+ # - It may require specifying regional endpoints when creating the service
799
+ # client as shown in:
800
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
801
+ from google.cloud import aiplatform_v1beta1
802
+
803
+ def sample_compute_tokens():
804
+ # Create a client
805
+ client = aiplatform_v1beta1.LlmUtilityServiceClient()
806
+
807
+ # Initialize request argument(s)
808
+ request = aiplatform_v1beta1.ComputeTokensRequest(
809
+ endpoint="endpoint_value",
810
+ )
811
+
812
+ # Make the request
813
+ response = client.compute_tokens(request=request)
814
+
815
+ # Handle the response
816
+ print(response)
817
+
818
+ Args:
819
+ request (Union[google.cloud.aiplatform_v1beta1.types.ComputeTokensRequest, dict]):
820
+ The request object. Request message for ComputeTokens RPC
821
+ call.
822
+ endpoint (str):
823
+ Required. The name of the Endpoint
824
+ requested to get lists of tokens and
825
+ token ids.
826
+
827
+ This corresponds to the ``endpoint`` field
828
+ on the ``request`` instance; if ``request`` is provided, this
829
+ should not be set.
830
+ instances (MutableSequence[google.protobuf.struct_pb2.Value]):
831
+ Optional. The instances that are the
832
+ input to token computing API call.
833
+ Schema is identical to the prediction
834
+ schema of the text model, even for the
835
+ non-text models, like chat models, or
836
+ Codey models.
837
+
838
+ This corresponds to the ``instances`` field
839
+ on the ``request`` instance; if ``request`` is provided, this
840
+ should not be set.
841
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
842
+ should be retried.
843
+ timeout (float): The timeout for this request.
844
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
845
+ sent along with the request as metadata. Normally, each value must be of type `str`,
846
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
847
+ be of type `bytes`.
848
+
849
+ Returns:
850
+ google.cloud.aiplatform_v1beta1.types.ComputeTokensResponse:
851
+ Response message for ComputeTokens
852
+ RPC call.
853
+
854
+ """
855
+ # Create or coerce a protobuf request object.
856
+ # - Quick check: If we got a request object, we should *not* have
857
+ # gotten any keyword arguments that map to the request.
858
+ flattened_params = [endpoint, instances]
859
+ has_flattened_params = (
860
+ len([param for param in flattened_params if param is not None]) > 0
861
+ )
862
+ if request is not None and has_flattened_params:
863
+ raise ValueError(
864
+ "If the `request` argument is set, then none of "
865
+ "the individual field arguments should be set."
866
+ )
867
+
868
+ # - Use the request object if provided (there's no risk of modifying the input as
869
+ # there are no flattened fields), or create one.
870
+ if not isinstance(request, llm_utility_service.ComputeTokensRequest):
871
+ request = llm_utility_service.ComputeTokensRequest(request)
872
+ # If we have keyword arguments corresponding to fields on the
873
+ # request, apply these.
874
+ if endpoint is not None:
875
+ request.endpoint = endpoint
876
+ if instances is not None:
877
+ request.instances.extend(instances)
878
+
879
+ # Wrap the RPC method; this adds retry and timeout information,
880
+ # and friendly error handling.
881
+ rpc = self._transport._wrapped_methods[self._transport.compute_tokens]
882
+
883
+ # Certain fields should be provided within the metadata header;
884
+ # add these here.
885
+ metadata = tuple(metadata) + (
886
+ gapic_v1.routing_header.to_grpc_metadata((("endpoint", request.endpoint),)),
887
+ )
888
+
889
+ # Validate the universe domain.
890
+ self._validate_universe_domain()
891
+
892
+ # Send the request.
893
+ response = rpc(
894
+ request,
895
+ retry=retry,
896
+ timeout=timeout,
897
+ metadata=metadata,
898
+ )
899
+
900
+ # Done; return the response.
901
+ return response
902
+
903
+ def __enter__(self) -> "LlmUtilityServiceClient":
904
+ return self
905
+
906
+ def __exit__(self, type, value, traceback):
907
+ """Releases underlying transport's resources.
908
+
909
+ .. warning::
910
+ ONLY use as a context manager if the transport is NOT shared
911
+ with other clients! Exiting the with block will CLOSE the transport
912
+ and may cause errors in other clients!
913
+ """
914
+ self.transport.close()
915
+
916
+ def list_operations(
917
+ self,
918
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
919
+ *,
920
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
921
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
922
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
923
+ ) -> operations_pb2.ListOperationsResponse:
924
+ r"""Lists operations that match the specified filter in the request.
925
+
926
+ Args:
927
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
928
+ The request object. Request message for
929
+ `ListOperations` method.
930
+ retry (google.api_core.retry.Retry): Designation of what errors,
931
+ if any, should be retried.
932
+ timeout (float): The timeout for this request.
933
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
934
+ sent along with the request as metadata. Normally, each value must be of type `str`,
935
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
936
+ be of type `bytes`.
937
+ Returns:
938
+ ~.operations_pb2.ListOperationsResponse:
939
+ Response message for ``ListOperations`` method.
940
+ """
941
+ # Create or coerce a protobuf request object.
942
+ # The request isn't a proto-plus wrapped type,
943
+ # so it must be constructed via keyword expansion.
944
+ if isinstance(request, dict):
945
+ request = operations_pb2.ListOperationsRequest(**request)
946
+
947
+ # Wrap the RPC method; this adds retry and timeout information,
948
+ # and friendly error handling.
949
+ rpc = self._transport._wrapped_methods[self._transport.list_operations]
950
+
951
+ # Certain fields should be provided within the metadata header;
952
+ # add these here.
953
+ metadata = tuple(metadata) + (
954
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
955
+ )
956
+
957
+ # Validate the universe domain.
958
+ self._validate_universe_domain()
959
+
960
+ try:
961
+ # Send the request.
962
+ response = rpc(
963
+ request,
964
+ retry=retry,
965
+ timeout=timeout,
966
+ metadata=metadata,
967
+ )
968
+
969
+ # Done; return the response.
970
+ return response
971
+ except core_exceptions.GoogleAPICallError as e:
972
+ self._add_cred_info_for_auth_errors(e)
973
+ raise e
974
+
975
+ def get_operation(
976
+ self,
977
+ request: Optional[operations_pb2.GetOperationRequest] = None,
978
+ *,
979
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
980
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
981
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
982
+ ) -> operations_pb2.Operation:
983
+ r"""Gets the latest state of a long-running operation.
984
+
985
+ Args:
986
+ request (:class:`~.operations_pb2.GetOperationRequest`):
987
+ The request object. Request message for
988
+ `GetOperation` method.
989
+ retry (google.api_core.retry.Retry): Designation of what errors,
990
+ if any, should be retried.
991
+ timeout (float): The timeout for this request.
992
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
993
+ sent along with the request as metadata. Normally, each value must be of type `str`,
994
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
995
+ be of type `bytes`.
996
+ Returns:
997
+ ~.operations_pb2.Operation:
998
+ An ``Operation`` object.
999
+ """
1000
+ # Create or coerce a protobuf request object.
1001
+ # The request isn't a proto-plus wrapped type,
1002
+ # so it must be constructed via keyword expansion.
1003
+ if isinstance(request, dict):
1004
+ request = operations_pb2.GetOperationRequest(**request)
1005
+
1006
+ # Wrap the RPC method; this adds retry and timeout information,
1007
+ # and friendly error handling.
1008
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
1009
+
1010
+ # Certain fields should be provided within the metadata header;
1011
+ # add these here.
1012
+ metadata = tuple(metadata) + (
1013
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1014
+ )
1015
+
1016
+ # Validate the universe domain.
1017
+ self._validate_universe_domain()
1018
+
1019
+ try:
1020
+ # Send the request.
1021
+ response = rpc(
1022
+ request,
1023
+ retry=retry,
1024
+ timeout=timeout,
1025
+ metadata=metadata,
1026
+ )
1027
+
1028
+ # Done; return the response.
1029
+ return response
1030
+ except core_exceptions.GoogleAPICallError as e:
1031
+ self._add_cred_info_for_auth_errors(e)
1032
+ raise e
1033
+
1034
+ def delete_operation(
1035
+ self,
1036
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
1037
+ *,
1038
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1039
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1040
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1041
+ ) -> None:
1042
+ r"""Deletes a long-running operation.
1043
+
1044
+ This method indicates that the client is no longer interested
1045
+ in the operation result. It does not cancel the operation.
1046
+ If the server doesn't support this method, it returns
1047
+ `google.rpc.Code.UNIMPLEMENTED`.
1048
+
1049
+ Args:
1050
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
1051
+ The request object. Request message for
1052
+ `DeleteOperation` method.
1053
+ retry (google.api_core.retry.Retry): Designation of what errors,
1054
+ if any, should be retried.
1055
+ timeout (float): The timeout for this request.
1056
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1057
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1058
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1059
+ be of type `bytes`.
1060
+ Returns:
1061
+ None
1062
+ """
1063
+ # Create or coerce a protobuf request object.
1064
+ # The request isn't a proto-plus wrapped type,
1065
+ # so it must be constructed via keyword expansion.
1066
+ if isinstance(request, dict):
1067
+ request = operations_pb2.DeleteOperationRequest(**request)
1068
+
1069
+ # Wrap the RPC method; this adds retry and timeout information,
1070
+ # and friendly error handling.
1071
+ rpc = self._transport._wrapped_methods[self._transport.delete_operation]
1072
+
1073
+ # Certain fields should be provided within the metadata header;
1074
+ # add these here.
1075
+ metadata = tuple(metadata) + (
1076
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1077
+ )
1078
+
1079
+ # Validate the universe domain.
1080
+ self._validate_universe_domain()
1081
+
1082
+ # Send the request.
1083
+ rpc(
1084
+ request,
1085
+ retry=retry,
1086
+ timeout=timeout,
1087
+ metadata=metadata,
1088
+ )
1089
+
1090
+ def cancel_operation(
1091
+ self,
1092
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1093
+ *,
1094
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1095
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1096
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1097
+ ) -> None:
1098
+ r"""Starts asynchronous cancellation on a long-running operation.
1099
+
1100
+ The server makes a best effort to cancel the operation, but success
1101
+ is not guaranteed. If the server doesn't support this method, it returns
1102
+ `google.rpc.Code.UNIMPLEMENTED`.
1103
+
1104
+ Args:
1105
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1106
+ The request object. Request message for
1107
+ `CancelOperation` method.
1108
+ retry (google.api_core.retry.Retry): Designation of what errors,
1109
+ if any, should be retried.
1110
+ timeout (float): The timeout for this request.
1111
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1112
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1113
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1114
+ be of type `bytes`.
1115
+ Returns:
1116
+ None
1117
+ """
1118
+ # Create or coerce a protobuf request object.
1119
+ # The request isn't a proto-plus wrapped type,
1120
+ # so it must be constructed via keyword expansion.
1121
+ if isinstance(request, dict):
1122
+ request = operations_pb2.CancelOperationRequest(**request)
1123
+
1124
+ # Wrap the RPC method; this adds retry and timeout information,
1125
+ # and friendly error handling.
1126
+ rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
1127
+
1128
+ # Certain fields should be provided within the metadata header;
1129
+ # add these here.
1130
+ metadata = tuple(metadata) + (
1131
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1132
+ )
1133
+
1134
+ # Validate the universe domain.
1135
+ self._validate_universe_domain()
1136
+
1137
+ # Send the request.
1138
+ rpc(
1139
+ request,
1140
+ retry=retry,
1141
+ timeout=timeout,
1142
+ metadata=metadata,
1143
+ )
1144
+
1145
+ def wait_operation(
1146
+ self,
1147
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
1148
+ *,
1149
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1150
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1151
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1152
+ ) -> operations_pb2.Operation:
1153
+ r"""Waits until the specified long-running operation is done or reaches at most
1154
+ a specified timeout, returning the latest state.
1155
+
1156
+ If the operation is already done, the latest state is immediately returned.
1157
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
1158
+ timeout is used. If the server does not support this method, it returns
1159
+ `google.rpc.Code.UNIMPLEMENTED`.
1160
+
1161
+ Args:
1162
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
1163
+ The request object. Request message for
1164
+ `WaitOperation` method.
1165
+ retry (google.api_core.retry.Retry): Designation of what errors,
1166
+ if any, should be retried.
1167
+ timeout (float): The timeout for this request.
1168
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1169
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1170
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1171
+ be of type `bytes`.
1172
+ Returns:
1173
+ ~.operations_pb2.Operation:
1174
+ An ``Operation`` object.
1175
+ """
1176
+ # Create or coerce a protobuf request object.
1177
+ # The request isn't a proto-plus wrapped type,
1178
+ # so it must be constructed via keyword expansion.
1179
+ if isinstance(request, dict):
1180
+ request = operations_pb2.WaitOperationRequest(**request)
1181
+
1182
+ # Wrap the RPC method; this adds retry and timeout information,
1183
+ # and friendly error handling.
1184
+ rpc = self._transport._wrapped_methods[self._transport.wait_operation]
1185
+
1186
+ # Certain fields should be provided within the metadata header;
1187
+ # add these here.
1188
+ metadata = tuple(metadata) + (
1189
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1190
+ )
1191
+
1192
+ # Validate the universe domain.
1193
+ self._validate_universe_domain()
1194
+
1195
+ try:
1196
+ # Send the request.
1197
+ response = rpc(
1198
+ request,
1199
+ retry=retry,
1200
+ timeout=timeout,
1201
+ metadata=metadata,
1202
+ )
1203
+
1204
+ # Done; return the response.
1205
+ return response
1206
+ except core_exceptions.GoogleAPICallError as e:
1207
+ self._add_cred_info_for_auth_errors(e)
1208
+ raise e
1209
+
1210
+ def set_iam_policy(
1211
+ self,
1212
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
1213
+ *,
1214
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1215
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1216
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1217
+ ) -> policy_pb2.Policy:
1218
+ r"""Sets the IAM access control policy on the specified function.
1219
+
1220
+ Replaces any existing policy.
1221
+
1222
+ Args:
1223
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
1224
+ The request object. Request message for `SetIamPolicy`
1225
+ method.
1226
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1227
+ should be retried.
1228
+ timeout (float): The timeout for this request.
1229
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1230
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1231
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1232
+ be of type `bytes`.
1233
+ Returns:
1234
+ ~.policy_pb2.Policy:
1235
+ Defines an Identity and Access Management (IAM) policy.
1236
+ It is used to specify access control policies for Cloud
1237
+ Platform resources.
1238
+ A ``Policy`` is a collection of ``bindings``. A
1239
+ ``binding`` binds one or more ``members`` to a single
1240
+ ``role``. Members can be user accounts, service
1241
+ accounts, Google groups, and domains (such as G Suite).
1242
+ A ``role`` is a named list of permissions (defined by
1243
+ IAM or configured by users). A ``binding`` can
1244
+ optionally specify a ``condition``, which is a logic
1245
+ expression that further constrains the role binding
1246
+ based on attributes about the request and/or target
1247
+ resource.
1248
+
1249
+ **JSON Example**
1250
+
1251
+ ::
1252
+
1253
+ {
1254
+ "bindings": [
1255
+ {
1256
+ "role": "roles/resourcemanager.organizationAdmin",
1257
+ "members": [
1258
+ "user:mike@example.com",
1259
+ "group:admins@example.com",
1260
+ "domain:google.com",
1261
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1262
+ ]
1263
+ },
1264
+ {
1265
+ "role": "roles/resourcemanager.organizationViewer",
1266
+ "members": ["user:eve@example.com"],
1267
+ "condition": {
1268
+ "title": "expirable access",
1269
+ "description": "Does not grant access after Sep 2020",
1270
+ "expression": "request.time <
1271
+ timestamp('2020-10-01T00:00:00.000Z')",
1272
+ }
1273
+ }
1274
+ ]
1275
+ }
1276
+
1277
+ **YAML Example**
1278
+
1279
+ ::
1280
+
1281
+ bindings:
1282
+ - members:
1283
+ - user:mike@example.com
1284
+ - group:admins@example.com
1285
+ - domain:google.com
1286
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1287
+ role: roles/resourcemanager.organizationAdmin
1288
+ - members:
1289
+ - user:eve@example.com
1290
+ role: roles/resourcemanager.organizationViewer
1291
+ condition:
1292
+ title: expirable access
1293
+ description: Does not grant access after Sep 2020
1294
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1295
+
1296
+ For a description of IAM and its features, see the `IAM
1297
+ developer's
1298
+ guide <https://cloud.google.com/iam/docs>`__.
1299
+ """
1300
+ # Create or coerce a protobuf request object.
1301
+
1302
+ # The request isn't a proto-plus wrapped type,
1303
+ # so it must be constructed via keyword expansion.
1304
+ if isinstance(request, dict):
1305
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1306
+
1307
+ # Wrap the RPC method; this adds retry and timeout information,
1308
+ # and friendly error handling.
1309
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
1310
+
1311
+ # Certain fields should be provided within the metadata header;
1312
+ # add these here.
1313
+ metadata = tuple(metadata) + (
1314
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1315
+ )
1316
+
1317
+ # Validate the universe domain.
1318
+ self._validate_universe_domain()
1319
+
1320
+ try:
1321
+ # Send the request.
1322
+ response = rpc(
1323
+ request,
1324
+ retry=retry,
1325
+ timeout=timeout,
1326
+ metadata=metadata,
1327
+ )
1328
+
1329
+ # Done; return the response.
1330
+ return response
1331
+ except core_exceptions.GoogleAPICallError as e:
1332
+ self._add_cred_info_for_auth_errors(e)
1333
+ raise e
1334
+
1335
+ def get_iam_policy(
1336
+ self,
1337
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
1338
+ *,
1339
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1340
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1341
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1342
+ ) -> policy_pb2.Policy:
1343
+ r"""Gets the IAM access control policy for a function.
1344
+
1345
+ Returns an empty policy if the function exists and does not have a
1346
+ policy set.
1347
+
1348
+ Args:
1349
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
1350
+ The request object. Request message for `GetIamPolicy`
1351
+ method.
1352
+ retry (google.api_core.retry.Retry): Designation of what errors, if
1353
+ any, should be retried.
1354
+ timeout (float): The timeout for this request.
1355
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1356
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1357
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1358
+ be of type `bytes`.
1359
+ Returns:
1360
+ ~.policy_pb2.Policy:
1361
+ Defines an Identity and Access Management (IAM) policy.
1362
+ It is used to specify access control policies for Cloud
1363
+ Platform resources.
1364
+ A ``Policy`` is a collection of ``bindings``. A
1365
+ ``binding`` binds one or more ``members`` to a single
1366
+ ``role``. Members can be user accounts, service
1367
+ accounts, Google groups, and domains (such as G Suite).
1368
+ A ``role`` is a named list of permissions (defined by
1369
+ IAM or configured by users). A ``binding`` can
1370
+ optionally specify a ``condition``, which is a logic
1371
+ expression that further constrains the role binding
1372
+ based on attributes about the request and/or target
1373
+ resource.
1374
+
1375
+ **JSON Example**
1376
+
1377
+ ::
1378
+
1379
+ {
1380
+ "bindings": [
1381
+ {
1382
+ "role": "roles/resourcemanager.organizationAdmin",
1383
+ "members": [
1384
+ "user:mike@example.com",
1385
+ "group:admins@example.com",
1386
+ "domain:google.com",
1387
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1388
+ ]
1389
+ },
1390
+ {
1391
+ "role": "roles/resourcemanager.organizationViewer",
1392
+ "members": ["user:eve@example.com"],
1393
+ "condition": {
1394
+ "title": "expirable access",
1395
+ "description": "Does not grant access after Sep 2020",
1396
+ "expression": "request.time <
1397
+ timestamp('2020-10-01T00:00:00.000Z')",
1398
+ }
1399
+ }
1400
+ ]
1401
+ }
1402
+
1403
+ **YAML Example**
1404
+
1405
+ ::
1406
+
1407
+ bindings:
1408
+ - members:
1409
+ - user:mike@example.com
1410
+ - group:admins@example.com
1411
+ - domain:google.com
1412
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1413
+ role: roles/resourcemanager.organizationAdmin
1414
+ - members:
1415
+ - user:eve@example.com
1416
+ role: roles/resourcemanager.organizationViewer
1417
+ condition:
1418
+ title: expirable access
1419
+ description: Does not grant access after Sep 2020
1420
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1421
+
1422
+ For a description of IAM and its features, see the `IAM
1423
+ developer's
1424
+ guide <https://cloud.google.com/iam/docs>`__.
1425
+ """
1426
+ # Create or coerce a protobuf request object.
1427
+
1428
+ # The request isn't a proto-plus wrapped type,
1429
+ # so it must be constructed via keyword expansion.
1430
+ if isinstance(request, dict):
1431
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1432
+
1433
+ # Wrap the RPC method; this adds retry and timeout information,
1434
+ # and friendly error handling.
1435
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
1436
+
1437
+ # Certain fields should be provided within the metadata header;
1438
+ # add these here.
1439
+ metadata = tuple(metadata) + (
1440
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1441
+ )
1442
+
1443
+ # Validate the universe domain.
1444
+ self._validate_universe_domain()
1445
+
1446
+ try:
1447
+ # Send the request.
1448
+ response = rpc(
1449
+ request,
1450
+ retry=retry,
1451
+ timeout=timeout,
1452
+ metadata=metadata,
1453
+ )
1454
+
1455
+ # Done; return the response.
1456
+ return response
1457
+ except core_exceptions.GoogleAPICallError as e:
1458
+ self._add_cred_info_for_auth_errors(e)
1459
+ raise e
1460
+
1461
+ def test_iam_permissions(
1462
+ self,
1463
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
1464
+ *,
1465
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1466
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1467
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1468
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1469
+ r"""Tests the specified IAM permissions against the IAM access control
1470
+ policy for a function.
1471
+
1472
+ If the function does not exist, this will return an empty set
1473
+ of permissions, not a NOT_FOUND error.
1474
+
1475
+ Args:
1476
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
1477
+ The request object. Request message for
1478
+ `TestIamPermissions` method.
1479
+ retry (google.api_core.retry.Retry): Designation of what errors,
1480
+ if any, should be retried.
1481
+ timeout (float): The timeout for this request.
1482
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1483
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1484
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1485
+ be of type `bytes`.
1486
+ Returns:
1487
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
1488
+ Response message for ``TestIamPermissions`` method.
1489
+ """
1490
+ # Create or coerce a protobuf request object.
1491
+
1492
+ # The request isn't a proto-plus wrapped type,
1493
+ # so it must be constructed via keyword expansion.
1494
+ if isinstance(request, dict):
1495
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1496
+
1497
+ # Wrap the RPC method; this adds retry and timeout information,
1498
+ # and friendly error handling.
1499
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
1500
+
1501
+ # Certain fields should be provided within the metadata header;
1502
+ # add these here.
1503
+ metadata = tuple(metadata) + (
1504
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1505
+ )
1506
+
1507
+ # Validate the universe domain.
1508
+ self._validate_universe_domain()
1509
+
1510
+ try:
1511
+ # Send the request.
1512
+ response = rpc(
1513
+ request,
1514
+ retry=retry,
1515
+ timeout=timeout,
1516
+ metadata=metadata,
1517
+ )
1518
+
1519
+ # Done; return the response.
1520
+ return response
1521
+ except core_exceptions.GoogleAPICallError as e:
1522
+ self._add_cred_info_for_auth_errors(e)
1523
+ raise e
1524
+
1525
+ def get_location(
1526
+ self,
1527
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1528
+ *,
1529
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1530
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1531
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1532
+ ) -> locations_pb2.Location:
1533
+ r"""Gets information about a location.
1534
+
1535
+ Args:
1536
+ request (:class:`~.location_pb2.GetLocationRequest`):
1537
+ The request object. Request message for
1538
+ `GetLocation` method.
1539
+ retry (google.api_core.retry.Retry): Designation of what errors,
1540
+ if any, should be retried.
1541
+ timeout (float): The timeout for this request.
1542
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1543
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1544
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1545
+ be of type `bytes`.
1546
+ Returns:
1547
+ ~.location_pb2.Location:
1548
+ Location object.
1549
+ """
1550
+ # Create or coerce a protobuf request object.
1551
+ # The request isn't a proto-plus wrapped type,
1552
+ # so it must be constructed via keyword expansion.
1553
+ if isinstance(request, dict):
1554
+ request = locations_pb2.GetLocationRequest(**request)
1555
+
1556
+ # Wrap the RPC method; this adds retry and timeout information,
1557
+ # and friendly error handling.
1558
+ rpc = self._transport._wrapped_methods[self._transport.get_location]
1559
+
1560
+ # Certain fields should be provided within the metadata header;
1561
+ # add these here.
1562
+ metadata = tuple(metadata) + (
1563
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1564
+ )
1565
+
1566
+ # Validate the universe domain.
1567
+ self._validate_universe_domain()
1568
+
1569
+ try:
1570
+ # Send the request.
1571
+ response = rpc(
1572
+ request,
1573
+ retry=retry,
1574
+ timeout=timeout,
1575
+ metadata=metadata,
1576
+ )
1577
+
1578
+ # Done; return the response.
1579
+ return response
1580
+ except core_exceptions.GoogleAPICallError as e:
1581
+ self._add_cred_info_for_auth_errors(e)
1582
+ raise e
1583
+
1584
+ def list_locations(
1585
+ self,
1586
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1587
+ *,
1588
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1589
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1590
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1591
+ ) -> locations_pb2.ListLocationsResponse:
1592
+ r"""Lists information about the supported locations for this service.
1593
+
1594
+ Args:
1595
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1596
+ The request object. Request message for
1597
+ `ListLocations` method.
1598
+ retry (google.api_core.retry.Retry): Designation of what errors,
1599
+ if any, should be retried.
1600
+ timeout (float): The timeout for this request.
1601
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1602
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1603
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1604
+ be of type `bytes`.
1605
+ Returns:
1606
+ ~.location_pb2.ListLocationsResponse:
1607
+ Response message for ``ListLocations`` method.
1608
+ """
1609
+ # Create or coerce a protobuf request object.
1610
+ # The request isn't a proto-plus wrapped type,
1611
+ # so it must be constructed via keyword expansion.
1612
+ if isinstance(request, dict):
1613
+ request = locations_pb2.ListLocationsRequest(**request)
1614
+
1615
+ # Wrap the RPC method; this adds retry and timeout information,
1616
+ # and friendly error handling.
1617
+ rpc = self._transport._wrapped_methods[self._transport.list_locations]
1618
+
1619
+ # Certain fields should be provided within the metadata header;
1620
+ # add these here.
1621
+ metadata = tuple(metadata) + (
1622
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1623
+ )
1624
+
1625
+ # Validate the universe domain.
1626
+ self._validate_universe_domain()
1627
+
1628
+ try:
1629
+ # Send the request.
1630
+ response = rpc(
1631
+ request,
1632
+ retry=retry,
1633
+ timeout=timeout,
1634
+ metadata=metadata,
1635
+ )
1636
+
1637
+ # Done; return the response.
1638
+ return response
1639
+ except core_exceptions.GoogleAPICallError as e:
1640
+ self._add_cred_info_for_auth_errors(e)
1641
+ raise e
1642
+
1643
+
1644
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1645
+ gapic_version=package_version.__version__
1646
+ )
1647
+
1648
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1649
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1650
+
1651
+ __all__ = ("LlmUtilityServiceClient",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type, Tuple
18
+
19
+ from .base import LlmUtilityServiceTransport
20
+ from .grpc import LlmUtilityServiceGrpcTransport
21
+ from .grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport
22
+ from .rest import LlmUtilityServiceRestTransport
23
+ from .rest import LlmUtilityServiceRestInterceptor
24
+
25
+ ASYNC_REST_CLASSES: Tuple[str, ...]
26
+ try:
27
+ from .rest_asyncio import AsyncLlmUtilityServiceRestTransport
28
+ from .rest_asyncio import AsyncLlmUtilityServiceRestInterceptor
29
+
30
+ ASYNC_REST_CLASSES = (
31
+ "AsyncLlmUtilityServiceRestTransport",
32
+ "AsyncLlmUtilityServiceRestInterceptor",
33
+ )
34
+ HAS_REST_ASYNC = True
35
+ except ImportError: # pragma: NO COVER
36
+ ASYNC_REST_CLASSES = ()
37
+ HAS_REST_ASYNC = False
38
+
39
+
40
+ # Compile a registry of transports.
41
+ _transport_registry = OrderedDict() # type: Dict[str, Type[LlmUtilityServiceTransport]]
42
+ _transport_registry["grpc"] = LlmUtilityServiceGrpcTransport
43
+ _transport_registry["grpc_asyncio"] = LlmUtilityServiceGrpcAsyncIOTransport
44
+ _transport_registry["rest"] = LlmUtilityServiceRestTransport
45
+ if HAS_REST_ASYNC: # pragma: NO COVER
46
+ _transport_registry["rest_asyncio"] = AsyncLlmUtilityServiceRestTransport
47
+
48
+ __all__ = (
49
+ "LlmUtilityServiceTransport",
50
+ "LlmUtilityServiceGrpcTransport",
51
+ "LlmUtilityServiceGrpcAsyncIOTransport",
52
+ "LlmUtilityServiceRestTransport",
53
+ "LlmUtilityServiceRestInterceptor",
54
+ ) + ASYNC_REST_CLASSES
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (1.27 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/base.cpython-312.pyc ADDED
Binary file (12.2 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/grpc.cpython-312.pyc ADDED
Binary file (24.7 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/grpc_asyncio.cpython-312.pyc ADDED
Binary file (27.7 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest.cpython-312.pyc ADDED
Binary file (73.4 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest_asyncio.cpython-312.pyc ADDED
Binary file (80.9 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/__pycache__/rest_base.cpython-312.pyc ADDED
Binary file (72.8 kB). View file
 
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/base.py ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ from google.cloud.aiplatform_v1beta1 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.oauth2 import service_account # type: ignore
28
+ import google.protobuf
29
+
30
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
31
+ from google.cloud.location import locations_pb2 # type: ignore
32
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
33
+ from google.iam.v1 import policy_pb2 # type: ignore
34
+ from google.longrunning import operations_pb2 # type: ignore
35
+
36
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
37
+ gapic_version=package_version.__version__
38
+ )
39
+
40
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
41
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
42
+
43
+
44
+ class LlmUtilityServiceTransport(abc.ABC):
45
+ """Abstract transport class for LlmUtilityService."""
46
+
47
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
48
+
49
+ DEFAULT_HOST: str = "aiplatform.googleapis.com"
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ host: str = DEFAULT_HOST,
55
+ credentials: Optional[ga_credentials.Credentials] = None,
56
+ credentials_file: Optional[str] = None,
57
+ scopes: Optional[Sequence[str]] = None,
58
+ quota_project_id: Optional[str] = None,
59
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
60
+ always_use_jwt_access: Optional[bool] = False,
61
+ api_audience: Optional[str] = None,
62
+ **kwargs,
63
+ ) -> None:
64
+ """Instantiate the transport.
65
+
66
+ Args:
67
+ host (Optional[str]):
68
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
69
+ credentials (Optional[google.auth.credentials.Credentials]): The
70
+ authorization credentials to attach to requests. These
71
+ credentials identify the application to the service; if none
72
+ are specified, the client will attempt to ascertain the
73
+ credentials from the environment.
74
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
75
+ be loaded with :func:`google.auth.load_credentials_from_file`.
76
+ This argument is mutually exclusive with credentials. This argument will be
77
+ removed in the next major version of this library.
78
+ scopes (Optional[Sequence[str]]): A list of scopes.
79
+ quota_project_id (Optional[str]): An optional project to use for billing
80
+ and quota.
81
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
82
+ The client info used to send a user-agent string along with
83
+ API requests. If ``None``, then default info will be used.
84
+ Generally, you only need to set this if you're developing
85
+ your own client library.
86
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
87
+ be used for service account credentials.
88
+ """
89
+
90
+ # Save the scopes.
91
+ self._scopes = scopes
92
+ if not hasattr(self, "_ignore_credentials"):
93
+ self._ignore_credentials: bool = False
94
+
95
+ # If no credentials are provided, then determine the appropriate
96
+ # defaults.
97
+ if credentials and credentials_file:
98
+ raise core_exceptions.DuplicateCredentialArgs(
99
+ "'credentials_file' and 'credentials' are mutually exclusive"
100
+ )
101
+
102
+ if credentials_file is not None:
103
+ credentials, _ = google.auth.load_credentials_from_file(
104
+ credentials_file,
105
+ scopes=scopes,
106
+ quota_project_id=quota_project_id,
107
+ default_scopes=self.AUTH_SCOPES,
108
+ )
109
+ elif credentials is None and not self._ignore_credentials:
110
+ credentials, _ = google.auth.default(
111
+ scopes=scopes,
112
+ quota_project_id=quota_project_id,
113
+ default_scopes=self.AUTH_SCOPES,
114
+ )
115
+ # Don't apply audience if the credentials file passed from user.
116
+ if hasattr(credentials, "with_gdch_audience"):
117
+ credentials = credentials.with_gdch_audience(
118
+ api_audience if api_audience else host
119
+ )
120
+
121
+ # If the credentials are service account credentials, then always try to use self signed JWT.
122
+ if (
123
+ always_use_jwt_access
124
+ and isinstance(credentials, service_account.Credentials)
125
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
126
+ ):
127
+ credentials = credentials.with_always_use_jwt_access(True)
128
+
129
+ # Save the credentials.
130
+ self._credentials = credentials
131
+
132
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
133
+ if ":" not in host:
134
+ host += ":443"
135
+ self._host = host
136
+
137
+ @property
138
+ def host(self):
139
+ return self._host
140
+
141
+ def _prep_wrapped_messages(self, client_info):
142
+ # Precompute the wrapped methods.
143
+ self._wrapped_methods = {
144
+ self.compute_tokens: gapic_v1.method.wrap_method(
145
+ self.compute_tokens,
146
+ default_timeout=None,
147
+ client_info=client_info,
148
+ ),
149
+ self.get_location: gapic_v1.method.wrap_method(
150
+ self.get_location,
151
+ default_timeout=None,
152
+ client_info=client_info,
153
+ ),
154
+ self.list_locations: gapic_v1.method.wrap_method(
155
+ self.list_locations,
156
+ default_timeout=None,
157
+ client_info=client_info,
158
+ ),
159
+ self.get_iam_policy: gapic_v1.method.wrap_method(
160
+ self.get_iam_policy,
161
+ default_timeout=None,
162
+ client_info=client_info,
163
+ ),
164
+ self.set_iam_policy: gapic_v1.method.wrap_method(
165
+ self.set_iam_policy,
166
+ default_timeout=None,
167
+ client_info=client_info,
168
+ ),
169
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
170
+ self.test_iam_permissions,
171
+ default_timeout=None,
172
+ client_info=client_info,
173
+ ),
174
+ self.cancel_operation: gapic_v1.method.wrap_method(
175
+ self.cancel_operation,
176
+ default_timeout=None,
177
+ client_info=client_info,
178
+ ),
179
+ self.delete_operation: gapic_v1.method.wrap_method(
180
+ self.delete_operation,
181
+ default_timeout=None,
182
+ client_info=client_info,
183
+ ),
184
+ self.get_operation: gapic_v1.method.wrap_method(
185
+ self.get_operation,
186
+ default_timeout=None,
187
+ client_info=client_info,
188
+ ),
189
+ self.list_operations: gapic_v1.method.wrap_method(
190
+ self.list_operations,
191
+ default_timeout=None,
192
+ client_info=client_info,
193
+ ),
194
+ self.wait_operation: gapic_v1.method.wrap_method(
195
+ self.wait_operation,
196
+ default_timeout=None,
197
+ client_info=client_info,
198
+ ),
199
+ }
200
+
201
+ def close(self):
202
+ """Closes resources associated with the transport.
203
+
204
+ .. warning::
205
+ Only call this method if the transport is NOT shared
206
+ with other clients - this may cause errors in other clients!
207
+ """
208
+ raise NotImplementedError()
209
+
210
+ @property
211
+ def compute_tokens(
212
+ self,
213
+ ) -> Callable[
214
+ [llm_utility_service.ComputeTokensRequest],
215
+ Union[
216
+ llm_utility_service.ComputeTokensResponse,
217
+ Awaitable[llm_utility_service.ComputeTokensResponse],
218
+ ],
219
+ ]:
220
+ raise NotImplementedError()
221
+
222
+ @property
223
+ def list_operations(
224
+ self,
225
+ ) -> Callable[
226
+ [operations_pb2.ListOperationsRequest],
227
+ Union[
228
+ operations_pb2.ListOperationsResponse,
229
+ Awaitable[operations_pb2.ListOperationsResponse],
230
+ ],
231
+ ]:
232
+ raise NotImplementedError()
233
+
234
+ @property
235
+ def get_operation(
236
+ self,
237
+ ) -> Callable[
238
+ [operations_pb2.GetOperationRequest],
239
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
240
+ ]:
241
+ raise NotImplementedError()
242
+
243
+ @property
244
+ def cancel_operation(
245
+ self,
246
+ ) -> Callable[
247
+ [operations_pb2.CancelOperationRequest],
248
+ None,
249
+ ]:
250
+ raise NotImplementedError()
251
+
252
+ @property
253
+ def delete_operation(
254
+ self,
255
+ ) -> Callable[
256
+ [operations_pb2.DeleteOperationRequest],
257
+ None,
258
+ ]:
259
+ raise NotImplementedError()
260
+
261
+ @property
262
+ def wait_operation(
263
+ self,
264
+ ) -> Callable[
265
+ [operations_pb2.WaitOperationRequest],
266
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
267
+ ]:
268
+ raise NotImplementedError()
269
+
270
+ @property
271
+ def set_iam_policy(
272
+ self,
273
+ ) -> Callable[
274
+ [iam_policy_pb2.SetIamPolicyRequest],
275
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
276
+ ]:
277
+ raise NotImplementedError()
278
+
279
+ @property
280
+ def get_iam_policy(
281
+ self,
282
+ ) -> Callable[
283
+ [iam_policy_pb2.GetIamPolicyRequest],
284
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
285
+ ]:
286
+ raise NotImplementedError()
287
+
288
+ @property
289
+ def test_iam_permissions(
290
+ self,
291
+ ) -> Callable[
292
+ [iam_policy_pb2.TestIamPermissionsRequest],
293
+ Union[
294
+ iam_policy_pb2.TestIamPermissionsResponse,
295
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
296
+ ],
297
+ ]:
298
+ raise NotImplementedError()
299
+
300
+ @property
301
+ def get_location(
302
+ self,
303
+ ) -> Callable[
304
+ [locations_pb2.GetLocationRequest],
305
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
306
+ ]:
307
+ raise NotImplementedError()
308
+
309
+ @property
310
+ def list_locations(
311
+ self,
312
+ ) -> Callable[
313
+ [locations_pb2.ListLocationsRequest],
314
+ Union[
315
+ locations_pb2.ListLocationsResponse,
316
+ Awaitable[locations_pb2.ListLocationsResponse],
317
+ ],
318
+ ]:
319
+ raise NotImplementedError()
320
+
321
+ @property
322
+ def kind(self) -> str:
323
+ raise NotImplementedError()
324
+
325
+
326
+ __all__ = ("LlmUtilityServiceTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ from google.api_core import grpc_helpers
23
+ from google.api_core import gapic_v1
24
+ import google.auth # type: ignore
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.auth.transport.grpc import SslCredentials # type: ignore
27
+ from google.protobuf.json_format import MessageToJson
28
+ import google.protobuf.message
29
+
30
+ import grpc # type: ignore
31
+ import proto # type: ignore
32
+
33
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
34
+ from google.cloud.location import locations_pb2 # type: ignore
35
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
36
+ from google.iam.v1 import policy_pb2 # type: ignore
37
+ from google.longrunning import operations_pb2 # type: ignore
38
+ from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO
39
+
40
+ try:
41
+ from google.api_core import client_logging # type: ignore
42
+
43
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
44
+ except ImportError: # pragma: NO COVER
45
+ CLIENT_LOGGING_SUPPORTED = False
46
+
47
+ _LOGGER = std_logging.getLogger(__name__)
48
+
49
+
50
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
51
+ def intercept_unary_unary(self, continuation, client_call_details, request):
52
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
53
+ std_logging.DEBUG
54
+ )
55
+ if logging_enabled: # pragma: NO COVER
56
+ request_metadata = client_call_details.metadata
57
+ if isinstance(request, proto.Message):
58
+ request_payload = type(request).to_json(request)
59
+ elif isinstance(request, google.protobuf.message.Message):
60
+ request_payload = MessageToJson(request)
61
+ else:
62
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
63
+
64
+ request_metadata = {
65
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
66
+ for key, value in request_metadata
67
+ }
68
+ grpc_request = {
69
+ "payload": request_payload,
70
+ "requestMethod": "grpc",
71
+ "metadata": dict(request_metadata),
72
+ }
73
+ _LOGGER.debug(
74
+ f"Sending request for {client_call_details.method}",
75
+ extra={
76
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
77
+ "rpcName": str(client_call_details.method),
78
+ "request": grpc_request,
79
+ "metadata": grpc_request["metadata"],
80
+ },
81
+ )
82
+ response = continuation(client_call_details, request)
83
+ if logging_enabled: # pragma: NO COVER
84
+ response_metadata = response.trailing_metadata()
85
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
86
+ metadata = (
87
+ dict([(k, str(v)) for k, v in response_metadata])
88
+ if response_metadata
89
+ else None
90
+ )
91
+ result = response.result()
92
+ if isinstance(result, proto.Message):
93
+ response_payload = type(result).to_json(result)
94
+ elif isinstance(result, google.protobuf.message.Message):
95
+ response_payload = MessageToJson(result)
96
+ else:
97
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
98
+ grpc_response = {
99
+ "payload": response_payload,
100
+ "metadata": metadata,
101
+ "status": "OK",
102
+ }
103
+ _LOGGER.debug(
104
+ f"Received response for {client_call_details.method}.",
105
+ extra={
106
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
107
+ "rpcName": client_call_details.method,
108
+ "response": grpc_response,
109
+ "metadata": grpc_response["metadata"],
110
+ },
111
+ )
112
+ return response
113
+
114
+
115
+ class LlmUtilityServiceGrpcTransport(LlmUtilityServiceTransport):
116
+ """gRPC backend transport for LlmUtilityService.
117
+
118
+ Service for LLM related utility functions.
119
+
120
+ This class defines the same methods as the primary client, so the
121
+ primary client can load the underlying transport implementation
122
+ and call it.
123
+
124
+ It sends protocol buffers over the wire using gRPC (which is built on
125
+ top of HTTP/2); the ``grpcio`` package must be installed.
126
+ """
127
+
128
+ _stubs: Dict[str, Callable]
129
+
130
+ def __init__(
131
+ self,
132
+ *,
133
+ host: str = "aiplatform.googleapis.com",
134
+ credentials: Optional[ga_credentials.Credentials] = None,
135
+ credentials_file: Optional[str] = None,
136
+ scopes: Optional[Sequence[str]] = None,
137
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
138
+ api_mtls_endpoint: Optional[str] = None,
139
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
140
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
141
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
142
+ quota_project_id: Optional[str] = None,
143
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
144
+ always_use_jwt_access: Optional[bool] = False,
145
+ api_audience: Optional[str] = None,
146
+ ) -> None:
147
+ """Instantiate the transport.
148
+
149
+ Args:
150
+ host (Optional[str]):
151
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
152
+ credentials (Optional[google.auth.credentials.Credentials]): The
153
+ authorization credentials to attach to requests. These
154
+ credentials identify the application to the service; if none
155
+ are specified, the client will attempt to ascertain the
156
+ credentials from the environment.
157
+ This argument is ignored if a ``channel`` instance is provided.
158
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
159
+ be loaded with :func:`google.auth.load_credentials_from_file`.
160
+ This argument is ignored if a ``channel`` instance is provided.
161
+ This argument will be removed in the next major version of this library.
162
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
163
+ ignored if a ``channel`` instance is provided.
164
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
165
+ A ``Channel`` instance through which to make calls, or a Callable
166
+ that constructs and returns one. If set to None, ``self.create_channel``
167
+ is used to create the channel. If a Callable is given, it will be called
168
+ with the same arguments as used in ``self.create_channel``.
169
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
170
+ If provided, it overrides the ``host`` argument and tries to create
171
+ a mutual TLS channel with client SSL credentials from
172
+ ``client_cert_source`` or application default SSL credentials.
173
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
174
+ Deprecated. A callback to provide client SSL certificate bytes and
175
+ private key bytes, both in PEM format. It is ignored if
176
+ ``api_mtls_endpoint`` is None.
177
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
178
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
179
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
180
+ A callback to provide client certificate bytes and private key bytes,
181
+ both in PEM format. It is used to configure a mutual TLS channel. It is
182
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
183
+ quota_project_id (Optional[str]): An optional project to use for billing
184
+ and quota.
185
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
186
+ The client info used to send a user-agent string along with
187
+ API requests. If ``None``, then default info will be used.
188
+ Generally, you only need to set this if you're developing
189
+ your own client library.
190
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
191
+ be used for service account credentials.
192
+
193
+ Raises:
194
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
195
+ creation failed for any reason.
196
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
197
+ and ``credentials_file`` are passed.
198
+ """
199
+ self._grpc_channel = None
200
+ self._ssl_channel_credentials = ssl_channel_credentials
201
+ self._stubs: Dict[str, Callable] = {}
202
+
203
+ if api_mtls_endpoint:
204
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
205
+ if client_cert_source:
206
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
207
+
208
+ if isinstance(channel, grpc.Channel):
209
+ # Ignore credentials if a channel was passed.
210
+ credentials = None
211
+ self._ignore_credentials = True
212
+ # If a channel was explicitly provided, set it.
213
+ self._grpc_channel = channel
214
+ self._ssl_channel_credentials = None
215
+
216
+ else:
217
+ if api_mtls_endpoint:
218
+ host = api_mtls_endpoint
219
+
220
+ # Create SSL credentials with client_cert_source or application
221
+ # default SSL credentials.
222
+ if client_cert_source:
223
+ cert, key = client_cert_source()
224
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
225
+ certificate_chain=cert, private_key=key
226
+ )
227
+ else:
228
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
229
+
230
+ else:
231
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
232
+ cert, key = client_cert_source_for_mtls()
233
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
234
+ certificate_chain=cert, private_key=key
235
+ )
236
+
237
+ # The base transport sets the host, credentials and scopes
238
+ super().__init__(
239
+ host=host,
240
+ credentials=credentials,
241
+ credentials_file=credentials_file,
242
+ scopes=scopes,
243
+ quota_project_id=quota_project_id,
244
+ client_info=client_info,
245
+ always_use_jwt_access=always_use_jwt_access,
246
+ api_audience=api_audience,
247
+ )
248
+
249
+ if not self._grpc_channel:
250
+ # initialize with the provided callable or the default channel
251
+ channel_init = channel or type(self).create_channel
252
+ self._grpc_channel = channel_init(
253
+ self._host,
254
+ # use the credentials which are saved
255
+ credentials=self._credentials,
256
+ # Set ``credentials_file`` to ``None`` here as
257
+ # the credentials that we saved earlier should be used.
258
+ credentials_file=None,
259
+ scopes=self._scopes,
260
+ ssl_credentials=self._ssl_channel_credentials,
261
+ quota_project_id=quota_project_id,
262
+ options=[
263
+ ("grpc.max_send_message_length", -1),
264
+ ("grpc.max_receive_message_length", -1),
265
+ ],
266
+ )
267
+
268
+ self._interceptor = _LoggingClientInterceptor()
269
+ self._logged_channel = grpc.intercept_channel(
270
+ self._grpc_channel, self._interceptor
271
+ )
272
+
273
+ # Wrap messages. This must be done after self._logged_channel exists
274
+ self._prep_wrapped_messages(client_info)
275
+
276
+ @classmethod
277
+ def create_channel(
278
+ cls,
279
+ host: str = "aiplatform.googleapis.com",
280
+ credentials: Optional[ga_credentials.Credentials] = None,
281
+ credentials_file: Optional[str] = None,
282
+ scopes: Optional[Sequence[str]] = None,
283
+ quota_project_id: Optional[str] = None,
284
+ **kwargs,
285
+ ) -> grpc.Channel:
286
+ """Create and return a gRPC channel object.
287
+ Args:
288
+ host (Optional[str]): The host for the channel to use.
289
+ credentials (Optional[~.Credentials]): The
290
+ authorization credentials to attach to requests. These
291
+ credentials identify this application to the service. If
292
+ none are specified, the client will attempt to ascertain
293
+ the credentials from the environment.
294
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
295
+ be loaded with :func:`google.auth.load_credentials_from_file`.
296
+ This argument is mutually exclusive with credentials. This argument will be
297
+ removed in the next major version of this library.
298
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
299
+ service. These are only used when credentials are not specified and
300
+ are passed to :func:`google.auth.default`.
301
+ quota_project_id (Optional[str]): An optional project to use for billing
302
+ and quota.
303
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
304
+ channel creation.
305
+ Returns:
306
+ grpc.Channel: A gRPC channel object.
307
+
308
+ Raises:
309
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
310
+ and ``credentials_file`` are passed.
311
+ """
312
+
313
+ return grpc_helpers.create_channel(
314
+ host,
315
+ credentials=credentials,
316
+ credentials_file=credentials_file,
317
+ quota_project_id=quota_project_id,
318
+ default_scopes=cls.AUTH_SCOPES,
319
+ scopes=scopes,
320
+ default_host=cls.DEFAULT_HOST,
321
+ **kwargs,
322
+ )
323
+
324
+ @property
325
+ def grpc_channel(self) -> grpc.Channel:
326
+ """Return the channel designed to connect to this service."""
327
+ return self._grpc_channel
328
+
329
+ @property
330
+ def compute_tokens(
331
+ self,
332
+ ) -> Callable[
333
+ [llm_utility_service.ComputeTokensRequest],
334
+ llm_utility_service.ComputeTokensResponse,
335
+ ]:
336
+ r"""Return a callable for the compute tokens method over gRPC.
337
+
338
+ Return a list of tokens based on the input text.
339
+
340
+ Returns:
341
+ Callable[[~.ComputeTokensRequest],
342
+ ~.ComputeTokensResponse]:
343
+ A function that, when called, will call the underlying RPC
344
+ on the server.
345
+ """
346
+ # Generate a "stub function" on-the-fly which will actually make
347
+ # the request.
348
+ # gRPC handles serialization and deserialization, so we just need
349
+ # to pass in the functions for each.
350
+ if "compute_tokens" not in self._stubs:
351
+ self._stubs["compute_tokens"] = self._logged_channel.unary_unary(
352
+ "/google.cloud.aiplatform.v1beta1.LlmUtilityService/ComputeTokens",
353
+ request_serializer=llm_utility_service.ComputeTokensRequest.serialize,
354
+ response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize,
355
+ )
356
+ return self._stubs["compute_tokens"]
357
+
358
+ def close(self):
359
+ self._logged_channel.close()
360
+
361
+ @property
362
+ def delete_operation(
363
+ self,
364
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
365
+ r"""Return a callable for the delete_operation method over gRPC."""
366
+ # Generate a "stub function" on-the-fly which will actually make
367
+ # the request.
368
+ # gRPC handles serialization and deserialization, so we just need
369
+ # to pass in the functions for each.
370
+ if "delete_operation" not in self._stubs:
371
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
372
+ "/google.longrunning.Operations/DeleteOperation",
373
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
374
+ response_deserializer=None,
375
+ )
376
+ return self._stubs["delete_operation"]
377
+
378
+ @property
379
+ def cancel_operation(
380
+ self,
381
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
382
+ r"""Return a callable for the cancel_operation method over gRPC."""
383
+ # Generate a "stub function" on-the-fly which will actually make
384
+ # the request.
385
+ # gRPC handles serialization and deserialization, so we just need
386
+ # to pass in the functions for each.
387
+ if "cancel_operation" not in self._stubs:
388
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
389
+ "/google.longrunning.Operations/CancelOperation",
390
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
391
+ response_deserializer=None,
392
+ )
393
+ return self._stubs["cancel_operation"]
394
+
395
+ @property
396
+ def wait_operation(
397
+ self,
398
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
399
+ r"""Return a callable for the wait_operation method over gRPC."""
400
+ # Generate a "stub function" on-the-fly which will actually make
401
+ # the request.
402
+ # gRPC handles serialization and deserialization, so we just need
403
+ # to pass in the functions for each.
404
+ if "wait_operation" not in self._stubs:
405
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
406
+ "/google.longrunning.Operations/WaitOperation",
407
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
408
+ response_deserializer=None,
409
+ )
410
+ return self._stubs["wait_operation"]
411
+
412
+ @property
413
+ def get_operation(
414
+ self,
415
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
416
+ r"""Return a callable for the get_operation method over gRPC."""
417
+ # Generate a "stub function" on-the-fly which will actually make
418
+ # the request.
419
+ # gRPC handles serialization and deserialization, so we just need
420
+ # to pass in the functions for each.
421
+ if "get_operation" not in self._stubs:
422
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
423
+ "/google.longrunning.Operations/GetOperation",
424
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
425
+ response_deserializer=operations_pb2.Operation.FromString,
426
+ )
427
+ return self._stubs["get_operation"]
428
+
429
+ @property
430
+ def list_operations(
431
+ self,
432
+ ) -> Callable[
433
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
434
+ ]:
435
+ r"""Return a callable for the list_operations method over gRPC."""
436
+ # Generate a "stub function" on-the-fly which will actually make
437
+ # the request.
438
+ # gRPC handles serialization and deserialization, so we just need
439
+ # to pass in the functions for each.
440
+ if "list_operations" not in self._stubs:
441
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
442
+ "/google.longrunning.Operations/ListOperations",
443
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
444
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
445
+ )
446
+ return self._stubs["list_operations"]
447
+
448
+ @property
449
+ def list_locations(
450
+ self,
451
+ ) -> Callable[
452
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
453
+ ]:
454
+ r"""Return a callable for the list locations method over gRPC."""
455
+ # Generate a "stub function" on-the-fly which will actually make
456
+ # the request.
457
+ # gRPC handles serialization and deserialization, so we just need
458
+ # to pass in the functions for each.
459
+ if "list_locations" not in self._stubs:
460
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
461
+ "/google.cloud.location.Locations/ListLocations",
462
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
463
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
464
+ )
465
+ return self._stubs["list_locations"]
466
+
467
+ @property
468
+ def get_location(
469
+ self,
470
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
471
+ r"""Return a callable for the list locations method over gRPC."""
472
+ # Generate a "stub function" on-the-fly which will actually make
473
+ # the request.
474
+ # gRPC handles serialization and deserialization, so we just need
475
+ # to pass in the functions for each.
476
+ if "get_location" not in self._stubs:
477
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
478
+ "/google.cloud.location.Locations/GetLocation",
479
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
480
+ response_deserializer=locations_pb2.Location.FromString,
481
+ )
482
+ return self._stubs["get_location"]
483
+
484
+ @property
485
+ def set_iam_policy(
486
+ self,
487
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
488
+ r"""Return a callable for the set iam policy method over gRPC.
489
+ Sets the IAM access control policy on the specified
490
+ function. Replaces any existing policy.
491
+ Returns:
492
+ Callable[[~.SetIamPolicyRequest],
493
+ ~.Policy]:
494
+ A function that, when called, will call the underlying RPC
495
+ on the server.
496
+ """
497
+ # Generate a "stub function" on-the-fly which will actually make
498
+ # the request.
499
+ # gRPC handles serialization and deserialization, so we just need
500
+ # to pass in the functions for each.
501
+ if "set_iam_policy" not in self._stubs:
502
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
503
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
504
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
505
+ response_deserializer=policy_pb2.Policy.FromString,
506
+ )
507
+ return self._stubs["set_iam_policy"]
508
+
509
+ @property
510
+ def get_iam_policy(
511
+ self,
512
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
513
+ r"""Return a callable for the get iam policy method over gRPC.
514
+ Gets the IAM access control policy for a function.
515
+ Returns an empty policy if the function exists and does
516
+ not have a policy set.
517
+ Returns:
518
+ Callable[[~.GetIamPolicyRequest],
519
+ ~.Policy]:
520
+ A function that, when called, will call the underlying RPC
521
+ on the server.
522
+ """
523
+ # Generate a "stub function" on-the-fly which will actually make
524
+ # the request.
525
+ # gRPC handles serialization and deserialization, so we just need
526
+ # to pass in the functions for each.
527
+ if "get_iam_policy" not in self._stubs:
528
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
529
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
530
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
531
+ response_deserializer=policy_pb2.Policy.FromString,
532
+ )
533
+ return self._stubs["get_iam_policy"]
534
+
535
+ @property
536
+ def test_iam_permissions(
537
+ self,
538
+ ) -> Callable[
539
+ [iam_policy_pb2.TestIamPermissionsRequest],
540
+ iam_policy_pb2.TestIamPermissionsResponse,
541
+ ]:
542
+ r"""Return a callable for the test iam permissions method over gRPC.
543
+ Tests the specified permissions against the IAM access control
544
+ policy for a function. If the function does not exist, this will
545
+ return an empty set of permissions, not a NOT_FOUND error.
546
+ Returns:
547
+ Callable[[~.TestIamPermissionsRequest],
548
+ ~.TestIamPermissionsResponse]:
549
+ A function that, when called, will call the underlying RPC
550
+ on the server.
551
+ """
552
+ # Generate a "stub function" on-the-fly which will actually make
553
+ # the request.
554
+ # gRPC handles serialization and deserialization, so we just need
555
+ # to pass in the functions for each.
556
+ if "test_iam_permissions" not in self._stubs:
557
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
558
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
559
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
560
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
561
+ )
562
+ return self._stubs["test_iam_permissions"]
563
+
564
+ @property
565
+ def kind(self) -> str:
566
+ return "grpc"
567
+
568
+
569
+ __all__ = ("LlmUtilityServiceGrpcTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import pickle
19
+ import logging as std_logging
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import grpc_helpers_async
25
+ from google.api_core import exceptions as core_exceptions
26
+ from google.api_core import retry_async as retries
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.auth.transport.grpc import SslCredentials # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+ import google.protobuf.message
31
+
32
+ import grpc # type: ignore
33
+ import proto # type: ignore
34
+ from grpc.experimental import aio # type: ignore
35
+
36
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
37
+ from google.cloud.location import locations_pb2 # type: ignore
38
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
39
+ from google.iam.v1 import policy_pb2 # type: ignore
40
+ from google.longrunning import operations_pb2 # type: ignore
41
+ from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO
42
+ from .grpc import LlmUtilityServiceGrpcTransport
43
+
44
+ try:
45
+ from google.api_core import client_logging # type: ignore
46
+
47
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
48
+ except ImportError: # pragma: NO COVER
49
+ CLIENT_LOGGING_SUPPORTED = False
50
+
51
+ _LOGGER = std_logging.getLogger(__name__)
52
+
53
+
54
+ class _LoggingClientAIOInterceptor(
55
+ grpc.aio.UnaryUnaryClientInterceptor
56
+ ): # pragma: NO COVER
57
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
58
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
59
+ std_logging.DEBUG
60
+ )
61
+ if logging_enabled: # pragma: NO COVER
62
+ request_metadata = client_call_details.metadata
63
+ if isinstance(request, proto.Message):
64
+ request_payload = type(request).to_json(request)
65
+ elif isinstance(request, google.protobuf.message.Message):
66
+ request_payload = MessageToJson(request)
67
+ else:
68
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
69
+
70
+ request_metadata = {
71
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
72
+ for key, value in request_metadata
73
+ }
74
+ grpc_request = {
75
+ "payload": request_payload,
76
+ "requestMethod": "grpc",
77
+ "metadata": dict(request_metadata),
78
+ }
79
+ _LOGGER.debug(
80
+ f"Sending request for {client_call_details.method}",
81
+ extra={
82
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
83
+ "rpcName": str(client_call_details.method),
84
+ "request": grpc_request,
85
+ "metadata": grpc_request["metadata"],
86
+ },
87
+ )
88
+ response = await continuation(client_call_details, request)
89
+ if logging_enabled: # pragma: NO COVER
90
+ response_metadata = await response.trailing_metadata()
91
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
92
+ metadata = (
93
+ dict([(k, str(v)) for k, v in response_metadata])
94
+ if response_metadata
95
+ else None
96
+ )
97
+ result = await response
98
+ if isinstance(result, proto.Message):
99
+ response_payload = type(result).to_json(result)
100
+ elif isinstance(result, google.protobuf.message.Message):
101
+ response_payload = MessageToJson(result)
102
+ else:
103
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
104
+ grpc_response = {
105
+ "payload": response_payload,
106
+ "metadata": metadata,
107
+ "status": "OK",
108
+ }
109
+ _LOGGER.debug(
110
+ f"Received response to rpc {client_call_details.method}.",
111
+ extra={
112
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
113
+ "rpcName": str(client_call_details.method),
114
+ "response": grpc_response,
115
+ "metadata": grpc_response["metadata"],
116
+ },
117
+ )
118
+ return response
119
+
120
+
121
+ class LlmUtilityServiceGrpcAsyncIOTransport(LlmUtilityServiceTransport):
122
+ """gRPC AsyncIO backend transport for LlmUtilityService.
123
+
124
+ Service for LLM related utility functions.
125
+
126
+ This class defines the same methods as the primary client, so the
127
+ primary client can load the underlying transport implementation
128
+ and call it.
129
+
130
+ It sends protocol buffers over the wire using gRPC (which is built on
131
+ top of HTTP/2); the ``grpcio`` package must be installed.
132
+ """
133
+
134
+ _grpc_channel: aio.Channel
135
+ _stubs: Dict[str, Callable] = {}
136
+
137
+ @classmethod
138
+ def create_channel(
139
+ cls,
140
+ host: str = "aiplatform.googleapis.com",
141
+ credentials: Optional[ga_credentials.Credentials] = None,
142
+ credentials_file: Optional[str] = None,
143
+ scopes: Optional[Sequence[str]] = None,
144
+ quota_project_id: Optional[str] = None,
145
+ **kwargs,
146
+ ) -> aio.Channel:
147
+ """Create and return a gRPC AsyncIO channel object.
148
+ Args:
149
+ host (Optional[str]): The host for the channel to use.
150
+ credentials (Optional[~.Credentials]): The
151
+ authorization credentials to attach to requests. These
152
+ credentials identify this application to the service. If
153
+ none are specified, the client will attempt to ascertain
154
+ the credentials from the environment.
155
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
156
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
157
+ removed in the next major version of this library.
158
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
159
+ service. These are only used when credentials are not specified and
160
+ are passed to :func:`google.auth.default`.
161
+ quota_project_id (Optional[str]): An optional project to use for billing
162
+ and quota.
163
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
164
+ channel creation.
165
+ Returns:
166
+ aio.Channel: A gRPC AsyncIO channel object.
167
+ """
168
+
169
+ return grpc_helpers_async.create_channel(
170
+ host,
171
+ credentials=credentials,
172
+ credentials_file=credentials_file,
173
+ quota_project_id=quota_project_id,
174
+ default_scopes=cls.AUTH_SCOPES,
175
+ scopes=scopes,
176
+ default_host=cls.DEFAULT_HOST,
177
+ **kwargs,
178
+ )
179
+
180
+ def __init__(
181
+ self,
182
+ *,
183
+ host: str = "aiplatform.googleapis.com",
184
+ credentials: Optional[ga_credentials.Credentials] = None,
185
+ credentials_file: Optional[str] = None,
186
+ scopes: Optional[Sequence[str]] = None,
187
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
188
+ api_mtls_endpoint: Optional[str] = None,
189
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
190
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
191
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
192
+ quota_project_id: Optional[str] = None,
193
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
194
+ always_use_jwt_access: Optional[bool] = False,
195
+ api_audience: Optional[str] = None,
196
+ ) -> None:
197
+ """Instantiate the transport.
198
+
199
+ Args:
200
+ host (Optional[str]):
201
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
202
+ credentials (Optional[google.auth.credentials.Credentials]): The
203
+ authorization credentials to attach to requests. These
204
+ credentials identify the application to the service; if none
205
+ are specified, the client will attempt to ascertain the
206
+ credentials from the environment.
207
+ This argument is ignored if a ``channel`` instance is provided.
208
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
209
+ be loaded with :func:`google.auth.load_credentials_from_file`.
210
+ This argument is ignored if a ``channel`` instance is provided.
211
+ This argument will be removed in the next major version of this library.
212
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
213
+ service. These are only used when credentials are not specified and
214
+ are passed to :func:`google.auth.default`.
215
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
216
+ A ``Channel`` instance through which to make calls, or a Callable
217
+ that constructs and returns one. If set to None, ``self.create_channel``
218
+ is used to create the channel. If a Callable is given, it will be called
219
+ with the same arguments as used in ``self.create_channel``.
220
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
221
+ If provided, it overrides the ``host`` argument and tries to create
222
+ a mutual TLS channel with client SSL credentials from
223
+ ``client_cert_source`` or application default SSL credentials.
224
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
225
+ Deprecated. A callback to provide client SSL certificate bytes and
226
+ private key bytes, both in PEM format. It is ignored if
227
+ ``api_mtls_endpoint`` is None.
228
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
229
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
230
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
231
+ A callback to provide client certificate bytes and private key bytes,
232
+ both in PEM format. It is used to configure a mutual TLS channel. It is
233
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
234
+ quota_project_id (Optional[str]): An optional project to use for billing
235
+ and quota.
236
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
237
+ The client info used to send a user-agent string along with
238
+ API requests. If ``None``, then default info will be used.
239
+ Generally, you only need to set this if you're developing
240
+ your own client library.
241
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
242
+ be used for service account credentials.
243
+
244
+ Raises:
245
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
246
+ creation failed for any reason.
247
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
248
+ and ``credentials_file`` are passed.
249
+ """
250
+ self._grpc_channel = None
251
+ self._ssl_channel_credentials = ssl_channel_credentials
252
+ self._stubs: Dict[str, Callable] = {}
253
+
254
+ if api_mtls_endpoint:
255
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
256
+ if client_cert_source:
257
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
258
+
259
+ if isinstance(channel, aio.Channel):
260
+ # Ignore credentials if a channel was passed.
261
+ credentials = None
262
+ self._ignore_credentials = True
263
+ # If a channel was explicitly provided, set it.
264
+ self._grpc_channel = channel
265
+ self._ssl_channel_credentials = None
266
+ else:
267
+ if api_mtls_endpoint:
268
+ host = api_mtls_endpoint
269
+
270
+ # Create SSL credentials with client_cert_source or application
271
+ # default SSL credentials.
272
+ if client_cert_source:
273
+ cert, key = client_cert_source()
274
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
275
+ certificate_chain=cert, private_key=key
276
+ )
277
+ else:
278
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
279
+
280
+ else:
281
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
282
+ cert, key = client_cert_source_for_mtls()
283
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
284
+ certificate_chain=cert, private_key=key
285
+ )
286
+
287
+ # The base transport sets the host, credentials and scopes
288
+ super().__init__(
289
+ host=host,
290
+ credentials=credentials,
291
+ credentials_file=credentials_file,
292
+ scopes=scopes,
293
+ quota_project_id=quota_project_id,
294
+ client_info=client_info,
295
+ always_use_jwt_access=always_use_jwt_access,
296
+ api_audience=api_audience,
297
+ )
298
+
299
+ if not self._grpc_channel:
300
+ # initialize with the provided callable or the default channel
301
+ channel_init = channel or type(self).create_channel
302
+ self._grpc_channel = channel_init(
303
+ self._host,
304
+ # use the credentials which are saved
305
+ credentials=self._credentials,
306
+ # Set ``credentials_file`` to ``None`` here as
307
+ # the credentials that we saved earlier should be used.
308
+ credentials_file=None,
309
+ scopes=self._scopes,
310
+ ssl_credentials=self._ssl_channel_credentials,
311
+ quota_project_id=quota_project_id,
312
+ options=[
313
+ ("grpc.max_send_message_length", -1),
314
+ ("grpc.max_receive_message_length", -1),
315
+ ],
316
+ )
317
+
318
+ self._interceptor = _LoggingClientAIOInterceptor()
319
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
320
+ self._logged_channel = self._grpc_channel
321
+ self._wrap_with_kind = (
322
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
323
+ )
324
+ # Wrap messages. This must be done after self._logged_channel exists
325
+ self._prep_wrapped_messages(client_info)
326
+
327
+ @property
328
+ def grpc_channel(self) -> aio.Channel:
329
+ """Create the channel designed to connect to this service.
330
+
331
+ This property caches on the instance; repeated calls return
332
+ the same channel.
333
+ """
334
+ # Return the channel from cache.
335
+ return self._grpc_channel
336
+
337
+ @property
338
+ def compute_tokens(
339
+ self,
340
+ ) -> Callable[
341
+ [llm_utility_service.ComputeTokensRequest],
342
+ Awaitable[llm_utility_service.ComputeTokensResponse],
343
+ ]:
344
+ r"""Return a callable for the compute tokens method over gRPC.
345
+
346
+ Return a list of tokens based on the input text.
347
+
348
+ Returns:
349
+ Callable[[~.ComputeTokensRequest],
350
+ Awaitable[~.ComputeTokensResponse]]:
351
+ A function that, when called, will call the underlying RPC
352
+ on the server.
353
+ """
354
+ # Generate a "stub function" on-the-fly which will actually make
355
+ # the request.
356
+ # gRPC handles serialization and deserialization, so we just need
357
+ # to pass in the functions for each.
358
+ if "compute_tokens" not in self._stubs:
359
+ self._stubs["compute_tokens"] = self._logged_channel.unary_unary(
360
+ "/google.cloud.aiplatform.v1beta1.LlmUtilityService/ComputeTokens",
361
+ request_serializer=llm_utility_service.ComputeTokensRequest.serialize,
362
+ response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize,
363
+ )
364
+ return self._stubs["compute_tokens"]
365
+
366
+ def _prep_wrapped_messages(self, client_info):
367
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
368
+ self._wrapped_methods = {
369
+ self.compute_tokens: self._wrap_method(
370
+ self.compute_tokens,
371
+ default_timeout=None,
372
+ client_info=client_info,
373
+ ),
374
+ self.get_location: self._wrap_method(
375
+ self.get_location,
376
+ default_timeout=None,
377
+ client_info=client_info,
378
+ ),
379
+ self.list_locations: self._wrap_method(
380
+ self.list_locations,
381
+ default_timeout=None,
382
+ client_info=client_info,
383
+ ),
384
+ self.get_iam_policy: self._wrap_method(
385
+ self.get_iam_policy,
386
+ default_timeout=None,
387
+ client_info=client_info,
388
+ ),
389
+ self.set_iam_policy: self._wrap_method(
390
+ self.set_iam_policy,
391
+ default_timeout=None,
392
+ client_info=client_info,
393
+ ),
394
+ self.test_iam_permissions: self._wrap_method(
395
+ self.test_iam_permissions,
396
+ default_timeout=None,
397
+ client_info=client_info,
398
+ ),
399
+ self.cancel_operation: self._wrap_method(
400
+ self.cancel_operation,
401
+ default_timeout=None,
402
+ client_info=client_info,
403
+ ),
404
+ self.delete_operation: self._wrap_method(
405
+ self.delete_operation,
406
+ default_timeout=None,
407
+ client_info=client_info,
408
+ ),
409
+ self.get_operation: self._wrap_method(
410
+ self.get_operation,
411
+ default_timeout=None,
412
+ client_info=client_info,
413
+ ),
414
+ self.list_operations: self._wrap_method(
415
+ self.list_operations,
416
+ default_timeout=None,
417
+ client_info=client_info,
418
+ ),
419
+ self.wait_operation: self._wrap_method(
420
+ self.wait_operation,
421
+ default_timeout=None,
422
+ client_info=client_info,
423
+ ),
424
+ }
425
+
426
+ def _wrap_method(self, func, *args, **kwargs):
427
+ if self._wrap_with_kind: # pragma: NO COVER
428
+ kwargs["kind"] = self.kind
429
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
430
+
431
+ def close(self):
432
+ return self._logged_channel.close()
433
+
434
+ @property
435
+ def kind(self) -> str:
436
+ return "grpc_asyncio"
437
+
438
+ @property
439
+ def delete_operation(
440
+ self,
441
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
442
+ r"""Return a callable for the delete_operation method over gRPC."""
443
+ # Generate a "stub function" on-the-fly which will actually make
444
+ # the request.
445
+ # gRPC handles serialization and deserialization, so we just need
446
+ # to pass in the functions for each.
447
+ if "delete_operation" not in self._stubs:
448
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
449
+ "/google.longrunning.Operations/DeleteOperation",
450
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
451
+ response_deserializer=None,
452
+ )
453
+ return self._stubs["delete_operation"]
454
+
455
+ @property
456
+ def cancel_operation(
457
+ self,
458
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
459
+ r"""Return a callable for the cancel_operation method over gRPC."""
460
+ # Generate a "stub function" on-the-fly which will actually make
461
+ # the request.
462
+ # gRPC handles serialization and deserialization, so we just need
463
+ # to pass in the functions for each.
464
+ if "cancel_operation" not in self._stubs:
465
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
466
+ "/google.longrunning.Operations/CancelOperation",
467
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
468
+ response_deserializer=None,
469
+ )
470
+ return self._stubs["cancel_operation"]
471
+
472
+ @property
473
+ def wait_operation(
474
+ self,
475
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
476
+ r"""Return a callable for the wait_operation method over gRPC."""
477
+ # Generate a "stub function" on-the-fly which will actually make
478
+ # the request.
479
+ # gRPC handles serialization and deserialization, so we just need
480
+ # to pass in the functions for each.
481
+ if "wait_operation" not in self._stubs:
482
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
483
+ "/google.longrunning.Operations/WaitOperation",
484
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
485
+ response_deserializer=None,
486
+ )
487
+ return self._stubs["wait_operation"]
488
+
489
+ @property
490
+ def get_operation(
491
+ self,
492
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
493
+ r"""Return a callable for the get_operation method over gRPC."""
494
+ # Generate a "stub function" on-the-fly which will actually make
495
+ # the request.
496
+ # gRPC handles serialization and deserialization, so we just need
497
+ # to pass in the functions for each.
498
+ if "get_operation" not in self._stubs:
499
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
500
+ "/google.longrunning.Operations/GetOperation",
501
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
502
+ response_deserializer=operations_pb2.Operation.FromString,
503
+ )
504
+ return self._stubs["get_operation"]
505
+
506
+ @property
507
+ def list_operations(
508
+ self,
509
+ ) -> Callable[
510
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
511
+ ]:
512
+ r"""Return a callable for the list_operations method over gRPC."""
513
+ # Generate a "stub function" on-the-fly which will actually make
514
+ # the request.
515
+ # gRPC handles serialization and deserialization, so we just need
516
+ # to pass in the functions for each.
517
+ if "list_operations" not in self._stubs:
518
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
519
+ "/google.longrunning.Operations/ListOperations",
520
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
521
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
522
+ )
523
+ return self._stubs["list_operations"]
524
+
525
+ @property
526
+ def list_locations(
527
+ self,
528
+ ) -> Callable[
529
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
530
+ ]:
531
+ r"""Return a callable for the list locations method over gRPC."""
532
+ # Generate a "stub function" on-the-fly which will actually make
533
+ # the request.
534
+ # gRPC handles serialization and deserialization, so we just need
535
+ # to pass in the functions for each.
536
+ if "list_locations" not in self._stubs:
537
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
538
+ "/google.cloud.location.Locations/ListLocations",
539
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
540
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
541
+ )
542
+ return self._stubs["list_locations"]
543
+
544
+ @property
545
+ def get_location(
546
+ self,
547
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
548
+ r"""Return a callable for the list locations method over gRPC."""
549
+ # Generate a "stub function" on-the-fly which will actually make
550
+ # the request.
551
+ # gRPC handles serialization and deserialization, so we just need
552
+ # to pass in the functions for each.
553
+ if "get_location" not in self._stubs:
554
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
555
+ "/google.cloud.location.Locations/GetLocation",
556
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
557
+ response_deserializer=locations_pb2.Location.FromString,
558
+ )
559
+ return self._stubs["get_location"]
560
+
561
+ @property
562
+ def set_iam_policy(
563
+ self,
564
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
565
+ r"""Return a callable for the set iam policy method over gRPC.
566
+ Sets the IAM access control policy on the specified
567
+ function. Replaces any existing policy.
568
+ Returns:
569
+ Callable[[~.SetIamPolicyRequest],
570
+ ~.Policy]:
571
+ A function that, when called, will call the underlying RPC
572
+ on the server.
573
+ """
574
+ # Generate a "stub function" on-the-fly which will actually make
575
+ # the request.
576
+ # gRPC handles serialization and deserialization, so we just need
577
+ # to pass in the functions for each.
578
+ if "set_iam_policy" not in self._stubs:
579
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
580
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
581
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
582
+ response_deserializer=policy_pb2.Policy.FromString,
583
+ )
584
+ return self._stubs["set_iam_policy"]
585
+
586
+ @property
587
+ def get_iam_policy(
588
+ self,
589
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
590
+ r"""Return a callable for the get iam policy method over gRPC.
591
+ Gets the IAM access control policy for a function.
592
+ Returns an empty policy if the function exists and does
593
+ not have a policy set.
594
+ Returns:
595
+ Callable[[~.GetIamPolicyRequest],
596
+ ~.Policy]:
597
+ A function that, when called, will call the underlying RPC
598
+ on the server.
599
+ """
600
+ # Generate a "stub function" on-the-fly which will actually make
601
+ # the request.
602
+ # gRPC handles serialization and deserialization, so we just need
603
+ # to pass in the functions for each.
604
+ if "get_iam_policy" not in self._stubs:
605
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
606
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
607
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
608
+ response_deserializer=policy_pb2.Policy.FromString,
609
+ )
610
+ return self._stubs["get_iam_policy"]
611
+
612
+ @property
613
+ def test_iam_permissions(
614
+ self,
615
+ ) -> Callable[
616
+ [iam_policy_pb2.TestIamPermissionsRequest],
617
+ iam_policy_pb2.TestIamPermissionsResponse,
618
+ ]:
619
+ r"""Return a callable for the test iam permissions method over gRPC.
620
+ Tests the specified permissions against the IAM access control
621
+ policy for a function. If the function does not exist, this will
622
+ return an empty set of permissions, not a NOT_FOUND error.
623
+ Returns:
624
+ Callable[[~.TestIamPermissionsRequest],
625
+ ~.TestIamPermissionsResponse]:
626
+ A function that, when called, will call the underlying RPC
627
+ on the server.
628
+ """
629
+ # Generate a "stub function" on-the-fly which will actually make
630
+ # the request.
631
+ # gRPC handles serialization and deserialization, so we just need
632
+ # to pass in the functions for each.
633
+ if "test_iam_permissions" not in self._stubs:
634
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
635
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
636
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
637
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
638
+ )
639
+ return self._stubs["test_iam_permissions"]
640
+
641
+
642
+ __all__ = ("LlmUtilityServiceGrpcAsyncIOTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py ADDED
@@ -0,0 +1,2042 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging
17
+ import json # type: ignore
18
+
19
+ from google.auth.transport.requests import AuthorizedSession # type: ignore
20
+ from google.auth import credentials as ga_credentials # type: ignore
21
+ from google.api_core import exceptions as core_exceptions
22
+ from google.api_core import retry as retries
23
+ from google.api_core import rest_helpers
24
+ from google.api_core import rest_streaming
25
+ from google.api_core import gapic_v1
26
+ import google.protobuf
27
+
28
+ from google.protobuf import json_format
29
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
30
+ from google.iam.v1 import policy_pb2 # type: ignore
31
+ from google.cloud.location import locations_pb2 # type: ignore
32
+
33
+ from requests import __version__ as requests_version
34
+ import dataclasses
35
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
36
+ import warnings
37
+
38
+
39
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
40
+ from google.longrunning import operations_pb2 # type: ignore
41
+
42
+
43
+ from .rest_base import _BaseLlmUtilityServiceRestTransport
44
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
45
+
46
+ try:
47
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
48
+ except AttributeError: # pragma: NO COVER
49
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
50
+
51
+ try:
52
+ from google.api_core import client_logging # type: ignore
53
+
54
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
55
+ except ImportError: # pragma: NO COVER
56
+ CLIENT_LOGGING_SUPPORTED = False
57
+
58
+ _LOGGER = logging.getLogger(__name__)
59
+
60
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
61
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
62
+ grpc_version=None,
63
+ rest_version=f"requests@{requests_version}",
64
+ )
65
+
66
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
67
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
68
+
69
+
70
+ class LlmUtilityServiceRestInterceptor:
71
+ """Interceptor for LlmUtilityService.
72
+
73
+ Interceptors are used to manipulate requests, request metadata, and responses
74
+ in arbitrary ways.
75
+ Example use cases include:
76
+ * Logging
77
+ * Verifying requests according to service or custom semantics
78
+ * Stripping extraneous information from responses
79
+
80
+ These use cases and more can be enabled by injecting an
81
+ instance of a custom subclass when constructing the LlmUtilityServiceRestTransport.
82
+
83
+ .. code-block:: python
84
+ class MyCustomLlmUtilityServiceInterceptor(LlmUtilityServiceRestInterceptor):
85
+ def pre_compute_tokens(self, request, metadata):
86
+ logging.log(f"Received request: {request}")
87
+ return request, metadata
88
+
89
+ def post_compute_tokens(self, response):
90
+ logging.log(f"Received response: {response}")
91
+ return response
92
+
93
+ transport = LlmUtilityServiceRestTransport(interceptor=MyCustomLlmUtilityServiceInterceptor())
94
+ client = LlmUtilityServiceClient(transport=transport)
95
+
96
+
97
+ """
98
+
99
+ def pre_compute_tokens(
100
+ self,
101
+ request: llm_utility_service.ComputeTokensRequest,
102
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
103
+ ) -> Tuple[
104
+ llm_utility_service.ComputeTokensRequest,
105
+ Sequence[Tuple[str, Union[str, bytes]]],
106
+ ]:
107
+ """Pre-rpc interceptor for compute_tokens
108
+
109
+ Override in a subclass to manipulate the request or metadata
110
+ before they are sent to the LlmUtilityService server.
111
+ """
112
+ return request, metadata
113
+
114
+ def post_compute_tokens(
115
+ self, response: llm_utility_service.ComputeTokensResponse
116
+ ) -> llm_utility_service.ComputeTokensResponse:
117
+ """Post-rpc interceptor for compute_tokens
118
+
119
+ DEPRECATED. Please use the `post_compute_tokens_with_metadata`
120
+ interceptor instead.
121
+
122
+ Override in a subclass to read or manipulate the response
123
+ after it is returned by the LlmUtilityService server but before
124
+ it is returned to user code. This `post_compute_tokens` interceptor runs
125
+ before the `post_compute_tokens_with_metadata` interceptor.
126
+ """
127
+ return response
128
+
129
+ def post_compute_tokens_with_metadata(
130
+ self,
131
+ response: llm_utility_service.ComputeTokensResponse,
132
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
133
+ ) -> Tuple[
134
+ llm_utility_service.ComputeTokensResponse,
135
+ Sequence[Tuple[str, Union[str, bytes]]],
136
+ ]:
137
+ """Post-rpc interceptor for compute_tokens
138
+
139
+ Override in a subclass to read or manipulate the response or metadata after it
140
+ is returned by the LlmUtilityService server but before it is returned to user code.
141
+
142
+ We recommend only using this `post_compute_tokens_with_metadata`
143
+ interceptor in new development instead of the `post_compute_tokens` interceptor.
144
+ When both interceptors are used, this `post_compute_tokens_with_metadata` interceptor runs after the
145
+ `post_compute_tokens` interceptor. The (possibly modified) response returned by
146
+ `post_compute_tokens` will be passed to
147
+ `post_compute_tokens_with_metadata`.
148
+ """
149
+ return response, metadata
150
+
151
+ def pre_get_location(
152
+ self,
153
+ request: locations_pb2.GetLocationRequest,
154
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
155
+ ) -> Tuple[
156
+ locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]]
157
+ ]:
158
+ """Pre-rpc interceptor for get_location
159
+
160
+ Override in a subclass to manipulate the request or metadata
161
+ before they are sent to the LlmUtilityService server.
162
+ """
163
+ return request, metadata
164
+
165
+ def post_get_location(
166
+ self, response: locations_pb2.Location
167
+ ) -> locations_pb2.Location:
168
+ """Post-rpc interceptor for get_location
169
+
170
+ Override in a subclass to manipulate the response
171
+ after it is returned by the LlmUtilityService server but before
172
+ it is returned to user code.
173
+ """
174
+ return response
175
+
176
+ def pre_list_locations(
177
+ self,
178
+ request: locations_pb2.ListLocationsRequest,
179
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
180
+ ) -> Tuple[
181
+ locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
182
+ ]:
183
+ """Pre-rpc interceptor for list_locations
184
+
185
+ Override in a subclass to manipulate the request or metadata
186
+ before they are sent to the LlmUtilityService server.
187
+ """
188
+ return request, metadata
189
+
190
+ def post_list_locations(
191
+ self, response: locations_pb2.ListLocationsResponse
192
+ ) -> locations_pb2.ListLocationsResponse:
193
+ """Post-rpc interceptor for list_locations
194
+
195
+ Override in a subclass to manipulate the response
196
+ after it is returned by the LlmUtilityService server but before
197
+ it is returned to user code.
198
+ """
199
+ return response
200
+
201
+ def pre_get_iam_policy(
202
+ self,
203
+ request: iam_policy_pb2.GetIamPolicyRequest,
204
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
205
+ ) -> Tuple[
206
+ iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
207
+ ]:
208
+ """Pre-rpc interceptor for get_iam_policy
209
+
210
+ Override in a subclass to manipulate the request or metadata
211
+ before they are sent to the LlmUtilityService server.
212
+ """
213
+ return request, metadata
214
+
215
+ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
216
+ """Post-rpc interceptor for get_iam_policy
217
+
218
+ Override in a subclass to manipulate the response
219
+ after it is returned by the LlmUtilityService server but before
220
+ it is returned to user code.
221
+ """
222
+ return response
223
+
224
+ def pre_set_iam_policy(
225
+ self,
226
+ request: iam_policy_pb2.SetIamPolicyRequest,
227
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
228
+ ) -> Tuple[
229
+ iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
230
+ ]:
231
+ """Pre-rpc interceptor for set_iam_policy
232
+
233
+ Override in a subclass to manipulate the request or metadata
234
+ before they are sent to the LlmUtilityService server.
235
+ """
236
+ return request, metadata
237
+
238
+ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
239
+ """Post-rpc interceptor for set_iam_policy
240
+
241
+ Override in a subclass to manipulate the response
242
+ after it is returned by the LlmUtilityService server but before
243
+ it is returned to user code.
244
+ """
245
+ return response
246
+
247
+ def pre_test_iam_permissions(
248
+ self,
249
+ request: iam_policy_pb2.TestIamPermissionsRequest,
250
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
251
+ ) -> Tuple[
252
+ iam_policy_pb2.TestIamPermissionsRequest,
253
+ Sequence[Tuple[str, Union[str, bytes]]],
254
+ ]:
255
+ """Pre-rpc interceptor for test_iam_permissions
256
+
257
+ Override in a subclass to manipulate the request or metadata
258
+ before they are sent to the LlmUtilityService server.
259
+ """
260
+ return request, metadata
261
+
262
+ def post_test_iam_permissions(
263
+ self, response: iam_policy_pb2.TestIamPermissionsResponse
264
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
265
+ """Post-rpc interceptor for test_iam_permissions
266
+
267
+ Override in a subclass to manipulate the response
268
+ after it is returned by the LlmUtilityService server but before
269
+ it is returned to user code.
270
+ """
271
+ return response
272
+
273
+ def pre_cancel_operation(
274
+ self,
275
+ request: operations_pb2.CancelOperationRequest,
276
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
277
+ ) -> Tuple[
278
+ operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
279
+ ]:
280
+ """Pre-rpc interceptor for cancel_operation
281
+
282
+ Override in a subclass to manipulate the request or metadata
283
+ before they are sent to the LlmUtilityService server.
284
+ """
285
+ return request, metadata
286
+
287
+ def post_cancel_operation(self, response: None) -> None:
288
+ """Post-rpc interceptor for cancel_operation
289
+
290
+ Override in a subclass to manipulate the response
291
+ after it is returned by the LlmUtilityService server but before
292
+ it is returned to user code.
293
+ """
294
+ return response
295
+
296
+ def pre_delete_operation(
297
+ self,
298
+ request: operations_pb2.DeleteOperationRequest,
299
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
300
+ ) -> Tuple[
301
+ operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
302
+ ]:
303
+ """Pre-rpc interceptor for delete_operation
304
+
305
+ Override in a subclass to manipulate the request or metadata
306
+ before they are sent to the LlmUtilityService server.
307
+ """
308
+ return request, metadata
309
+
310
+ def post_delete_operation(self, response: None) -> None:
311
+ """Post-rpc interceptor for delete_operation
312
+
313
+ Override in a subclass to manipulate the response
314
+ after it is returned by the LlmUtilityService server but before
315
+ it is returned to user code.
316
+ """
317
+ return response
318
+
319
+ def pre_get_operation(
320
+ self,
321
+ request: operations_pb2.GetOperationRequest,
322
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
323
+ ) -> Tuple[
324
+ operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
325
+ ]:
326
+ """Pre-rpc interceptor for get_operation
327
+
328
+ Override in a subclass to manipulate the request or metadata
329
+ before they are sent to the LlmUtilityService server.
330
+ """
331
+ return request, metadata
332
+
333
+ def post_get_operation(
334
+ self, response: operations_pb2.Operation
335
+ ) -> operations_pb2.Operation:
336
+ """Post-rpc interceptor for get_operation
337
+
338
+ Override in a subclass to manipulate the response
339
+ after it is returned by the LlmUtilityService server but before
340
+ it is returned to user code.
341
+ """
342
+ return response
343
+
344
+ def pre_list_operations(
345
+ self,
346
+ request: operations_pb2.ListOperationsRequest,
347
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
348
+ ) -> Tuple[
349
+ operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
350
+ ]:
351
+ """Pre-rpc interceptor for list_operations
352
+
353
+ Override in a subclass to manipulate the request or metadata
354
+ before they are sent to the LlmUtilityService server.
355
+ """
356
+ return request, metadata
357
+
358
+ def post_list_operations(
359
+ self, response: operations_pb2.ListOperationsResponse
360
+ ) -> operations_pb2.ListOperationsResponse:
361
+ """Post-rpc interceptor for list_operations
362
+
363
+ Override in a subclass to manipulate the response
364
+ after it is returned by the LlmUtilityService server but before
365
+ it is returned to user code.
366
+ """
367
+ return response
368
+
369
+ def pre_wait_operation(
370
+ self,
371
+ request: operations_pb2.WaitOperationRequest,
372
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
373
+ ) -> Tuple[
374
+ operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
375
+ ]:
376
+ """Pre-rpc interceptor for wait_operation
377
+
378
+ Override in a subclass to manipulate the request or metadata
379
+ before they are sent to the LlmUtilityService server.
380
+ """
381
+ return request, metadata
382
+
383
+ def post_wait_operation(
384
+ self, response: operations_pb2.Operation
385
+ ) -> operations_pb2.Operation:
386
+ """Post-rpc interceptor for wait_operation
387
+
388
+ Override in a subclass to manipulate the response
389
+ after it is returned by the LlmUtilityService server but before
390
+ it is returned to user code.
391
+ """
392
+ return response
393
+
394
+
395
+ @dataclasses.dataclass
396
+ class LlmUtilityServiceRestStub:
397
+ _session: AuthorizedSession
398
+ _host: str
399
+ _interceptor: LlmUtilityServiceRestInterceptor
400
+
401
+
402
+ class LlmUtilityServiceRestTransport(_BaseLlmUtilityServiceRestTransport):
403
+ """REST backend synchronous transport for LlmUtilityService.
404
+
405
+ Service for LLM related utility functions.
406
+
407
+ This class defines the same methods as the primary client, so the
408
+ primary client can load the underlying transport implementation
409
+ and call it.
410
+
411
+ It sends JSON representations of protocol buffers over HTTP/1.1
412
+ """
413
+
414
+ def __init__(
415
+ self,
416
+ *,
417
+ host: str = "aiplatform.googleapis.com",
418
+ credentials: Optional[ga_credentials.Credentials] = None,
419
+ credentials_file: Optional[str] = None,
420
+ scopes: Optional[Sequence[str]] = None,
421
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
422
+ quota_project_id: Optional[str] = None,
423
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
424
+ always_use_jwt_access: Optional[bool] = False,
425
+ url_scheme: str = "https",
426
+ interceptor: Optional[LlmUtilityServiceRestInterceptor] = None,
427
+ api_audience: Optional[str] = None,
428
+ ) -> None:
429
+ """Instantiate the transport.
430
+
431
+ Args:
432
+ host (Optional[str]):
433
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
434
+ credentials (Optional[google.auth.credentials.Credentials]): The
435
+ authorization credentials to attach to requests. These
436
+ credentials identify the application to the service; if none
437
+ are specified, the client will attempt to ascertain the
438
+ credentials from the environment.
439
+
440
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
441
+ be loaded with :func:`google.auth.load_credentials_from_file`.
442
+ This argument is ignored if ``channel`` is provided. This argument will be
443
+ removed in the next major version of this library.
444
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
445
+ ignored if ``channel`` is provided.
446
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
447
+ certificate to configure mutual TLS HTTP channel. It is ignored
448
+ if ``channel`` is provided.
449
+ quota_project_id (Optional[str]): An optional project to use for billing
450
+ and quota.
451
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
452
+ The client info used to send a user-agent string along with
453
+ API requests. If ``None``, then default info will be used.
454
+ Generally, you only need to set this if you are developing
455
+ your own client library.
456
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
457
+ be used for service account credentials.
458
+ url_scheme: the protocol scheme for the API endpoint. Normally
459
+ "https", but for testing or local servers,
460
+ "http" can be specified.
461
+ """
462
+ # Run the base constructor
463
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
464
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
465
+ # credentials object
466
+ super().__init__(
467
+ host=host,
468
+ credentials=credentials,
469
+ client_info=client_info,
470
+ always_use_jwt_access=always_use_jwt_access,
471
+ url_scheme=url_scheme,
472
+ api_audience=api_audience,
473
+ )
474
+ self._session = AuthorizedSession(
475
+ self._credentials, default_host=self.DEFAULT_HOST
476
+ )
477
+ if client_cert_source_for_mtls:
478
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
479
+ self._interceptor = interceptor or LlmUtilityServiceRestInterceptor()
480
+ self._prep_wrapped_messages(client_info)
481
+
482
+ class _ComputeTokens(
483
+ _BaseLlmUtilityServiceRestTransport._BaseComputeTokens,
484
+ LlmUtilityServiceRestStub,
485
+ ):
486
+ def __hash__(self):
487
+ return hash("LlmUtilityServiceRestTransport.ComputeTokens")
488
+
489
+ @staticmethod
490
+ def _get_response(
491
+ host,
492
+ metadata,
493
+ query_params,
494
+ session,
495
+ timeout,
496
+ transcoded_request,
497
+ body=None,
498
+ ):
499
+
500
+ uri = transcoded_request["uri"]
501
+ method = transcoded_request["method"]
502
+ headers = dict(metadata)
503
+ headers["Content-Type"] = "application/json"
504
+ response = getattr(session, method)(
505
+ "{host}{uri}".format(host=host, uri=uri),
506
+ timeout=timeout,
507
+ headers=headers,
508
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
509
+ data=body,
510
+ )
511
+ return response
512
+
513
+ def __call__(
514
+ self,
515
+ request: llm_utility_service.ComputeTokensRequest,
516
+ *,
517
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
518
+ timeout: Optional[float] = None,
519
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
520
+ ) -> llm_utility_service.ComputeTokensResponse:
521
+ r"""Call the compute tokens method over HTTP.
522
+
523
+ Args:
524
+ request (~.llm_utility_service.ComputeTokensRequest):
525
+ The request object. Request message for ComputeTokens RPC
526
+ call.
527
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
528
+ should be retried.
529
+ timeout (float): The timeout for this request.
530
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
531
+ sent along with the request as metadata. Normally, each value must be of type `str`,
532
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
533
+ be of type `bytes`.
534
+
535
+ Returns:
536
+ ~.llm_utility_service.ComputeTokensResponse:
537
+ Response message for ComputeTokens
538
+ RPC call.
539
+
540
+ """
541
+
542
+ http_options = (
543
+ _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options()
544
+ )
545
+
546
+ request, metadata = self._interceptor.pre_compute_tokens(request, metadata)
547
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_transcoded_request(
548
+ http_options, request
549
+ )
550
+
551
+ body = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_request_body_json(
552
+ transcoded_request
553
+ )
554
+
555
+ # Jsonify the query params
556
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_query_params_json(
557
+ transcoded_request
558
+ )
559
+
560
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
561
+ logging.DEBUG
562
+ ): # pragma: NO COVER
563
+ request_url = "{host}{uri}".format(
564
+ host=self._host, uri=transcoded_request["uri"]
565
+ )
566
+ method = transcoded_request["method"]
567
+ try:
568
+ request_payload = type(request).to_json(request)
569
+ except:
570
+ request_payload = None
571
+ http_request = {
572
+ "payload": request_payload,
573
+ "requestMethod": method,
574
+ "requestUrl": request_url,
575
+ "headers": dict(metadata),
576
+ }
577
+ _LOGGER.debug(
578
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ComputeTokens",
579
+ extra={
580
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
581
+ "rpcName": "ComputeTokens",
582
+ "httpRequest": http_request,
583
+ "metadata": http_request["headers"],
584
+ },
585
+ )
586
+
587
+ # Send the request
588
+ response = LlmUtilityServiceRestTransport._ComputeTokens._get_response(
589
+ self._host,
590
+ metadata,
591
+ query_params,
592
+ self._session,
593
+ timeout,
594
+ transcoded_request,
595
+ body,
596
+ )
597
+
598
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
599
+ # subclass.
600
+ if response.status_code >= 400:
601
+ raise core_exceptions.from_http_response(response)
602
+
603
+ # Return the response
604
+ resp = llm_utility_service.ComputeTokensResponse()
605
+ pb_resp = llm_utility_service.ComputeTokensResponse.pb(resp)
606
+
607
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
608
+
609
+ resp = self._interceptor.post_compute_tokens(resp)
610
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
611
+ resp, _ = self._interceptor.post_compute_tokens_with_metadata(
612
+ resp, response_metadata
613
+ )
614
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
615
+ logging.DEBUG
616
+ ): # pragma: NO COVER
617
+ try:
618
+ response_payload = (
619
+ llm_utility_service.ComputeTokensResponse.to_json(response)
620
+ )
621
+ except:
622
+ response_payload = None
623
+ http_response = {
624
+ "payload": response_payload,
625
+ "headers": dict(response.headers),
626
+ "status": response.status_code,
627
+ }
628
+ _LOGGER.debug(
629
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.compute_tokens",
630
+ extra={
631
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
632
+ "rpcName": "ComputeTokens",
633
+ "metadata": http_response["headers"],
634
+ "httpResponse": http_response,
635
+ },
636
+ )
637
+ return resp
638
+
639
+ @property
640
+ def compute_tokens(
641
+ self,
642
+ ) -> Callable[
643
+ [llm_utility_service.ComputeTokensRequest],
644
+ llm_utility_service.ComputeTokensResponse,
645
+ ]:
646
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
647
+ # In C++ this would require a dynamic_cast
648
+ return self._ComputeTokens(self._session, self._host, self._interceptor) # type: ignore
649
+
650
+ @property
651
+ def get_location(self):
652
+ return self._GetLocation(self._session, self._host, self._interceptor) # type: ignore
653
+
654
+ class _GetLocation(
655
+ _BaseLlmUtilityServiceRestTransport._BaseGetLocation, LlmUtilityServiceRestStub
656
+ ):
657
+ def __hash__(self):
658
+ return hash("LlmUtilityServiceRestTransport.GetLocation")
659
+
660
+ @staticmethod
661
+ def _get_response(
662
+ host,
663
+ metadata,
664
+ query_params,
665
+ session,
666
+ timeout,
667
+ transcoded_request,
668
+ body=None,
669
+ ):
670
+
671
+ uri = transcoded_request["uri"]
672
+ method = transcoded_request["method"]
673
+ headers = dict(metadata)
674
+ headers["Content-Type"] = "application/json"
675
+ response = getattr(session, method)(
676
+ "{host}{uri}".format(host=host, uri=uri),
677
+ timeout=timeout,
678
+ headers=headers,
679
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
680
+ )
681
+ return response
682
+
683
+ def __call__(
684
+ self,
685
+ request: locations_pb2.GetLocationRequest,
686
+ *,
687
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
688
+ timeout: Optional[float] = None,
689
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
690
+ ) -> locations_pb2.Location:
691
+ r"""Call the get location method over HTTP.
692
+
693
+ Args:
694
+ request (locations_pb2.GetLocationRequest):
695
+ The request object for GetLocation method.
696
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
697
+ should be retried.
698
+ timeout (float): The timeout for this request.
699
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
700
+ sent along with the request as metadata. Normally, each value must be of type `str`,
701
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
702
+ be of type `bytes`.
703
+
704
+ Returns:
705
+ locations_pb2.Location: Response from GetLocation method.
706
+ """
707
+
708
+ http_options = (
709
+ _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options()
710
+ )
711
+
712
+ request, metadata = self._interceptor.pre_get_location(request, metadata)
713
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_transcoded_request(
714
+ http_options, request
715
+ )
716
+
717
+ # Jsonify the query params
718
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_query_params_json(
719
+ transcoded_request
720
+ )
721
+
722
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
723
+ logging.DEBUG
724
+ ): # pragma: NO COVER
725
+ request_url = "{host}{uri}".format(
726
+ host=self._host, uri=transcoded_request["uri"]
727
+ )
728
+ method = transcoded_request["method"]
729
+ try:
730
+ request_payload = json_format.MessageToJson(request)
731
+ except:
732
+ request_payload = None
733
+ http_request = {
734
+ "payload": request_payload,
735
+ "requestMethod": method,
736
+ "requestUrl": request_url,
737
+ "headers": dict(metadata),
738
+ }
739
+ _LOGGER.debug(
740
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetLocation",
741
+ extra={
742
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
743
+ "rpcName": "GetLocation",
744
+ "httpRequest": http_request,
745
+ "metadata": http_request["headers"],
746
+ },
747
+ )
748
+
749
+ # Send the request
750
+ response = LlmUtilityServiceRestTransport._GetLocation._get_response(
751
+ self._host,
752
+ metadata,
753
+ query_params,
754
+ self._session,
755
+ timeout,
756
+ transcoded_request,
757
+ )
758
+
759
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
760
+ # subclass.
761
+ if response.status_code >= 400:
762
+ raise core_exceptions.from_http_response(response)
763
+
764
+ content = response.content.decode("utf-8")
765
+ resp = locations_pb2.Location()
766
+ resp = json_format.Parse(content, resp)
767
+ resp = self._interceptor.post_get_location(resp)
768
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
769
+ logging.DEBUG
770
+ ): # pragma: NO COVER
771
+ try:
772
+ response_payload = json_format.MessageToJson(resp)
773
+ except:
774
+ response_payload = None
775
+ http_response = {
776
+ "payload": response_payload,
777
+ "headers": dict(response.headers),
778
+ "status": response.status_code,
779
+ }
780
+ _LOGGER.debug(
781
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetLocation",
782
+ extra={
783
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
784
+ "rpcName": "GetLocation",
785
+ "httpResponse": http_response,
786
+ "metadata": http_response["headers"],
787
+ },
788
+ )
789
+ return resp
790
+
791
+ @property
792
+ def list_locations(self):
793
+ return self._ListLocations(self._session, self._host, self._interceptor) # type: ignore
794
+
795
+ class _ListLocations(
796
+ _BaseLlmUtilityServiceRestTransport._BaseListLocations,
797
+ LlmUtilityServiceRestStub,
798
+ ):
799
+ def __hash__(self):
800
+ return hash("LlmUtilityServiceRestTransport.ListLocations")
801
+
802
+ @staticmethod
803
+ def _get_response(
804
+ host,
805
+ metadata,
806
+ query_params,
807
+ session,
808
+ timeout,
809
+ transcoded_request,
810
+ body=None,
811
+ ):
812
+
813
+ uri = transcoded_request["uri"]
814
+ method = transcoded_request["method"]
815
+ headers = dict(metadata)
816
+ headers["Content-Type"] = "application/json"
817
+ response = getattr(session, method)(
818
+ "{host}{uri}".format(host=host, uri=uri),
819
+ timeout=timeout,
820
+ headers=headers,
821
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
822
+ )
823
+ return response
824
+
825
+ def __call__(
826
+ self,
827
+ request: locations_pb2.ListLocationsRequest,
828
+ *,
829
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
830
+ timeout: Optional[float] = None,
831
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
832
+ ) -> locations_pb2.ListLocationsResponse:
833
+ r"""Call the list locations method over HTTP.
834
+
835
+ Args:
836
+ request (locations_pb2.ListLocationsRequest):
837
+ The request object for ListLocations method.
838
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
839
+ should be retried.
840
+ timeout (float): The timeout for this request.
841
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
842
+ sent along with the request as metadata. Normally, each value must be of type `str`,
843
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
844
+ be of type `bytes`.
845
+
846
+ Returns:
847
+ locations_pb2.ListLocationsResponse: Response from ListLocations method.
848
+ """
849
+
850
+ http_options = (
851
+ _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options()
852
+ )
853
+
854
+ request, metadata = self._interceptor.pre_list_locations(request, metadata)
855
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_transcoded_request(
856
+ http_options, request
857
+ )
858
+
859
+ # Jsonify the query params
860
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_query_params_json(
861
+ transcoded_request
862
+ )
863
+
864
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
865
+ logging.DEBUG
866
+ ): # pragma: NO COVER
867
+ request_url = "{host}{uri}".format(
868
+ host=self._host, uri=transcoded_request["uri"]
869
+ )
870
+ method = transcoded_request["method"]
871
+ try:
872
+ request_payload = json_format.MessageToJson(request)
873
+ except:
874
+ request_payload = None
875
+ http_request = {
876
+ "payload": request_payload,
877
+ "requestMethod": method,
878
+ "requestUrl": request_url,
879
+ "headers": dict(metadata),
880
+ }
881
+ _LOGGER.debug(
882
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ListLocations",
883
+ extra={
884
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
885
+ "rpcName": "ListLocations",
886
+ "httpRequest": http_request,
887
+ "metadata": http_request["headers"],
888
+ },
889
+ )
890
+
891
+ # Send the request
892
+ response = LlmUtilityServiceRestTransport._ListLocations._get_response(
893
+ self._host,
894
+ metadata,
895
+ query_params,
896
+ self._session,
897
+ timeout,
898
+ transcoded_request,
899
+ )
900
+
901
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
902
+ # subclass.
903
+ if response.status_code >= 400:
904
+ raise core_exceptions.from_http_response(response)
905
+
906
+ content = response.content.decode("utf-8")
907
+ resp = locations_pb2.ListLocationsResponse()
908
+ resp = json_format.Parse(content, resp)
909
+ resp = self._interceptor.post_list_locations(resp)
910
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
911
+ logging.DEBUG
912
+ ): # pragma: NO COVER
913
+ try:
914
+ response_payload = json_format.MessageToJson(resp)
915
+ except:
916
+ response_payload = None
917
+ http_response = {
918
+ "payload": response_payload,
919
+ "headers": dict(response.headers),
920
+ "status": response.status_code,
921
+ }
922
+ _LOGGER.debug(
923
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListLocations",
924
+ extra={
925
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
926
+ "rpcName": "ListLocations",
927
+ "httpResponse": http_response,
928
+ "metadata": http_response["headers"],
929
+ },
930
+ )
931
+ return resp
932
+
933
+ @property
934
+ def get_iam_policy(self):
935
+ return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
936
+
937
+ class _GetIamPolicy(
938
+ _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy, LlmUtilityServiceRestStub
939
+ ):
940
+ def __hash__(self):
941
+ return hash("LlmUtilityServiceRestTransport.GetIamPolicy")
942
+
943
+ @staticmethod
944
+ def _get_response(
945
+ host,
946
+ metadata,
947
+ query_params,
948
+ session,
949
+ timeout,
950
+ transcoded_request,
951
+ body=None,
952
+ ):
953
+
954
+ uri = transcoded_request["uri"]
955
+ method = transcoded_request["method"]
956
+ headers = dict(metadata)
957
+ headers["Content-Type"] = "application/json"
958
+ response = getattr(session, method)(
959
+ "{host}{uri}".format(host=host, uri=uri),
960
+ timeout=timeout,
961
+ headers=headers,
962
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
963
+ data=body,
964
+ )
965
+ return response
966
+
967
+ def __call__(
968
+ self,
969
+ request: iam_policy_pb2.GetIamPolicyRequest,
970
+ *,
971
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
972
+ timeout: Optional[float] = None,
973
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
974
+ ) -> policy_pb2.Policy:
975
+ r"""Call the get iam policy method over HTTP.
976
+
977
+ Args:
978
+ request (iam_policy_pb2.GetIamPolicyRequest):
979
+ The request object for GetIamPolicy method.
980
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
981
+ should be retried.
982
+ timeout (float): The timeout for this request.
983
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
984
+ sent along with the request as metadata. Normally, each value must be of type `str`,
985
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
986
+ be of type `bytes`.
987
+
988
+ Returns:
989
+ policy_pb2.Policy: Response from GetIamPolicy method.
990
+ """
991
+
992
+ http_options = (
993
+ _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options()
994
+ )
995
+
996
+ request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
997
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_transcoded_request(
998
+ http_options, request
999
+ )
1000
+
1001
+ body = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_request_body_json(
1002
+ transcoded_request
1003
+ )
1004
+
1005
+ # Jsonify the query params
1006
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_query_params_json(
1007
+ transcoded_request
1008
+ )
1009
+
1010
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1011
+ logging.DEBUG
1012
+ ): # pragma: NO COVER
1013
+ request_url = "{host}{uri}".format(
1014
+ host=self._host, uri=transcoded_request["uri"]
1015
+ )
1016
+ method = transcoded_request["method"]
1017
+ try:
1018
+ request_payload = json_format.MessageToJson(request)
1019
+ except:
1020
+ request_payload = None
1021
+ http_request = {
1022
+ "payload": request_payload,
1023
+ "requestMethod": method,
1024
+ "requestUrl": request_url,
1025
+ "headers": dict(metadata),
1026
+ }
1027
+ _LOGGER.debug(
1028
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetIamPolicy",
1029
+ extra={
1030
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1031
+ "rpcName": "GetIamPolicy",
1032
+ "httpRequest": http_request,
1033
+ "metadata": http_request["headers"],
1034
+ },
1035
+ )
1036
+
1037
+ # Send the request
1038
+ response = LlmUtilityServiceRestTransport._GetIamPolicy._get_response(
1039
+ self._host,
1040
+ metadata,
1041
+ query_params,
1042
+ self._session,
1043
+ timeout,
1044
+ transcoded_request,
1045
+ body,
1046
+ )
1047
+
1048
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1049
+ # subclass.
1050
+ if response.status_code >= 400:
1051
+ raise core_exceptions.from_http_response(response)
1052
+
1053
+ content = response.content.decode("utf-8")
1054
+ resp = policy_pb2.Policy()
1055
+ resp = json_format.Parse(content, resp)
1056
+ resp = self._interceptor.post_get_iam_policy(resp)
1057
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1058
+ logging.DEBUG
1059
+ ): # pragma: NO COVER
1060
+ try:
1061
+ response_payload = json_format.MessageToJson(resp)
1062
+ except:
1063
+ response_payload = None
1064
+ http_response = {
1065
+ "payload": response_payload,
1066
+ "headers": dict(response.headers),
1067
+ "status": response.status_code,
1068
+ }
1069
+ _LOGGER.debug(
1070
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetIamPolicy",
1071
+ extra={
1072
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1073
+ "rpcName": "GetIamPolicy",
1074
+ "httpResponse": http_response,
1075
+ "metadata": http_response["headers"],
1076
+ },
1077
+ )
1078
+ return resp
1079
+
1080
+ @property
1081
+ def set_iam_policy(self):
1082
+ return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
1083
+
1084
+ class _SetIamPolicy(
1085
+ _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy, LlmUtilityServiceRestStub
1086
+ ):
1087
+ def __hash__(self):
1088
+ return hash("LlmUtilityServiceRestTransport.SetIamPolicy")
1089
+
1090
+ @staticmethod
1091
+ def _get_response(
1092
+ host,
1093
+ metadata,
1094
+ query_params,
1095
+ session,
1096
+ timeout,
1097
+ transcoded_request,
1098
+ body=None,
1099
+ ):
1100
+
1101
+ uri = transcoded_request["uri"]
1102
+ method = transcoded_request["method"]
1103
+ headers = dict(metadata)
1104
+ headers["Content-Type"] = "application/json"
1105
+ response = getattr(session, method)(
1106
+ "{host}{uri}".format(host=host, uri=uri),
1107
+ timeout=timeout,
1108
+ headers=headers,
1109
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1110
+ data=body,
1111
+ )
1112
+ return response
1113
+
1114
+ def __call__(
1115
+ self,
1116
+ request: iam_policy_pb2.SetIamPolicyRequest,
1117
+ *,
1118
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1119
+ timeout: Optional[float] = None,
1120
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1121
+ ) -> policy_pb2.Policy:
1122
+ r"""Call the set iam policy method over HTTP.
1123
+
1124
+ Args:
1125
+ request (iam_policy_pb2.SetIamPolicyRequest):
1126
+ The request object for SetIamPolicy method.
1127
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1128
+ should be retried.
1129
+ timeout (float): The timeout for this request.
1130
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1131
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1132
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1133
+ be of type `bytes`.
1134
+
1135
+ Returns:
1136
+ policy_pb2.Policy: Response from SetIamPolicy method.
1137
+ """
1138
+
1139
+ http_options = (
1140
+ _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options()
1141
+ )
1142
+
1143
+ request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
1144
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_transcoded_request(
1145
+ http_options, request
1146
+ )
1147
+
1148
+ body = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_request_body_json(
1149
+ transcoded_request
1150
+ )
1151
+
1152
+ # Jsonify the query params
1153
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_query_params_json(
1154
+ transcoded_request
1155
+ )
1156
+
1157
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1158
+ logging.DEBUG
1159
+ ): # pragma: NO COVER
1160
+ request_url = "{host}{uri}".format(
1161
+ host=self._host, uri=transcoded_request["uri"]
1162
+ )
1163
+ method = transcoded_request["method"]
1164
+ try:
1165
+ request_payload = json_format.MessageToJson(request)
1166
+ except:
1167
+ request_payload = None
1168
+ http_request = {
1169
+ "payload": request_payload,
1170
+ "requestMethod": method,
1171
+ "requestUrl": request_url,
1172
+ "headers": dict(metadata),
1173
+ }
1174
+ _LOGGER.debug(
1175
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.SetIamPolicy",
1176
+ extra={
1177
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1178
+ "rpcName": "SetIamPolicy",
1179
+ "httpRequest": http_request,
1180
+ "metadata": http_request["headers"],
1181
+ },
1182
+ )
1183
+
1184
+ # Send the request
1185
+ response = LlmUtilityServiceRestTransport._SetIamPolicy._get_response(
1186
+ self._host,
1187
+ metadata,
1188
+ query_params,
1189
+ self._session,
1190
+ timeout,
1191
+ transcoded_request,
1192
+ body,
1193
+ )
1194
+
1195
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1196
+ # subclass.
1197
+ if response.status_code >= 400:
1198
+ raise core_exceptions.from_http_response(response)
1199
+
1200
+ content = response.content.decode("utf-8")
1201
+ resp = policy_pb2.Policy()
1202
+ resp = json_format.Parse(content, resp)
1203
+ resp = self._interceptor.post_set_iam_policy(resp)
1204
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1205
+ logging.DEBUG
1206
+ ): # pragma: NO COVER
1207
+ try:
1208
+ response_payload = json_format.MessageToJson(resp)
1209
+ except:
1210
+ response_payload = None
1211
+ http_response = {
1212
+ "payload": response_payload,
1213
+ "headers": dict(response.headers),
1214
+ "status": response.status_code,
1215
+ }
1216
+ _LOGGER.debug(
1217
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.SetIamPolicy",
1218
+ extra={
1219
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1220
+ "rpcName": "SetIamPolicy",
1221
+ "httpResponse": http_response,
1222
+ "metadata": http_response["headers"],
1223
+ },
1224
+ )
1225
+ return resp
1226
+
1227
+ @property
1228
+ def test_iam_permissions(self):
1229
+ return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
1230
+
1231
+ class _TestIamPermissions(
1232
+ _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions,
1233
+ LlmUtilityServiceRestStub,
1234
+ ):
1235
+ def __hash__(self):
1236
+ return hash("LlmUtilityServiceRestTransport.TestIamPermissions")
1237
+
1238
+ @staticmethod
1239
+ def _get_response(
1240
+ host,
1241
+ metadata,
1242
+ query_params,
1243
+ session,
1244
+ timeout,
1245
+ transcoded_request,
1246
+ body=None,
1247
+ ):
1248
+
1249
+ uri = transcoded_request["uri"]
1250
+ method = transcoded_request["method"]
1251
+ headers = dict(metadata)
1252
+ headers["Content-Type"] = "application/json"
1253
+ response = getattr(session, method)(
1254
+ "{host}{uri}".format(host=host, uri=uri),
1255
+ timeout=timeout,
1256
+ headers=headers,
1257
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1258
+ data=body,
1259
+ )
1260
+ return response
1261
+
1262
+ def __call__(
1263
+ self,
1264
+ request: iam_policy_pb2.TestIamPermissionsRequest,
1265
+ *,
1266
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1267
+ timeout: Optional[float] = None,
1268
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1269
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1270
+ r"""Call the test iam permissions method over HTTP.
1271
+
1272
+ Args:
1273
+ request (iam_policy_pb2.TestIamPermissionsRequest):
1274
+ The request object for TestIamPermissions method.
1275
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1276
+ should be retried.
1277
+ timeout (float): The timeout for this request.
1278
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1279
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1280
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1281
+ be of type `bytes`.
1282
+
1283
+ Returns:
1284
+ iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method.
1285
+ """
1286
+
1287
+ http_options = (
1288
+ _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options()
1289
+ )
1290
+
1291
+ request, metadata = self._interceptor.pre_test_iam_permissions(
1292
+ request, metadata
1293
+ )
1294
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_transcoded_request(
1295
+ http_options, request
1296
+ )
1297
+
1298
+ body = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_request_body_json(
1299
+ transcoded_request
1300
+ )
1301
+
1302
+ # Jsonify the query params
1303
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_query_params_json(
1304
+ transcoded_request
1305
+ )
1306
+
1307
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1308
+ logging.DEBUG
1309
+ ): # pragma: NO COVER
1310
+ request_url = "{host}{uri}".format(
1311
+ host=self._host, uri=transcoded_request["uri"]
1312
+ )
1313
+ method = transcoded_request["method"]
1314
+ try:
1315
+ request_payload = json_format.MessageToJson(request)
1316
+ except:
1317
+ request_payload = None
1318
+ http_request = {
1319
+ "payload": request_payload,
1320
+ "requestMethod": method,
1321
+ "requestUrl": request_url,
1322
+ "headers": dict(metadata),
1323
+ }
1324
+ _LOGGER.debug(
1325
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.TestIamPermissions",
1326
+ extra={
1327
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1328
+ "rpcName": "TestIamPermissions",
1329
+ "httpRequest": http_request,
1330
+ "metadata": http_request["headers"],
1331
+ },
1332
+ )
1333
+
1334
+ # Send the request
1335
+ response = LlmUtilityServiceRestTransport._TestIamPermissions._get_response(
1336
+ self._host,
1337
+ metadata,
1338
+ query_params,
1339
+ self._session,
1340
+ timeout,
1341
+ transcoded_request,
1342
+ body,
1343
+ )
1344
+
1345
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1346
+ # subclass.
1347
+ if response.status_code >= 400:
1348
+ raise core_exceptions.from_http_response(response)
1349
+
1350
+ content = response.content.decode("utf-8")
1351
+ resp = iam_policy_pb2.TestIamPermissionsResponse()
1352
+ resp = json_format.Parse(content, resp)
1353
+ resp = self._interceptor.post_test_iam_permissions(resp)
1354
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1355
+ logging.DEBUG
1356
+ ): # pragma: NO COVER
1357
+ try:
1358
+ response_payload = json_format.MessageToJson(resp)
1359
+ except:
1360
+ response_payload = None
1361
+ http_response = {
1362
+ "payload": response_payload,
1363
+ "headers": dict(response.headers),
1364
+ "status": response.status_code,
1365
+ }
1366
+ _LOGGER.debug(
1367
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.TestIamPermissions",
1368
+ extra={
1369
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1370
+ "rpcName": "TestIamPermissions",
1371
+ "httpResponse": http_response,
1372
+ "metadata": http_response["headers"],
1373
+ },
1374
+ )
1375
+ return resp
1376
+
1377
+ @property
1378
+ def cancel_operation(self):
1379
+ return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
1380
+
1381
+ class _CancelOperation(
1382
+ _BaseLlmUtilityServiceRestTransport._BaseCancelOperation,
1383
+ LlmUtilityServiceRestStub,
1384
+ ):
1385
+ def __hash__(self):
1386
+ return hash("LlmUtilityServiceRestTransport.CancelOperation")
1387
+
1388
+ @staticmethod
1389
+ def _get_response(
1390
+ host,
1391
+ metadata,
1392
+ query_params,
1393
+ session,
1394
+ timeout,
1395
+ transcoded_request,
1396
+ body=None,
1397
+ ):
1398
+
1399
+ uri = transcoded_request["uri"]
1400
+ method = transcoded_request["method"]
1401
+ headers = dict(metadata)
1402
+ headers["Content-Type"] = "application/json"
1403
+ response = getattr(session, method)(
1404
+ "{host}{uri}".format(host=host, uri=uri),
1405
+ timeout=timeout,
1406
+ headers=headers,
1407
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1408
+ )
1409
+ return response
1410
+
1411
+ def __call__(
1412
+ self,
1413
+ request: operations_pb2.CancelOperationRequest,
1414
+ *,
1415
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1416
+ timeout: Optional[float] = None,
1417
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1418
+ ) -> None:
1419
+ r"""Call the cancel operation method over HTTP.
1420
+
1421
+ Args:
1422
+ request (operations_pb2.CancelOperationRequest):
1423
+ The request object for CancelOperation method.
1424
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1425
+ should be retried.
1426
+ timeout (float): The timeout for this request.
1427
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1428
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1429
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1430
+ be of type `bytes`.
1431
+ """
1432
+
1433
+ http_options = (
1434
+ _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options()
1435
+ )
1436
+
1437
+ request, metadata = self._interceptor.pre_cancel_operation(
1438
+ request, metadata
1439
+ )
1440
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_transcoded_request(
1441
+ http_options, request
1442
+ )
1443
+
1444
+ # Jsonify the query params
1445
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_query_params_json(
1446
+ transcoded_request
1447
+ )
1448
+
1449
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1450
+ logging.DEBUG
1451
+ ): # pragma: NO COVER
1452
+ request_url = "{host}{uri}".format(
1453
+ host=self._host, uri=transcoded_request["uri"]
1454
+ )
1455
+ method = transcoded_request["method"]
1456
+ try:
1457
+ request_payload = json_format.MessageToJson(request)
1458
+ except:
1459
+ request_payload = None
1460
+ http_request = {
1461
+ "payload": request_payload,
1462
+ "requestMethod": method,
1463
+ "requestUrl": request_url,
1464
+ "headers": dict(metadata),
1465
+ }
1466
+ _LOGGER.debug(
1467
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.CancelOperation",
1468
+ extra={
1469
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1470
+ "rpcName": "CancelOperation",
1471
+ "httpRequest": http_request,
1472
+ "metadata": http_request["headers"],
1473
+ },
1474
+ )
1475
+
1476
+ # Send the request
1477
+ response = LlmUtilityServiceRestTransport._CancelOperation._get_response(
1478
+ self._host,
1479
+ metadata,
1480
+ query_params,
1481
+ self._session,
1482
+ timeout,
1483
+ transcoded_request,
1484
+ )
1485
+
1486
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1487
+ # subclass.
1488
+ if response.status_code >= 400:
1489
+ raise core_exceptions.from_http_response(response)
1490
+
1491
+ return self._interceptor.post_cancel_operation(None)
1492
+
1493
+ @property
1494
+ def delete_operation(self):
1495
+ return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore
1496
+
1497
+ class _DeleteOperation(
1498
+ _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation,
1499
+ LlmUtilityServiceRestStub,
1500
+ ):
1501
+ def __hash__(self):
1502
+ return hash("LlmUtilityServiceRestTransport.DeleteOperation")
1503
+
1504
+ @staticmethod
1505
+ def _get_response(
1506
+ host,
1507
+ metadata,
1508
+ query_params,
1509
+ session,
1510
+ timeout,
1511
+ transcoded_request,
1512
+ body=None,
1513
+ ):
1514
+
1515
+ uri = transcoded_request["uri"]
1516
+ method = transcoded_request["method"]
1517
+ headers = dict(metadata)
1518
+ headers["Content-Type"] = "application/json"
1519
+ response = getattr(session, method)(
1520
+ "{host}{uri}".format(host=host, uri=uri),
1521
+ timeout=timeout,
1522
+ headers=headers,
1523
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1524
+ )
1525
+ return response
1526
+
1527
+ def __call__(
1528
+ self,
1529
+ request: operations_pb2.DeleteOperationRequest,
1530
+ *,
1531
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1532
+ timeout: Optional[float] = None,
1533
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1534
+ ) -> None:
1535
+ r"""Call the delete operation method over HTTP.
1536
+
1537
+ Args:
1538
+ request (operations_pb2.DeleteOperationRequest):
1539
+ The request object for DeleteOperation method.
1540
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1541
+ should be retried.
1542
+ timeout (float): The timeout for this request.
1543
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1544
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1545
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1546
+ be of type `bytes`.
1547
+ """
1548
+
1549
+ http_options = (
1550
+ _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options()
1551
+ )
1552
+
1553
+ request, metadata = self._interceptor.pre_delete_operation(
1554
+ request, metadata
1555
+ )
1556
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_transcoded_request(
1557
+ http_options, request
1558
+ )
1559
+
1560
+ # Jsonify the query params
1561
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_query_params_json(
1562
+ transcoded_request
1563
+ )
1564
+
1565
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1566
+ logging.DEBUG
1567
+ ): # pragma: NO COVER
1568
+ request_url = "{host}{uri}".format(
1569
+ host=self._host, uri=transcoded_request["uri"]
1570
+ )
1571
+ method = transcoded_request["method"]
1572
+ try:
1573
+ request_payload = json_format.MessageToJson(request)
1574
+ except:
1575
+ request_payload = None
1576
+ http_request = {
1577
+ "payload": request_payload,
1578
+ "requestMethod": method,
1579
+ "requestUrl": request_url,
1580
+ "headers": dict(metadata),
1581
+ }
1582
+ _LOGGER.debug(
1583
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.DeleteOperation",
1584
+ extra={
1585
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1586
+ "rpcName": "DeleteOperation",
1587
+ "httpRequest": http_request,
1588
+ "metadata": http_request["headers"],
1589
+ },
1590
+ )
1591
+
1592
+ # Send the request
1593
+ response = LlmUtilityServiceRestTransport._DeleteOperation._get_response(
1594
+ self._host,
1595
+ metadata,
1596
+ query_params,
1597
+ self._session,
1598
+ timeout,
1599
+ transcoded_request,
1600
+ )
1601
+
1602
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1603
+ # subclass.
1604
+ if response.status_code >= 400:
1605
+ raise core_exceptions.from_http_response(response)
1606
+
1607
+ return self._interceptor.post_delete_operation(None)
1608
+
1609
+ @property
1610
+ def get_operation(self):
1611
+ return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
1612
+
1613
+ class _GetOperation(
1614
+ _BaseLlmUtilityServiceRestTransport._BaseGetOperation, LlmUtilityServiceRestStub
1615
+ ):
1616
+ def __hash__(self):
1617
+ return hash("LlmUtilityServiceRestTransport.GetOperation")
1618
+
1619
+ @staticmethod
1620
+ def _get_response(
1621
+ host,
1622
+ metadata,
1623
+ query_params,
1624
+ session,
1625
+ timeout,
1626
+ transcoded_request,
1627
+ body=None,
1628
+ ):
1629
+
1630
+ uri = transcoded_request["uri"]
1631
+ method = transcoded_request["method"]
1632
+ headers = dict(metadata)
1633
+ headers["Content-Type"] = "application/json"
1634
+ response = getattr(session, method)(
1635
+ "{host}{uri}".format(host=host, uri=uri),
1636
+ timeout=timeout,
1637
+ headers=headers,
1638
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1639
+ )
1640
+ return response
1641
+
1642
+ def __call__(
1643
+ self,
1644
+ request: operations_pb2.GetOperationRequest,
1645
+ *,
1646
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1647
+ timeout: Optional[float] = None,
1648
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1649
+ ) -> operations_pb2.Operation:
1650
+ r"""Call the get operation method over HTTP.
1651
+
1652
+ Args:
1653
+ request (operations_pb2.GetOperationRequest):
1654
+ The request object for GetOperation method.
1655
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1656
+ should be retried.
1657
+ timeout (float): The timeout for this request.
1658
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1659
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1660
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1661
+ be of type `bytes`.
1662
+
1663
+ Returns:
1664
+ operations_pb2.Operation: Response from GetOperation method.
1665
+ """
1666
+
1667
+ http_options = (
1668
+ _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options()
1669
+ )
1670
+
1671
+ request, metadata = self._interceptor.pre_get_operation(request, metadata)
1672
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_transcoded_request(
1673
+ http_options, request
1674
+ )
1675
+
1676
+ # Jsonify the query params
1677
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_query_params_json(
1678
+ transcoded_request
1679
+ )
1680
+
1681
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1682
+ logging.DEBUG
1683
+ ): # pragma: NO COVER
1684
+ request_url = "{host}{uri}".format(
1685
+ host=self._host, uri=transcoded_request["uri"]
1686
+ )
1687
+ method = transcoded_request["method"]
1688
+ try:
1689
+ request_payload = json_format.MessageToJson(request)
1690
+ except:
1691
+ request_payload = None
1692
+ http_request = {
1693
+ "payload": request_payload,
1694
+ "requestMethod": method,
1695
+ "requestUrl": request_url,
1696
+ "headers": dict(metadata),
1697
+ }
1698
+ _LOGGER.debug(
1699
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetOperation",
1700
+ extra={
1701
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1702
+ "rpcName": "GetOperation",
1703
+ "httpRequest": http_request,
1704
+ "metadata": http_request["headers"],
1705
+ },
1706
+ )
1707
+
1708
+ # Send the request
1709
+ response = LlmUtilityServiceRestTransport._GetOperation._get_response(
1710
+ self._host,
1711
+ metadata,
1712
+ query_params,
1713
+ self._session,
1714
+ timeout,
1715
+ transcoded_request,
1716
+ )
1717
+
1718
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1719
+ # subclass.
1720
+ if response.status_code >= 400:
1721
+ raise core_exceptions.from_http_response(response)
1722
+
1723
+ content = response.content.decode("utf-8")
1724
+ resp = operations_pb2.Operation()
1725
+ resp = json_format.Parse(content, resp)
1726
+ resp = self._interceptor.post_get_operation(resp)
1727
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1728
+ logging.DEBUG
1729
+ ): # pragma: NO COVER
1730
+ try:
1731
+ response_payload = json_format.MessageToJson(resp)
1732
+ except:
1733
+ response_payload = None
1734
+ http_response = {
1735
+ "payload": response_payload,
1736
+ "headers": dict(response.headers),
1737
+ "status": response.status_code,
1738
+ }
1739
+ _LOGGER.debug(
1740
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetOperation",
1741
+ extra={
1742
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1743
+ "rpcName": "GetOperation",
1744
+ "httpResponse": http_response,
1745
+ "metadata": http_response["headers"],
1746
+ },
1747
+ )
1748
+ return resp
1749
+
1750
+ @property
1751
+ def list_operations(self):
1752
+ return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
1753
+
1754
+ class _ListOperations(
1755
+ _BaseLlmUtilityServiceRestTransport._BaseListOperations,
1756
+ LlmUtilityServiceRestStub,
1757
+ ):
1758
+ def __hash__(self):
1759
+ return hash("LlmUtilityServiceRestTransport.ListOperations")
1760
+
1761
+ @staticmethod
1762
+ def _get_response(
1763
+ host,
1764
+ metadata,
1765
+ query_params,
1766
+ session,
1767
+ timeout,
1768
+ transcoded_request,
1769
+ body=None,
1770
+ ):
1771
+
1772
+ uri = transcoded_request["uri"]
1773
+ method = transcoded_request["method"]
1774
+ headers = dict(metadata)
1775
+ headers["Content-Type"] = "application/json"
1776
+ response = getattr(session, method)(
1777
+ "{host}{uri}".format(host=host, uri=uri),
1778
+ timeout=timeout,
1779
+ headers=headers,
1780
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1781
+ )
1782
+ return response
1783
+
1784
+ def __call__(
1785
+ self,
1786
+ request: operations_pb2.ListOperationsRequest,
1787
+ *,
1788
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1789
+ timeout: Optional[float] = None,
1790
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1791
+ ) -> operations_pb2.ListOperationsResponse:
1792
+ r"""Call the list operations method over HTTP.
1793
+
1794
+ Args:
1795
+ request (operations_pb2.ListOperationsRequest):
1796
+ The request object for ListOperations method.
1797
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1798
+ should be retried.
1799
+ timeout (float): The timeout for this request.
1800
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1801
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1802
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1803
+ be of type `bytes`.
1804
+
1805
+ Returns:
1806
+ operations_pb2.ListOperationsResponse: Response from ListOperations method.
1807
+ """
1808
+
1809
+ http_options = (
1810
+ _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options()
1811
+ )
1812
+
1813
+ request, metadata = self._interceptor.pre_list_operations(request, metadata)
1814
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_transcoded_request(
1815
+ http_options, request
1816
+ )
1817
+
1818
+ # Jsonify the query params
1819
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_query_params_json(
1820
+ transcoded_request
1821
+ )
1822
+
1823
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1824
+ logging.DEBUG
1825
+ ): # pragma: NO COVER
1826
+ request_url = "{host}{uri}".format(
1827
+ host=self._host, uri=transcoded_request["uri"]
1828
+ )
1829
+ method = transcoded_request["method"]
1830
+ try:
1831
+ request_payload = json_format.MessageToJson(request)
1832
+ except:
1833
+ request_payload = None
1834
+ http_request = {
1835
+ "payload": request_payload,
1836
+ "requestMethod": method,
1837
+ "requestUrl": request_url,
1838
+ "headers": dict(metadata),
1839
+ }
1840
+ _LOGGER.debug(
1841
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ListOperations",
1842
+ extra={
1843
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1844
+ "rpcName": "ListOperations",
1845
+ "httpRequest": http_request,
1846
+ "metadata": http_request["headers"],
1847
+ },
1848
+ )
1849
+
1850
+ # Send the request
1851
+ response = LlmUtilityServiceRestTransport._ListOperations._get_response(
1852
+ self._host,
1853
+ metadata,
1854
+ query_params,
1855
+ self._session,
1856
+ timeout,
1857
+ transcoded_request,
1858
+ )
1859
+
1860
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1861
+ # subclass.
1862
+ if response.status_code >= 400:
1863
+ raise core_exceptions.from_http_response(response)
1864
+
1865
+ content = response.content.decode("utf-8")
1866
+ resp = operations_pb2.ListOperationsResponse()
1867
+ resp = json_format.Parse(content, resp)
1868
+ resp = self._interceptor.post_list_operations(resp)
1869
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1870
+ logging.DEBUG
1871
+ ): # pragma: NO COVER
1872
+ try:
1873
+ response_payload = json_format.MessageToJson(resp)
1874
+ except:
1875
+ response_payload = None
1876
+ http_response = {
1877
+ "payload": response_payload,
1878
+ "headers": dict(response.headers),
1879
+ "status": response.status_code,
1880
+ }
1881
+ _LOGGER.debug(
1882
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListOperations",
1883
+ extra={
1884
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1885
+ "rpcName": "ListOperations",
1886
+ "httpResponse": http_response,
1887
+ "metadata": http_response["headers"],
1888
+ },
1889
+ )
1890
+ return resp
1891
+
1892
+ @property
1893
+ def wait_operation(self):
1894
+ return self._WaitOperation(self._session, self._host, self._interceptor) # type: ignore
1895
+
1896
+ class _WaitOperation(
1897
+ _BaseLlmUtilityServiceRestTransport._BaseWaitOperation,
1898
+ LlmUtilityServiceRestStub,
1899
+ ):
1900
+ def __hash__(self):
1901
+ return hash("LlmUtilityServiceRestTransport.WaitOperation")
1902
+
1903
+ @staticmethod
1904
+ def _get_response(
1905
+ host,
1906
+ metadata,
1907
+ query_params,
1908
+ session,
1909
+ timeout,
1910
+ transcoded_request,
1911
+ body=None,
1912
+ ):
1913
+
1914
+ uri = transcoded_request["uri"]
1915
+ method = transcoded_request["method"]
1916
+ headers = dict(metadata)
1917
+ headers["Content-Type"] = "application/json"
1918
+ response = getattr(session, method)(
1919
+ "{host}{uri}".format(host=host, uri=uri),
1920
+ timeout=timeout,
1921
+ headers=headers,
1922
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1923
+ )
1924
+ return response
1925
+
1926
+ def __call__(
1927
+ self,
1928
+ request: operations_pb2.WaitOperationRequest,
1929
+ *,
1930
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1931
+ timeout: Optional[float] = None,
1932
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1933
+ ) -> operations_pb2.Operation:
1934
+ r"""Call the wait operation method over HTTP.
1935
+
1936
+ Args:
1937
+ request (operations_pb2.WaitOperationRequest):
1938
+ The request object for WaitOperation method.
1939
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1940
+ should be retried.
1941
+ timeout (float): The timeout for this request.
1942
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1943
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1944
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1945
+ be of type `bytes`.
1946
+
1947
+ Returns:
1948
+ operations_pb2.Operation: Response from WaitOperation method.
1949
+ """
1950
+
1951
+ http_options = (
1952
+ _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options()
1953
+ )
1954
+
1955
+ request, metadata = self._interceptor.pre_wait_operation(request, metadata)
1956
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_transcoded_request(
1957
+ http_options, request
1958
+ )
1959
+
1960
+ # Jsonify the query params
1961
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_query_params_json(
1962
+ transcoded_request
1963
+ )
1964
+
1965
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1966
+ logging.DEBUG
1967
+ ): # pragma: NO COVER
1968
+ request_url = "{host}{uri}".format(
1969
+ host=self._host, uri=transcoded_request["uri"]
1970
+ )
1971
+ method = transcoded_request["method"]
1972
+ try:
1973
+ request_payload = json_format.MessageToJson(request)
1974
+ except:
1975
+ request_payload = None
1976
+ http_request = {
1977
+ "payload": request_payload,
1978
+ "requestMethod": method,
1979
+ "requestUrl": request_url,
1980
+ "headers": dict(metadata),
1981
+ }
1982
+ _LOGGER.debug(
1983
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.WaitOperation",
1984
+ extra={
1985
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1986
+ "rpcName": "WaitOperation",
1987
+ "httpRequest": http_request,
1988
+ "metadata": http_request["headers"],
1989
+ },
1990
+ )
1991
+
1992
+ # Send the request
1993
+ response = LlmUtilityServiceRestTransport._WaitOperation._get_response(
1994
+ self._host,
1995
+ metadata,
1996
+ query_params,
1997
+ self._session,
1998
+ timeout,
1999
+ transcoded_request,
2000
+ )
2001
+
2002
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2003
+ # subclass.
2004
+ if response.status_code >= 400:
2005
+ raise core_exceptions.from_http_response(response)
2006
+
2007
+ content = response.content.decode("utf-8")
2008
+ resp = operations_pb2.Operation()
2009
+ resp = json_format.Parse(content, resp)
2010
+ resp = self._interceptor.post_wait_operation(resp)
2011
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2012
+ logging.DEBUG
2013
+ ): # pragma: NO COVER
2014
+ try:
2015
+ response_payload = json_format.MessageToJson(resp)
2016
+ except:
2017
+ response_payload = None
2018
+ http_response = {
2019
+ "payload": response_payload,
2020
+ "headers": dict(response.headers),
2021
+ "status": response.status_code,
2022
+ }
2023
+ _LOGGER.debug(
2024
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.WaitOperation",
2025
+ extra={
2026
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
2027
+ "rpcName": "WaitOperation",
2028
+ "httpResponse": http_response,
2029
+ "metadata": http_response["headers"],
2030
+ },
2031
+ )
2032
+ return resp
2033
+
2034
+ @property
2035
+ def kind(self) -> str:
2036
+ return "rest"
2037
+
2038
+ def close(self):
2039
+ self._session.close()
2040
+
2041
+
2042
+ __all__ = ("LlmUtilityServiceRestTransport",)
loan-advisor-agent/.venv/Lib/site-packages/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py ADDED
@@ -0,0 +1,2198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ import google.auth
18
+
19
+ try:
20
+ import aiohttp # type: ignore
21
+ from google.auth.aio.transport.sessions import AsyncAuthorizedSession # type: ignore
22
+ from google.api_core import rest_streaming_async # type: ignore
23
+ from google.api_core.operations_v1 import AsyncOperationsRestClient # type: ignore
24
+ except ImportError as e: # pragma: NO COVER
25
+ raise ImportError(
26
+ "`rest_asyncio` transport requires the library to be installed with the `async_rest` extra. Install the library with the `async_rest` extra using `pip install google-cloud-aiplatform[async_rest]`"
27
+ ) from e
28
+
29
+ from google.auth.aio import credentials as ga_credentials_async # type: ignore
30
+
31
+ from google.api_core import exceptions as core_exceptions
32
+ from google.api_core import gapic_v1
33
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
34
+ from google.iam.v1 import policy_pb2 # type: ignore
35
+ from google.cloud.location import locations_pb2 # type: ignore
36
+ from google.api_core import retry_async as retries
37
+ from google.api_core import rest_helpers
38
+ from google.api_core import rest_streaming_async # type: ignore
39
+ import google.protobuf
40
+
41
+ from google.protobuf import json_format
42
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
43
+ from google.iam.v1 import policy_pb2 # type: ignore
44
+ from google.cloud.location import locations_pb2 # type: ignore
45
+
46
+ import json # type: ignore
47
+ import dataclasses
48
+ from typing import Any, Dict, List, Callable, Tuple, Optional, Sequence, Union
49
+
50
+
51
+ from google.cloud.aiplatform_v1beta1.types import llm_utility_service
52
+ from google.longrunning import operations_pb2 # type: ignore
53
+
54
+
55
+ from .rest_base import _BaseLlmUtilityServiceRestTransport
56
+
57
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
58
+
59
+
60
+ import logging
61
+
62
+ try:
63
+ from google.api_core import client_logging # type: ignore
64
+
65
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
66
+ except ImportError: # pragma: NO COVER
67
+ CLIENT_LOGGING_SUPPORTED = False
68
+
69
+ _LOGGER = logging.getLogger(__name__)
70
+
71
+ try:
72
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
73
+ except AttributeError: # pragma: NO COVER
74
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
75
+
76
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
77
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
78
+ grpc_version=None,
79
+ rest_version=f"google-auth@{google.auth.__version__}",
80
+ )
81
+
82
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
83
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
84
+
85
+
86
+ class AsyncLlmUtilityServiceRestInterceptor:
87
+ """Asynchronous Interceptor for LlmUtilityService.
88
+
89
+ Interceptors are used to manipulate requests, request metadata, and responses
90
+ in arbitrary ways.
91
+ Example use cases include:
92
+ * Logging
93
+ * Verifying requests according to service or custom semantics
94
+ * Stripping extraneous information from responses
95
+
96
+ These use cases and more can be enabled by injecting an
97
+ instance of a custom subclass when constructing the AsyncLlmUtilityServiceRestTransport.
98
+
99
+ .. code-block:: python
100
+ class MyCustomLlmUtilityServiceInterceptor(LlmUtilityServiceRestInterceptor):
101
+ async def pre_compute_tokens(self, request, metadata):
102
+ logging.log(f"Received request: {request}")
103
+ return request, metadata
104
+
105
+ async def post_compute_tokens(self, response):
106
+ logging.log(f"Received response: {response}")
107
+ return response
108
+
109
+ transport = AsyncLlmUtilityServiceRestTransport(interceptor=MyCustomLlmUtilityServiceInterceptor())
110
+ client = async LlmUtilityServiceClient(transport=transport)
111
+
112
+
113
+ """
114
+
115
+ async def pre_compute_tokens(
116
+ self,
117
+ request: llm_utility_service.ComputeTokensRequest,
118
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
119
+ ) -> Tuple[
120
+ llm_utility_service.ComputeTokensRequest,
121
+ Sequence[Tuple[str, Union[str, bytes]]],
122
+ ]:
123
+ """Pre-rpc interceptor for compute_tokens
124
+
125
+ Override in a subclass to manipulate the request or metadata
126
+ before they are sent to the LlmUtilityService server.
127
+ """
128
+ return request, metadata
129
+
130
+ async def post_compute_tokens(
131
+ self, response: llm_utility_service.ComputeTokensResponse
132
+ ) -> llm_utility_service.ComputeTokensResponse:
133
+ """Post-rpc interceptor for compute_tokens
134
+
135
+ DEPRECATED. Please use the `post_compute_tokens_with_metadata`
136
+ interceptor instead.
137
+
138
+ Override in a subclass to read or manipulate the response
139
+ after it is returned by the LlmUtilityService server but before
140
+ it is returned to user code. This `post_compute_tokens` interceptor runs
141
+ before the `post_compute_tokens_with_metadata` interceptor.
142
+ """
143
+ return response
144
+
145
+ async def post_compute_tokens_with_metadata(
146
+ self,
147
+ response: llm_utility_service.ComputeTokensResponse,
148
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
149
+ ) -> Tuple[
150
+ llm_utility_service.ComputeTokensResponse,
151
+ Sequence[Tuple[str, Union[str, bytes]]],
152
+ ]:
153
+ """Post-rpc interceptor for compute_tokens
154
+
155
+ Override in a subclass to read or manipulate the response or metadata after it
156
+ is returned by the LlmUtilityService server but before it is returned to user code.
157
+
158
+ We recommend only using this `post_compute_tokens_with_metadata`
159
+ interceptor in new development instead of the `post_compute_tokens` interceptor.
160
+ When both interceptors are used, this `post_compute_tokens_with_metadata` interceptor runs after the
161
+ `post_compute_tokens` interceptor. The (possibly modified) response returned by
162
+ `post_compute_tokens` will be passed to
163
+ `post_compute_tokens_with_metadata`.
164
+ """
165
+ return response, metadata
166
+
167
+ async def pre_get_location(
168
+ self,
169
+ request: locations_pb2.GetLocationRequest,
170
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
171
+ ) -> Tuple[
172
+ locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]]
173
+ ]:
174
+ """Pre-rpc interceptor for get_location
175
+
176
+ Override in a subclass to manipulate the request or metadata
177
+ before they are sent to the LlmUtilityService server.
178
+ """
179
+ return request, metadata
180
+
181
+ async def post_get_location(
182
+ self, response: locations_pb2.Location
183
+ ) -> locations_pb2.Location:
184
+ """Post-rpc interceptor for get_location
185
+
186
+ Override in a subclass to manipulate the response
187
+ after it is returned by the LlmUtilityService server but before
188
+ it is returned to user code.
189
+ """
190
+ return response
191
+
192
+ async def pre_list_locations(
193
+ self,
194
+ request: locations_pb2.ListLocationsRequest,
195
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
196
+ ) -> Tuple[
197
+ locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
198
+ ]:
199
+ """Pre-rpc interceptor for list_locations
200
+
201
+ Override in a subclass to manipulate the request or metadata
202
+ before they are sent to the LlmUtilityService server.
203
+ """
204
+ return request, metadata
205
+
206
+ async def post_list_locations(
207
+ self, response: locations_pb2.ListLocationsResponse
208
+ ) -> locations_pb2.ListLocationsResponse:
209
+ """Post-rpc interceptor for list_locations
210
+
211
+ Override in a subclass to manipulate the response
212
+ after it is returned by the LlmUtilityService server but before
213
+ it is returned to user code.
214
+ """
215
+ return response
216
+
217
+ async def pre_get_iam_policy(
218
+ self,
219
+ request: iam_policy_pb2.GetIamPolicyRequest,
220
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
221
+ ) -> Tuple[
222
+ iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
223
+ ]:
224
+ """Pre-rpc interceptor for get_iam_policy
225
+
226
+ Override in a subclass to manipulate the request or metadata
227
+ before they are sent to the LlmUtilityService server.
228
+ """
229
+ return request, metadata
230
+
231
+ async def post_get_iam_policy(
232
+ self, response: policy_pb2.Policy
233
+ ) -> policy_pb2.Policy:
234
+ """Post-rpc interceptor for get_iam_policy
235
+
236
+ Override in a subclass to manipulate the response
237
+ after it is returned by the LlmUtilityService server but before
238
+ it is returned to user code.
239
+ """
240
+ return response
241
+
242
+ async def pre_set_iam_policy(
243
+ self,
244
+ request: iam_policy_pb2.SetIamPolicyRequest,
245
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
246
+ ) -> Tuple[
247
+ iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
248
+ ]:
249
+ """Pre-rpc interceptor for set_iam_policy
250
+
251
+ Override in a subclass to manipulate the request or metadata
252
+ before they are sent to the LlmUtilityService server.
253
+ """
254
+ return request, metadata
255
+
256
+ async def post_set_iam_policy(
257
+ self, response: policy_pb2.Policy
258
+ ) -> policy_pb2.Policy:
259
+ """Post-rpc interceptor for set_iam_policy
260
+
261
+ Override in a subclass to manipulate the response
262
+ after it is returned by the LlmUtilityService server but before
263
+ it is returned to user code.
264
+ """
265
+ return response
266
+
267
+ async def pre_test_iam_permissions(
268
+ self,
269
+ request: iam_policy_pb2.TestIamPermissionsRequest,
270
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
271
+ ) -> Tuple[
272
+ iam_policy_pb2.TestIamPermissionsRequest,
273
+ Sequence[Tuple[str, Union[str, bytes]]],
274
+ ]:
275
+ """Pre-rpc interceptor for test_iam_permissions
276
+
277
+ Override in a subclass to manipulate the request or metadata
278
+ before they are sent to the LlmUtilityService server.
279
+ """
280
+ return request, metadata
281
+
282
+ async def post_test_iam_permissions(
283
+ self, response: iam_policy_pb2.TestIamPermissionsResponse
284
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
285
+ """Post-rpc interceptor for test_iam_permissions
286
+
287
+ Override in a subclass to manipulate the response
288
+ after it is returned by the LlmUtilityService server but before
289
+ it is returned to user code.
290
+ """
291
+ return response
292
+
293
+ async def pre_cancel_operation(
294
+ self,
295
+ request: operations_pb2.CancelOperationRequest,
296
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
297
+ ) -> Tuple[
298
+ operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
299
+ ]:
300
+ """Pre-rpc interceptor for cancel_operation
301
+
302
+ Override in a subclass to manipulate the request or metadata
303
+ before they are sent to the LlmUtilityService server.
304
+ """
305
+ return request, metadata
306
+
307
+ async def post_cancel_operation(self, response: None) -> None:
308
+ """Post-rpc interceptor for cancel_operation
309
+
310
+ Override in a subclass to manipulate the response
311
+ after it is returned by the LlmUtilityService server but before
312
+ it is returned to user code.
313
+ """
314
+ return response
315
+
316
+ async def pre_delete_operation(
317
+ self,
318
+ request: operations_pb2.DeleteOperationRequest,
319
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
320
+ ) -> Tuple[
321
+ operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
322
+ ]:
323
+ """Pre-rpc interceptor for delete_operation
324
+
325
+ Override in a subclass to manipulate the request or metadata
326
+ before they are sent to the LlmUtilityService server.
327
+ """
328
+ return request, metadata
329
+
330
+ async def post_delete_operation(self, response: None) -> None:
331
+ """Post-rpc interceptor for delete_operation
332
+
333
+ Override in a subclass to manipulate the response
334
+ after it is returned by the LlmUtilityService server but before
335
+ it is returned to user code.
336
+ """
337
+ return response
338
+
339
+ async def pre_get_operation(
340
+ self,
341
+ request: operations_pb2.GetOperationRequest,
342
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
343
+ ) -> Tuple[
344
+ operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
345
+ ]:
346
+ """Pre-rpc interceptor for get_operation
347
+
348
+ Override in a subclass to manipulate the request or metadata
349
+ before they are sent to the LlmUtilityService server.
350
+ """
351
+ return request, metadata
352
+
353
+ async def post_get_operation(
354
+ self, response: operations_pb2.Operation
355
+ ) -> operations_pb2.Operation:
356
+ """Post-rpc interceptor for get_operation
357
+
358
+ Override in a subclass to manipulate the response
359
+ after it is returned by the LlmUtilityService server but before
360
+ it is returned to user code.
361
+ """
362
+ return response
363
+
364
+ async def pre_list_operations(
365
+ self,
366
+ request: operations_pb2.ListOperationsRequest,
367
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
368
+ ) -> Tuple[
369
+ operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
370
+ ]:
371
+ """Pre-rpc interceptor for list_operations
372
+
373
+ Override in a subclass to manipulate the request or metadata
374
+ before they are sent to the LlmUtilityService server.
375
+ """
376
+ return request, metadata
377
+
378
+ async def post_list_operations(
379
+ self, response: operations_pb2.ListOperationsResponse
380
+ ) -> operations_pb2.ListOperationsResponse:
381
+ """Post-rpc interceptor for list_operations
382
+
383
+ Override in a subclass to manipulate the response
384
+ after it is returned by the LlmUtilityService server but before
385
+ it is returned to user code.
386
+ """
387
+ return response
388
+
389
+ async def pre_wait_operation(
390
+ self,
391
+ request: operations_pb2.WaitOperationRequest,
392
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
393
+ ) -> Tuple[
394
+ operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
395
+ ]:
396
+ """Pre-rpc interceptor for wait_operation
397
+
398
+ Override in a subclass to manipulate the request or metadata
399
+ before they are sent to the LlmUtilityService server.
400
+ """
401
+ return request, metadata
402
+
403
+ async def post_wait_operation(
404
+ self, response: operations_pb2.Operation
405
+ ) -> operations_pb2.Operation:
406
+ """Post-rpc interceptor for wait_operation
407
+
408
+ Override in a subclass to manipulate the response
409
+ after it is returned by the LlmUtilityService server but before
410
+ it is returned to user code.
411
+ """
412
+ return response
413
+
414
+
415
+ @dataclasses.dataclass
416
+ class AsyncLlmUtilityServiceRestStub:
417
+ _session: AsyncAuthorizedSession
418
+ _host: str
419
+ _interceptor: AsyncLlmUtilityServiceRestInterceptor
420
+
421
+
422
+ class AsyncLlmUtilityServiceRestTransport(_BaseLlmUtilityServiceRestTransport):
423
+ """Asynchronous REST backend transport for LlmUtilityService.
424
+
425
+ Service for LLM related utility functions.
426
+
427
+ This class defines the same methods as the primary client, so the
428
+ primary client can load the underlying transport implementation
429
+ and call it.
430
+
431
+ It sends JSON representations of protocol buffers over HTTP/1.1
432
+ """
433
+
434
+ def __init__(
435
+ self,
436
+ *,
437
+ host: str = "aiplatform.googleapis.com",
438
+ credentials: Optional[ga_credentials_async.Credentials] = None,
439
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
440
+ url_scheme: str = "https",
441
+ interceptor: Optional[AsyncLlmUtilityServiceRestInterceptor] = None,
442
+ ) -> None:
443
+ """Instantiate the transport.
444
+
445
+ Args:
446
+ host (Optional[str]):
447
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
448
+ credentials (Optional[google.auth.aio.credentials.Credentials]): The
449
+ authorization credentials to attach to requests. These
450
+ credentials identify the application to the service; if none
451
+ are specified, the client will attempt to ascertain the
452
+ credentials from the environment.
453
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
454
+ The client info used to send a user-agent string along with
455
+ API requests. If ``None``, then default info will be used.
456
+ Generally, you only need to set this if you are developing
457
+ your own client library.
458
+ url_scheme (str): the protocol scheme for the API endpoint. Normally
459
+ "https", but for testing or local servers,
460
+ "http" can be specified.
461
+ """
462
+ # Run the base constructor
463
+ super().__init__(
464
+ host=host,
465
+ credentials=credentials,
466
+ client_info=client_info,
467
+ always_use_jwt_access=False,
468
+ url_scheme=url_scheme,
469
+ api_audience=None,
470
+ )
471
+ self._session = AsyncAuthorizedSession(self._credentials) # type: ignore
472
+ self._interceptor = interceptor or AsyncLlmUtilityServiceRestInterceptor()
473
+ self._wrap_with_kind = True
474
+ self._prep_wrapped_messages(client_info)
475
+
476
+ def _prep_wrapped_messages(self, client_info):
477
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
478
+ self._wrapped_methods = {
479
+ self.compute_tokens: self._wrap_method(
480
+ self.compute_tokens,
481
+ default_timeout=None,
482
+ client_info=client_info,
483
+ ),
484
+ self.get_location: self._wrap_method(
485
+ self.get_location,
486
+ default_timeout=None,
487
+ client_info=client_info,
488
+ ),
489
+ self.list_locations: self._wrap_method(
490
+ self.list_locations,
491
+ default_timeout=None,
492
+ client_info=client_info,
493
+ ),
494
+ self.get_iam_policy: self._wrap_method(
495
+ self.get_iam_policy,
496
+ default_timeout=None,
497
+ client_info=client_info,
498
+ ),
499
+ self.set_iam_policy: self._wrap_method(
500
+ self.set_iam_policy,
501
+ default_timeout=None,
502
+ client_info=client_info,
503
+ ),
504
+ self.test_iam_permissions: self._wrap_method(
505
+ self.test_iam_permissions,
506
+ default_timeout=None,
507
+ client_info=client_info,
508
+ ),
509
+ self.cancel_operation: self._wrap_method(
510
+ self.cancel_operation,
511
+ default_timeout=None,
512
+ client_info=client_info,
513
+ ),
514
+ self.delete_operation: self._wrap_method(
515
+ self.delete_operation,
516
+ default_timeout=None,
517
+ client_info=client_info,
518
+ ),
519
+ self.get_operation: self._wrap_method(
520
+ self.get_operation,
521
+ default_timeout=None,
522
+ client_info=client_info,
523
+ ),
524
+ self.list_operations: self._wrap_method(
525
+ self.list_operations,
526
+ default_timeout=None,
527
+ client_info=client_info,
528
+ ),
529
+ self.wait_operation: self._wrap_method(
530
+ self.wait_operation,
531
+ default_timeout=None,
532
+ client_info=client_info,
533
+ ),
534
+ }
535
+
536
+ def _wrap_method(self, func, *args, **kwargs):
537
+ if self._wrap_with_kind: # pragma: NO COVER
538
+ kwargs["kind"] = self.kind
539
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
540
+
541
+ class _ComputeTokens(
542
+ _BaseLlmUtilityServiceRestTransport._BaseComputeTokens,
543
+ AsyncLlmUtilityServiceRestStub,
544
+ ):
545
+ def __hash__(self):
546
+ return hash("AsyncLlmUtilityServiceRestTransport.ComputeTokens")
547
+
548
+ @staticmethod
549
+ async def _get_response(
550
+ host,
551
+ metadata,
552
+ query_params,
553
+ session,
554
+ timeout,
555
+ transcoded_request,
556
+ body=None,
557
+ ):
558
+
559
+ uri = transcoded_request["uri"]
560
+ method = transcoded_request["method"]
561
+ headers = dict(metadata)
562
+ headers["Content-Type"] = "application/json"
563
+ response = await getattr(session, method)(
564
+ "{host}{uri}".format(host=host, uri=uri),
565
+ timeout=timeout,
566
+ headers=headers,
567
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
568
+ data=body,
569
+ )
570
+ return response
571
+
572
+ async def __call__(
573
+ self,
574
+ request: llm_utility_service.ComputeTokensRequest,
575
+ *,
576
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
577
+ timeout: Optional[float] = None,
578
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
579
+ ) -> llm_utility_service.ComputeTokensResponse:
580
+ r"""Call the compute tokens method over HTTP.
581
+
582
+ Args:
583
+ request (~.llm_utility_service.ComputeTokensRequest):
584
+ The request object. Request message for ComputeTokens RPC
585
+ call.
586
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
587
+ should be retried.
588
+ timeout (float): The timeout for this request.
589
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
590
+ sent along with the request as metadata. Normally, each value must be of type `str`,
591
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
592
+ be of type `bytes`.
593
+
594
+ Returns:
595
+ ~.llm_utility_service.ComputeTokensResponse:
596
+ Response message for ComputeTokens
597
+ RPC call.
598
+
599
+ """
600
+
601
+ http_options = (
602
+ _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options()
603
+ )
604
+
605
+ request, metadata = await self._interceptor.pre_compute_tokens(
606
+ request, metadata
607
+ )
608
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_transcoded_request(
609
+ http_options, request
610
+ )
611
+
612
+ body = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_request_body_json(
613
+ transcoded_request
614
+ )
615
+
616
+ # Jsonify the query params
617
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_query_params_json(
618
+ transcoded_request
619
+ )
620
+
621
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
622
+ logging.DEBUG
623
+ ): # pragma: NO COVER
624
+ request_url = "{host}{uri}".format(
625
+ host=self._host, uri=transcoded_request["uri"]
626
+ )
627
+ method = transcoded_request["method"]
628
+ try:
629
+ request_payload = type(request).to_json(request)
630
+ except:
631
+ request_payload = None
632
+ http_request = {
633
+ "payload": request_payload,
634
+ "requestMethod": method,
635
+ "requestUrl": request_url,
636
+ "headers": dict(metadata),
637
+ }
638
+ _LOGGER.debug(
639
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ComputeTokens",
640
+ extra={
641
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
642
+ "rpcName": "ComputeTokens",
643
+ "httpRequest": http_request,
644
+ "metadata": http_request["headers"],
645
+ },
646
+ )
647
+
648
+ # Send the request
649
+ response = (
650
+ await AsyncLlmUtilityServiceRestTransport._ComputeTokens._get_response(
651
+ self._host,
652
+ metadata,
653
+ query_params,
654
+ self._session,
655
+ timeout,
656
+ transcoded_request,
657
+ body,
658
+ )
659
+ )
660
+
661
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
662
+ # subclass.
663
+ if response.status_code >= 400:
664
+ content = await response.read()
665
+ payload = json.loads(content.decode("utf-8"))
666
+ request_url = "{host}{uri}".format(
667
+ host=self._host, uri=transcoded_request["uri"]
668
+ )
669
+ method = transcoded_request["method"]
670
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
671
+
672
+ # Return the response
673
+ resp = llm_utility_service.ComputeTokensResponse()
674
+ pb_resp = llm_utility_service.ComputeTokensResponse.pb(resp)
675
+ content = await response.read()
676
+ json_format.Parse(content, pb_resp, ignore_unknown_fields=True)
677
+ resp = await self._interceptor.post_compute_tokens(resp)
678
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
679
+ resp, _ = await self._interceptor.post_compute_tokens_with_metadata(
680
+ resp, response_metadata
681
+ )
682
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
683
+ logging.DEBUG
684
+ ): # pragma: NO COVER
685
+ try:
686
+ response_payload = (
687
+ llm_utility_service.ComputeTokensResponse.to_json(response)
688
+ )
689
+ except:
690
+ response_payload = None
691
+ http_response = {
692
+ "payload": response_payload,
693
+ "headers": dict(response.headers),
694
+ "status": "OK", # need to obtain this properly
695
+ }
696
+ _LOGGER.debug(
697
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.compute_tokens",
698
+ extra={
699
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
700
+ "rpcName": "ComputeTokens",
701
+ "metadata": http_response["headers"],
702
+ "httpResponse": http_response,
703
+ },
704
+ )
705
+
706
+ return resp
707
+
708
+ @property
709
+ def compute_tokens(
710
+ self,
711
+ ) -> Callable[
712
+ [llm_utility_service.ComputeTokensRequest],
713
+ llm_utility_service.ComputeTokensResponse,
714
+ ]:
715
+ return self._ComputeTokens(self._session, self._host, self._interceptor) # type: ignore
716
+
717
+ @property
718
+ def get_location(self):
719
+ return self._GetLocation(self._session, self._host, self._interceptor) # type: ignore
720
+
721
+ class _GetLocation(
722
+ _BaseLlmUtilityServiceRestTransport._BaseGetLocation,
723
+ AsyncLlmUtilityServiceRestStub,
724
+ ):
725
+ def __hash__(self):
726
+ return hash("AsyncLlmUtilityServiceRestTransport.GetLocation")
727
+
728
+ @staticmethod
729
+ async def _get_response(
730
+ host,
731
+ metadata,
732
+ query_params,
733
+ session,
734
+ timeout,
735
+ transcoded_request,
736
+ body=None,
737
+ ):
738
+
739
+ uri = transcoded_request["uri"]
740
+ method = transcoded_request["method"]
741
+ headers = dict(metadata)
742
+ headers["Content-Type"] = "application/json"
743
+ response = await getattr(session, method)(
744
+ "{host}{uri}".format(host=host, uri=uri),
745
+ timeout=timeout,
746
+ headers=headers,
747
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
748
+ )
749
+ return response
750
+
751
+ async def __call__(
752
+ self,
753
+ request: locations_pb2.GetLocationRequest,
754
+ *,
755
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
756
+ timeout: Optional[float] = None,
757
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
758
+ ) -> locations_pb2.Location:
759
+ r"""Call the get location method over HTTP.
760
+
761
+ Args:
762
+ request (locations_pb2.GetLocationRequest):
763
+ The request object for GetLocation method.
764
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
765
+ should be retried.
766
+ timeout (float): The timeout for this request.
767
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
768
+ sent along with the request as metadata. Normally, each value must be of type `str`,
769
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
770
+ be of type `bytes`.
771
+
772
+ Returns:
773
+ locations_pb2.Location: Response from GetLocation method.
774
+ """
775
+
776
+ http_options = (
777
+ _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options()
778
+ )
779
+
780
+ request, metadata = await self._interceptor.pre_get_location(
781
+ request, metadata
782
+ )
783
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_transcoded_request(
784
+ http_options, request
785
+ )
786
+
787
+ # Jsonify the query params
788
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_query_params_json(
789
+ transcoded_request
790
+ )
791
+
792
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
793
+ logging.DEBUG
794
+ ): # pragma: NO COVER
795
+ request_url = "{host}{uri}".format(
796
+ host=self._host, uri=transcoded_request["uri"]
797
+ )
798
+ method = transcoded_request["method"]
799
+ try:
800
+ request_payload = json_format.MessageToJson(request)
801
+ except:
802
+ request_payload = None
803
+ http_request = {
804
+ "payload": request_payload,
805
+ "requestMethod": method,
806
+ "requestUrl": request_url,
807
+ "headers": dict(metadata),
808
+ }
809
+ _LOGGER.debug(
810
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetLocation",
811
+ extra={
812
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
813
+ "rpcName": "GetLocation",
814
+ "httpRequest": http_request,
815
+ "metadata": http_request["headers"],
816
+ },
817
+ )
818
+
819
+ # Send the request
820
+ response = (
821
+ await AsyncLlmUtilityServiceRestTransport._GetLocation._get_response(
822
+ self._host,
823
+ metadata,
824
+ query_params,
825
+ self._session,
826
+ timeout,
827
+ transcoded_request,
828
+ )
829
+ )
830
+
831
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
832
+ # subclass.
833
+ if response.status_code >= 400:
834
+ content = await response.read()
835
+ payload = json.loads(content.decode("utf-8"))
836
+ request_url = "{host}{uri}".format(
837
+ host=self._host, uri=transcoded_request["uri"]
838
+ )
839
+ method = transcoded_request["method"]
840
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
841
+
842
+ content = await response.read()
843
+ resp = locations_pb2.Location()
844
+ resp = json_format.Parse(content, resp)
845
+ resp = await self._interceptor.post_get_location(resp)
846
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
847
+ logging.DEBUG
848
+ ): # pragma: NO COVER
849
+ try:
850
+ response_payload = json_format.MessageToJson(resp)
851
+ except:
852
+ response_payload = None
853
+ http_response = {
854
+ "payload": response_payload,
855
+ "headers": dict(response.headers),
856
+ "status": response.status_code,
857
+ }
858
+ _LOGGER.debug(
859
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetLocation",
860
+ extra={
861
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
862
+ "rpcName": "GetLocation",
863
+ "httpResponse": http_response,
864
+ "metadata": http_response["headers"],
865
+ },
866
+ )
867
+ return resp
868
+
869
+ @property
870
+ def list_locations(self):
871
+ return self._ListLocations(self._session, self._host, self._interceptor) # type: ignore
872
+
873
+ class _ListLocations(
874
+ _BaseLlmUtilityServiceRestTransport._BaseListLocations,
875
+ AsyncLlmUtilityServiceRestStub,
876
+ ):
877
+ def __hash__(self):
878
+ return hash("AsyncLlmUtilityServiceRestTransport.ListLocations")
879
+
880
+ @staticmethod
881
+ async def _get_response(
882
+ host,
883
+ metadata,
884
+ query_params,
885
+ session,
886
+ timeout,
887
+ transcoded_request,
888
+ body=None,
889
+ ):
890
+
891
+ uri = transcoded_request["uri"]
892
+ method = transcoded_request["method"]
893
+ headers = dict(metadata)
894
+ headers["Content-Type"] = "application/json"
895
+ response = await getattr(session, method)(
896
+ "{host}{uri}".format(host=host, uri=uri),
897
+ timeout=timeout,
898
+ headers=headers,
899
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
900
+ )
901
+ return response
902
+
903
+ async def __call__(
904
+ self,
905
+ request: locations_pb2.ListLocationsRequest,
906
+ *,
907
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
908
+ timeout: Optional[float] = None,
909
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
910
+ ) -> locations_pb2.ListLocationsResponse:
911
+ r"""Call the list locations method over HTTP.
912
+
913
+ Args:
914
+ request (locations_pb2.ListLocationsRequest):
915
+ The request object for ListLocations method.
916
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
917
+ should be retried.
918
+ timeout (float): The timeout for this request.
919
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
920
+ sent along with the request as metadata. Normally, each value must be of type `str`,
921
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
922
+ be of type `bytes`.
923
+
924
+ Returns:
925
+ locations_pb2.ListLocationsResponse: Response from ListLocations method.
926
+ """
927
+
928
+ http_options = (
929
+ _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options()
930
+ )
931
+
932
+ request, metadata = await self._interceptor.pre_list_locations(
933
+ request, metadata
934
+ )
935
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_transcoded_request(
936
+ http_options, request
937
+ )
938
+
939
+ # Jsonify the query params
940
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_query_params_json(
941
+ transcoded_request
942
+ )
943
+
944
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
945
+ logging.DEBUG
946
+ ): # pragma: NO COVER
947
+ request_url = "{host}{uri}".format(
948
+ host=self._host, uri=transcoded_request["uri"]
949
+ )
950
+ method = transcoded_request["method"]
951
+ try:
952
+ request_payload = json_format.MessageToJson(request)
953
+ except:
954
+ request_payload = None
955
+ http_request = {
956
+ "payload": request_payload,
957
+ "requestMethod": method,
958
+ "requestUrl": request_url,
959
+ "headers": dict(metadata),
960
+ }
961
+ _LOGGER.debug(
962
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ListLocations",
963
+ extra={
964
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
965
+ "rpcName": "ListLocations",
966
+ "httpRequest": http_request,
967
+ "metadata": http_request["headers"],
968
+ },
969
+ )
970
+
971
+ # Send the request
972
+ response = (
973
+ await AsyncLlmUtilityServiceRestTransport._ListLocations._get_response(
974
+ self._host,
975
+ metadata,
976
+ query_params,
977
+ self._session,
978
+ timeout,
979
+ transcoded_request,
980
+ )
981
+ )
982
+
983
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
984
+ # subclass.
985
+ if response.status_code >= 400:
986
+ content = await response.read()
987
+ payload = json.loads(content.decode("utf-8"))
988
+ request_url = "{host}{uri}".format(
989
+ host=self._host, uri=transcoded_request["uri"]
990
+ )
991
+ method = transcoded_request["method"]
992
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
993
+
994
+ content = await response.read()
995
+ resp = locations_pb2.ListLocationsResponse()
996
+ resp = json_format.Parse(content, resp)
997
+ resp = await self._interceptor.post_list_locations(resp)
998
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
999
+ logging.DEBUG
1000
+ ): # pragma: NO COVER
1001
+ try:
1002
+ response_payload = json_format.MessageToJson(resp)
1003
+ except:
1004
+ response_payload = None
1005
+ http_response = {
1006
+ "payload": response_payload,
1007
+ "headers": dict(response.headers),
1008
+ "status": response.status_code,
1009
+ }
1010
+ _LOGGER.debug(
1011
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListLocations",
1012
+ extra={
1013
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1014
+ "rpcName": "ListLocations",
1015
+ "httpResponse": http_response,
1016
+ "metadata": http_response["headers"],
1017
+ },
1018
+ )
1019
+ return resp
1020
+
1021
+ @property
1022
+ def get_iam_policy(self):
1023
+ return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
1024
+
1025
+ class _GetIamPolicy(
1026
+ _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy,
1027
+ AsyncLlmUtilityServiceRestStub,
1028
+ ):
1029
+ def __hash__(self):
1030
+ return hash("AsyncLlmUtilityServiceRestTransport.GetIamPolicy")
1031
+
1032
+ @staticmethod
1033
+ async def _get_response(
1034
+ host,
1035
+ metadata,
1036
+ query_params,
1037
+ session,
1038
+ timeout,
1039
+ transcoded_request,
1040
+ body=None,
1041
+ ):
1042
+
1043
+ uri = transcoded_request["uri"]
1044
+ method = transcoded_request["method"]
1045
+ headers = dict(metadata)
1046
+ headers["Content-Type"] = "application/json"
1047
+ response = await getattr(session, method)(
1048
+ "{host}{uri}".format(host=host, uri=uri),
1049
+ timeout=timeout,
1050
+ headers=headers,
1051
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1052
+ data=body,
1053
+ )
1054
+ return response
1055
+
1056
+ async def __call__(
1057
+ self,
1058
+ request: iam_policy_pb2.GetIamPolicyRequest,
1059
+ *,
1060
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1061
+ timeout: Optional[float] = None,
1062
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1063
+ ) -> policy_pb2.Policy:
1064
+ r"""Call the get iam policy method over HTTP.
1065
+
1066
+ Args:
1067
+ request (iam_policy_pb2.GetIamPolicyRequest):
1068
+ The request object for GetIamPolicy method.
1069
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1070
+ should be retried.
1071
+ timeout (float): The timeout for this request.
1072
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1073
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1074
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1075
+ be of type `bytes`.
1076
+
1077
+ Returns:
1078
+ policy_pb2.Policy: Response from GetIamPolicy method.
1079
+ """
1080
+
1081
+ http_options = (
1082
+ _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options()
1083
+ )
1084
+
1085
+ request, metadata = await self._interceptor.pre_get_iam_policy(
1086
+ request, metadata
1087
+ )
1088
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_transcoded_request(
1089
+ http_options, request
1090
+ )
1091
+
1092
+ body = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_request_body_json(
1093
+ transcoded_request
1094
+ )
1095
+
1096
+ # Jsonify the query params
1097
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_query_params_json(
1098
+ transcoded_request
1099
+ )
1100
+
1101
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1102
+ logging.DEBUG
1103
+ ): # pragma: NO COVER
1104
+ request_url = "{host}{uri}".format(
1105
+ host=self._host, uri=transcoded_request["uri"]
1106
+ )
1107
+ method = transcoded_request["method"]
1108
+ try:
1109
+ request_payload = json_format.MessageToJson(request)
1110
+ except:
1111
+ request_payload = None
1112
+ http_request = {
1113
+ "payload": request_payload,
1114
+ "requestMethod": method,
1115
+ "requestUrl": request_url,
1116
+ "headers": dict(metadata),
1117
+ }
1118
+ _LOGGER.debug(
1119
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetIamPolicy",
1120
+ extra={
1121
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1122
+ "rpcName": "GetIamPolicy",
1123
+ "httpRequest": http_request,
1124
+ "metadata": http_request["headers"],
1125
+ },
1126
+ )
1127
+
1128
+ # Send the request
1129
+ response = (
1130
+ await AsyncLlmUtilityServiceRestTransport._GetIamPolicy._get_response(
1131
+ self._host,
1132
+ metadata,
1133
+ query_params,
1134
+ self._session,
1135
+ timeout,
1136
+ transcoded_request,
1137
+ body,
1138
+ )
1139
+ )
1140
+
1141
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1142
+ # subclass.
1143
+ if response.status_code >= 400:
1144
+ content = await response.read()
1145
+ payload = json.loads(content.decode("utf-8"))
1146
+ request_url = "{host}{uri}".format(
1147
+ host=self._host, uri=transcoded_request["uri"]
1148
+ )
1149
+ method = transcoded_request["method"]
1150
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1151
+
1152
+ content = await response.read()
1153
+ resp = policy_pb2.Policy()
1154
+ resp = json_format.Parse(content, resp)
1155
+ resp = await self._interceptor.post_get_iam_policy(resp)
1156
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1157
+ logging.DEBUG
1158
+ ): # pragma: NO COVER
1159
+ try:
1160
+ response_payload = json_format.MessageToJson(resp)
1161
+ except:
1162
+ response_payload = None
1163
+ http_response = {
1164
+ "payload": response_payload,
1165
+ "headers": dict(response.headers),
1166
+ "status": response.status_code,
1167
+ }
1168
+ _LOGGER.debug(
1169
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetIamPolicy",
1170
+ extra={
1171
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1172
+ "rpcName": "GetIamPolicy",
1173
+ "httpResponse": http_response,
1174
+ "metadata": http_response["headers"],
1175
+ },
1176
+ )
1177
+ return resp
1178
+
1179
+ @property
1180
+ def set_iam_policy(self):
1181
+ return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
1182
+
1183
+ class _SetIamPolicy(
1184
+ _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy,
1185
+ AsyncLlmUtilityServiceRestStub,
1186
+ ):
1187
+ def __hash__(self):
1188
+ return hash("AsyncLlmUtilityServiceRestTransport.SetIamPolicy")
1189
+
1190
+ @staticmethod
1191
+ async def _get_response(
1192
+ host,
1193
+ metadata,
1194
+ query_params,
1195
+ session,
1196
+ timeout,
1197
+ transcoded_request,
1198
+ body=None,
1199
+ ):
1200
+
1201
+ uri = transcoded_request["uri"]
1202
+ method = transcoded_request["method"]
1203
+ headers = dict(metadata)
1204
+ headers["Content-Type"] = "application/json"
1205
+ response = await getattr(session, method)(
1206
+ "{host}{uri}".format(host=host, uri=uri),
1207
+ timeout=timeout,
1208
+ headers=headers,
1209
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1210
+ data=body,
1211
+ )
1212
+ return response
1213
+
1214
+ async def __call__(
1215
+ self,
1216
+ request: iam_policy_pb2.SetIamPolicyRequest,
1217
+ *,
1218
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1219
+ timeout: Optional[float] = None,
1220
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1221
+ ) -> policy_pb2.Policy:
1222
+ r"""Call the set iam policy method over HTTP.
1223
+
1224
+ Args:
1225
+ request (iam_policy_pb2.SetIamPolicyRequest):
1226
+ The request object for SetIamPolicy method.
1227
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1228
+ should be retried.
1229
+ timeout (float): The timeout for this request.
1230
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1231
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1232
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1233
+ be of type `bytes`.
1234
+
1235
+ Returns:
1236
+ policy_pb2.Policy: Response from SetIamPolicy method.
1237
+ """
1238
+
1239
+ http_options = (
1240
+ _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options()
1241
+ )
1242
+
1243
+ request, metadata = await self._interceptor.pre_set_iam_policy(
1244
+ request, metadata
1245
+ )
1246
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_transcoded_request(
1247
+ http_options, request
1248
+ )
1249
+
1250
+ body = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_request_body_json(
1251
+ transcoded_request
1252
+ )
1253
+
1254
+ # Jsonify the query params
1255
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_query_params_json(
1256
+ transcoded_request
1257
+ )
1258
+
1259
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1260
+ logging.DEBUG
1261
+ ): # pragma: NO COVER
1262
+ request_url = "{host}{uri}".format(
1263
+ host=self._host, uri=transcoded_request["uri"]
1264
+ )
1265
+ method = transcoded_request["method"]
1266
+ try:
1267
+ request_payload = json_format.MessageToJson(request)
1268
+ except:
1269
+ request_payload = None
1270
+ http_request = {
1271
+ "payload": request_payload,
1272
+ "requestMethod": method,
1273
+ "requestUrl": request_url,
1274
+ "headers": dict(metadata),
1275
+ }
1276
+ _LOGGER.debug(
1277
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.SetIamPolicy",
1278
+ extra={
1279
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1280
+ "rpcName": "SetIamPolicy",
1281
+ "httpRequest": http_request,
1282
+ "metadata": http_request["headers"],
1283
+ },
1284
+ )
1285
+
1286
+ # Send the request
1287
+ response = (
1288
+ await AsyncLlmUtilityServiceRestTransport._SetIamPolicy._get_response(
1289
+ self._host,
1290
+ metadata,
1291
+ query_params,
1292
+ self._session,
1293
+ timeout,
1294
+ transcoded_request,
1295
+ body,
1296
+ )
1297
+ )
1298
+
1299
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1300
+ # subclass.
1301
+ if response.status_code >= 400:
1302
+ content = await response.read()
1303
+ payload = json.loads(content.decode("utf-8"))
1304
+ request_url = "{host}{uri}".format(
1305
+ host=self._host, uri=transcoded_request["uri"]
1306
+ )
1307
+ method = transcoded_request["method"]
1308
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1309
+
1310
+ content = await response.read()
1311
+ resp = policy_pb2.Policy()
1312
+ resp = json_format.Parse(content, resp)
1313
+ resp = await self._interceptor.post_set_iam_policy(resp)
1314
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1315
+ logging.DEBUG
1316
+ ): # pragma: NO COVER
1317
+ try:
1318
+ response_payload = json_format.MessageToJson(resp)
1319
+ except:
1320
+ response_payload = None
1321
+ http_response = {
1322
+ "payload": response_payload,
1323
+ "headers": dict(response.headers),
1324
+ "status": response.status_code,
1325
+ }
1326
+ _LOGGER.debug(
1327
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.SetIamPolicy",
1328
+ extra={
1329
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1330
+ "rpcName": "SetIamPolicy",
1331
+ "httpResponse": http_response,
1332
+ "metadata": http_response["headers"],
1333
+ },
1334
+ )
1335
+ return resp
1336
+
1337
+ @property
1338
+ def test_iam_permissions(self):
1339
+ return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
1340
+
1341
+ class _TestIamPermissions(
1342
+ _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions,
1343
+ AsyncLlmUtilityServiceRestStub,
1344
+ ):
1345
+ def __hash__(self):
1346
+ return hash("AsyncLlmUtilityServiceRestTransport.TestIamPermissions")
1347
+
1348
+ @staticmethod
1349
+ async def _get_response(
1350
+ host,
1351
+ metadata,
1352
+ query_params,
1353
+ session,
1354
+ timeout,
1355
+ transcoded_request,
1356
+ body=None,
1357
+ ):
1358
+
1359
+ uri = transcoded_request["uri"]
1360
+ method = transcoded_request["method"]
1361
+ headers = dict(metadata)
1362
+ headers["Content-Type"] = "application/json"
1363
+ response = await getattr(session, method)(
1364
+ "{host}{uri}".format(host=host, uri=uri),
1365
+ timeout=timeout,
1366
+ headers=headers,
1367
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1368
+ data=body,
1369
+ )
1370
+ return response
1371
+
1372
+ async def __call__(
1373
+ self,
1374
+ request: iam_policy_pb2.TestIamPermissionsRequest,
1375
+ *,
1376
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1377
+ timeout: Optional[float] = None,
1378
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1379
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1380
+ r"""Call the test iam permissions method over HTTP.
1381
+
1382
+ Args:
1383
+ request (iam_policy_pb2.TestIamPermissionsRequest):
1384
+ The request object for TestIamPermissions method.
1385
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1386
+ should be retried.
1387
+ timeout (float): The timeout for this request.
1388
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1389
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1390
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1391
+ be of type `bytes`.
1392
+
1393
+ Returns:
1394
+ iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method.
1395
+ """
1396
+
1397
+ http_options = (
1398
+ _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options()
1399
+ )
1400
+
1401
+ request, metadata = await self._interceptor.pre_test_iam_permissions(
1402
+ request, metadata
1403
+ )
1404
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_transcoded_request(
1405
+ http_options, request
1406
+ )
1407
+
1408
+ body = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_request_body_json(
1409
+ transcoded_request
1410
+ )
1411
+
1412
+ # Jsonify the query params
1413
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_query_params_json(
1414
+ transcoded_request
1415
+ )
1416
+
1417
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1418
+ logging.DEBUG
1419
+ ): # pragma: NO COVER
1420
+ request_url = "{host}{uri}".format(
1421
+ host=self._host, uri=transcoded_request["uri"]
1422
+ )
1423
+ method = transcoded_request["method"]
1424
+ try:
1425
+ request_payload = json_format.MessageToJson(request)
1426
+ except:
1427
+ request_payload = None
1428
+ http_request = {
1429
+ "payload": request_payload,
1430
+ "requestMethod": method,
1431
+ "requestUrl": request_url,
1432
+ "headers": dict(metadata),
1433
+ }
1434
+ _LOGGER.debug(
1435
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.TestIamPermissions",
1436
+ extra={
1437
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1438
+ "rpcName": "TestIamPermissions",
1439
+ "httpRequest": http_request,
1440
+ "metadata": http_request["headers"],
1441
+ },
1442
+ )
1443
+
1444
+ # Send the request
1445
+ response = await AsyncLlmUtilityServiceRestTransport._TestIamPermissions._get_response(
1446
+ self._host,
1447
+ metadata,
1448
+ query_params,
1449
+ self._session,
1450
+ timeout,
1451
+ transcoded_request,
1452
+ body,
1453
+ )
1454
+
1455
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1456
+ # subclass.
1457
+ if response.status_code >= 400:
1458
+ content = await response.read()
1459
+ payload = json.loads(content.decode("utf-8"))
1460
+ request_url = "{host}{uri}".format(
1461
+ host=self._host, uri=transcoded_request["uri"]
1462
+ )
1463
+ method = transcoded_request["method"]
1464
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1465
+
1466
+ content = await response.read()
1467
+ resp = iam_policy_pb2.TestIamPermissionsResponse()
1468
+ resp = json_format.Parse(content, resp)
1469
+ resp = await self._interceptor.post_test_iam_permissions(resp)
1470
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1471
+ logging.DEBUG
1472
+ ): # pragma: NO COVER
1473
+ try:
1474
+ response_payload = json_format.MessageToJson(resp)
1475
+ except:
1476
+ response_payload = None
1477
+ http_response = {
1478
+ "payload": response_payload,
1479
+ "headers": dict(response.headers),
1480
+ "status": response.status_code,
1481
+ }
1482
+ _LOGGER.debug(
1483
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.TestIamPermissions",
1484
+ extra={
1485
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1486
+ "rpcName": "TestIamPermissions",
1487
+ "httpResponse": http_response,
1488
+ "metadata": http_response["headers"],
1489
+ },
1490
+ )
1491
+ return resp
1492
+
1493
+ @property
1494
+ def cancel_operation(self):
1495
+ return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
1496
+
1497
+ class _CancelOperation(
1498
+ _BaseLlmUtilityServiceRestTransport._BaseCancelOperation,
1499
+ AsyncLlmUtilityServiceRestStub,
1500
+ ):
1501
+ def __hash__(self):
1502
+ return hash("AsyncLlmUtilityServiceRestTransport.CancelOperation")
1503
+
1504
+ @staticmethod
1505
+ async def _get_response(
1506
+ host,
1507
+ metadata,
1508
+ query_params,
1509
+ session,
1510
+ timeout,
1511
+ transcoded_request,
1512
+ body=None,
1513
+ ):
1514
+
1515
+ uri = transcoded_request["uri"]
1516
+ method = transcoded_request["method"]
1517
+ headers = dict(metadata)
1518
+ headers["Content-Type"] = "application/json"
1519
+ response = await getattr(session, method)(
1520
+ "{host}{uri}".format(host=host, uri=uri),
1521
+ timeout=timeout,
1522
+ headers=headers,
1523
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1524
+ )
1525
+ return response
1526
+
1527
+ async def __call__(
1528
+ self,
1529
+ request: operations_pb2.CancelOperationRequest,
1530
+ *,
1531
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1532
+ timeout: Optional[float] = None,
1533
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1534
+ ) -> None:
1535
+ r"""Call the cancel operation method over HTTP.
1536
+
1537
+ Args:
1538
+ request (operations_pb2.CancelOperationRequest):
1539
+ The request object for CancelOperation method.
1540
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1541
+ should be retried.
1542
+ timeout (float): The timeout for this request.
1543
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1544
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1545
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1546
+ be of type `bytes`.
1547
+ """
1548
+
1549
+ http_options = (
1550
+ _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options()
1551
+ )
1552
+
1553
+ request, metadata = await self._interceptor.pre_cancel_operation(
1554
+ request, metadata
1555
+ )
1556
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_transcoded_request(
1557
+ http_options, request
1558
+ )
1559
+
1560
+ # Jsonify the query params
1561
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_query_params_json(
1562
+ transcoded_request
1563
+ )
1564
+
1565
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1566
+ logging.DEBUG
1567
+ ): # pragma: NO COVER
1568
+ request_url = "{host}{uri}".format(
1569
+ host=self._host, uri=transcoded_request["uri"]
1570
+ )
1571
+ method = transcoded_request["method"]
1572
+ try:
1573
+ request_payload = json_format.MessageToJson(request)
1574
+ except:
1575
+ request_payload = None
1576
+ http_request = {
1577
+ "payload": request_payload,
1578
+ "requestMethod": method,
1579
+ "requestUrl": request_url,
1580
+ "headers": dict(metadata),
1581
+ }
1582
+ _LOGGER.debug(
1583
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.CancelOperation",
1584
+ extra={
1585
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1586
+ "rpcName": "CancelOperation",
1587
+ "httpRequest": http_request,
1588
+ "metadata": http_request["headers"],
1589
+ },
1590
+ )
1591
+
1592
+ # Send the request
1593
+ response = await AsyncLlmUtilityServiceRestTransport._CancelOperation._get_response(
1594
+ self._host,
1595
+ metadata,
1596
+ query_params,
1597
+ self._session,
1598
+ timeout,
1599
+ transcoded_request,
1600
+ )
1601
+
1602
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1603
+ # subclass.
1604
+ if response.status_code >= 400:
1605
+ content = await response.read()
1606
+ payload = json.loads(content.decode("utf-8"))
1607
+ request_url = "{host}{uri}".format(
1608
+ host=self._host, uri=transcoded_request["uri"]
1609
+ )
1610
+ method = transcoded_request["method"]
1611
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1612
+
1613
+ return await self._interceptor.post_cancel_operation(None)
1614
+
1615
+ @property
1616
+ def delete_operation(self):
1617
+ return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore
1618
+
1619
+ class _DeleteOperation(
1620
+ _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation,
1621
+ AsyncLlmUtilityServiceRestStub,
1622
+ ):
1623
+ def __hash__(self):
1624
+ return hash("AsyncLlmUtilityServiceRestTransport.DeleteOperation")
1625
+
1626
+ @staticmethod
1627
+ async def _get_response(
1628
+ host,
1629
+ metadata,
1630
+ query_params,
1631
+ session,
1632
+ timeout,
1633
+ transcoded_request,
1634
+ body=None,
1635
+ ):
1636
+
1637
+ uri = transcoded_request["uri"]
1638
+ method = transcoded_request["method"]
1639
+ headers = dict(metadata)
1640
+ headers["Content-Type"] = "application/json"
1641
+ response = await getattr(session, method)(
1642
+ "{host}{uri}".format(host=host, uri=uri),
1643
+ timeout=timeout,
1644
+ headers=headers,
1645
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1646
+ )
1647
+ return response
1648
+
1649
+ async def __call__(
1650
+ self,
1651
+ request: operations_pb2.DeleteOperationRequest,
1652
+ *,
1653
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1654
+ timeout: Optional[float] = None,
1655
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1656
+ ) -> None:
1657
+ r"""Call the delete operation method over HTTP.
1658
+
1659
+ Args:
1660
+ request (operations_pb2.DeleteOperationRequest):
1661
+ The request object for DeleteOperation method.
1662
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1663
+ should be retried.
1664
+ timeout (float): The timeout for this request.
1665
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1666
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1667
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1668
+ be of type `bytes`.
1669
+ """
1670
+
1671
+ http_options = (
1672
+ _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options()
1673
+ )
1674
+
1675
+ request, metadata = await self._interceptor.pre_delete_operation(
1676
+ request, metadata
1677
+ )
1678
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_transcoded_request(
1679
+ http_options, request
1680
+ )
1681
+
1682
+ # Jsonify the query params
1683
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_query_params_json(
1684
+ transcoded_request
1685
+ )
1686
+
1687
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1688
+ logging.DEBUG
1689
+ ): # pragma: NO COVER
1690
+ request_url = "{host}{uri}".format(
1691
+ host=self._host, uri=transcoded_request["uri"]
1692
+ )
1693
+ method = transcoded_request["method"]
1694
+ try:
1695
+ request_payload = json_format.MessageToJson(request)
1696
+ except:
1697
+ request_payload = None
1698
+ http_request = {
1699
+ "payload": request_payload,
1700
+ "requestMethod": method,
1701
+ "requestUrl": request_url,
1702
+ "headers": dict(metadata),
1703
+ }
1704
+ _LOGGER.debug(
1705
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.DeleteOperation",
1706
+ extra={
1707
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1708
+ "rpcName": "DeleteOperation",
1709
+ "httpRequest": http_request,
1710
+ "metadata": http_request["headers"],
1711
+ },
1712
+ )
1713
+
1714
+ # Send the request
1715
+ response = await AsyncLlmUtilityServiceRestTransport._DeleteOperation._get_response(
1716
+ self._host,
1717
+ metadata,
1718
+ query_params,
1719
+ self._session,
1720
+ timeout,
1721
+ transcoded_request,
1722
+ )
1723
+
1724
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1725
+ # subclass.
1726
+ if response.status_code >= 400:
1727
+ content = await response.read()
1728
+ payload = json.loads(content.decode("utf-8"))
1729
+ request_url = "{host}{uri}".format(
1730
+ host=self._host, uri=transcoded_request["uri"]
1731
+ )
1732
+ method = transcoded_request["method"]
1733
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1734
+
1735
+ return await self._interceptor.post_delete_operation(None)
1736
+
1737
+ @property
1738
+ def get_operation(self):
1739
+ return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
1740
+
1741
+ class _GetOperation(
1742
+ _BaseLlmUtilityServiceRestTransport._BaseGetOperation,
1743
+ AsyncLlmUtilityServiceRestStub,
1744
+ ):
1745
+ def __hash__(self):
1746
+ return hash("AsyncLlmUtilityServiceRestTransport.GetOperation")
1747
+
1748
+ @staticmethod
1749
+ async def _get_response(
1750
+ host,
1751
+ metadata,
1752
+ query_params,
1753
+ session,
1754
+ timeout,
1755
+ transcoded_request,
1756
+ body=None,
1757
+ ):
1758
+
1759
+ uri = transcoded_request["uri"]
1760
+ method = transcoded_request["method"]
1761
+ headers = dict(metadata)
1762
+ headers["Content-Type"] = "application/json"
1763
+ response = await getattr(session, method)(
1764
+ "{host}{uri}".format(host=host, uri=uri),
1765
+ timeout=timeout,
1766
+ headers=headers,
1767
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1768
+ )
1769
+ return response
1770
+
1771
+ async def __call__(
1772
+ self,
1773
+ request: operations_pb2.GetOperationRequest,
1774
+ *,
1775
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1776
+ timeout: Optional[float] = None,
1777
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1778
+ ) -> operations_pb2.Operation:
1779
+ r"""Call the get operation method over HTTP.
1780
+
1781
+ Args:
1782
+ request (operations_pb2.GetOperationRequest):
1783
+ The request object for GetOperation method.
1784
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1785
+ should be retried.
1786
+ timeout (float): The timeout for this request.
1787
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1788
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1789
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1790
+ be of type `bytes`.
1791
+
1792
+ Returns:
1793
+ operations_pb2.Operation: Response from GetOperation method.
1794
+ """
1795
+
1796
+ http_options = (
1797
+ _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options()
1798
+ )
1799
+
1800
+ request, metadata = await self._interceptor.pre_get_operation(
1801
+ request, metadata
1802
+ )
1803
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_transcoded_request(
1804
+ http_options, request
1805
+ )
1806
+
1807
+ # Jsonify the query params
1808
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_query_params_json(
1809
+ transcoded_request
1810
+ )
1811
+
1812
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1813
+ logging.DEBUG
1814
+ ): # pragma: NO COVER
1815
+ request_url = "{host}{uri}".format(
1816
+ host=self._host, uri=transcoded_request["uri"]
1817
+ )
1818
+ method = transcoded_request["method"]
1819
+ try:
1820
+ request_payload = json_format.MessageToJson(request)
1821
+ except:
1822
+ request_payload = None
1823
+ http_request = {
1824
+ "payload": request_payload,
1825
+ "requestMethod": method,
1826
+ "requestUrl": request_url,
1827
+ "headers": dict(metadata),
1828
+ }
1829
+ _LOGGER.debug(
1830
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.GetOperation",
1831
+ extra={
1832
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1833
+ "rpcName": "GetOperation",
1834
+ "httpRequest": http_request,
1835
+ "metadata": http_request["headers"],
1836
+ },
1837
+ )
1838
+
1839
+ # Send the request
1840
+ response = (
1841
+ await AsyncLlmUtilityServiceRestTransport._GetOperation._get_response(
1842
+ self._host,
1843
+ metadata,
1844
+ query_params,
1845
+ self._session,
1846
+ timeout,
1847
+ transcoded_request,
1848
+ )
1849
+ )
1850
+
1851
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1852
+ # subclass.
1853
+ if response.status_code >= 400:
1854
+ content = await response.read()
1855
+ payload = json.loads(content.decode("utf-8"))
1856
+ request_url = "{host}{uri}".format(
1857
+ host=self._host, uri=transcoded_request["uri"]
1858
+ )
1859
+ method = transcoded_request["method"]
1860
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
1861
+
1862
+ content = await response.read()
1863
+ resp = operations_pb2.Operation()
1864
+ resp = json_format.Parse(content, resp)
1865
+ resp = await self._interceptor.post_get_operation(resp)
1866
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1867
+ logging.DEBUG
1868
+ ): # pragma: NO COVER
1869
+ try:
1870
+ response_payload = json_format.MessageToJson(resp)
1871
+ except:
1872
+ response_payload = None
1873
+ http_response = {
1874
+ "payload": response_payload,
1875
+ "headers": dict(response.headers),
1876
+ "status": response.status_code,
1877
+ }
1878
+ _LOGGER.debug(
1879
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetOperation",
1880
+ extra={
1881
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1882
+ "rpcName": "GetOperation",
1883
+ "httpResponse": http_response,
1884
+ "metadata": http_response["headers"],
1885
+ },
1886
+ )
1887
+ return resp
1888
+
1889
+ @property
1890
+ def list_operations(self):
1891
+ return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
1892
+
1893
+ class _ListOperations(
1894
+ _BaseLlmUtilityServiceRestTransport._BaseListOperations,
1895
+ AsyncLlmUtilityServiceRestStub,
1896
+ ):
1897
+ def __hash__(self):
1898
+ return hash("AsyncLlmUtilityServiceRestTransport.ListOperations")
1899
+
1900
+ @staticmethod
1901
+ async def _get_response(
1902
+ host,
1903
+ metadata,
1904
+ query_params,
1905
+ session,
1906
+ timeout,
1907
+ transcoded_request,
1908
+ body=None,
1909
+ ):
1910
+
1911
+ uri = transcoded_request["uri"]
1912
+ method = transcoded_request["method"]
1913
+ headers = dict(metadata)
1914
+ headers["Content-Type"] = "application/json"
1915
+ response = await getattr(session, method)(
1916
+ "{host}{uri}".format(host=host, uri=uri),
1917
+ timeout=timeout,
1918
+ headers=headers,
1919
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1920
+ )
1921
+ return response
1922
+
1923
+ async def __call__(
1924
+ self,
1925
+ request: operations_pb2.ListOperationsRequest,
1926
+ *,
1927
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1928
+ timeout: Optional[float] = None,
1929
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1930
+ ) -> operations_pb2.ListOperationsResponse:
1931
+ r"""Call the list operations method over HTTP.
1932
+
1933
+ Args:
1934
+ request (operations_pb2.ListOperationsRequest):
1935
+ The request object for ListOperations method.
1936
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1937
+ should be retried.
1938
+ timeout (float): The timeout for this request.
1939
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1940
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1941
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1942
+ be of type `bytes`.
1943
+
1944
+ Returns:
1945
+ operations_pb2.ListOperationsResponse: Response from ListOperations method.
1946
+ """
1947
+
1948
+ http_options = (
1949
+ _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options()
1950
+ )
1951
+
1952
+ request, metadata = await self._interceptor.pre_list_operations(
1953
+ request, metadata
1954
+ )
1955
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_transcoded_request(
1956
+ http_options, request
1957
+ )
1958
+
1959
+ # Jsonify the query params
1960
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_query_params_json(
1961
+ transcoded_request
1962
+ )
1963
+
1964
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1965
+ logging.DEBUG
1966
+ ): # pragma: NO COVER
1967
+ request_url = "{host}{uri}".format(
1968
+ host=self._host, uri=transcoded_request["uri"]
1969
+ )
1970
+ method = transcoded_request["method"]
1971
+ try:
1972
+ request_payload = json_format.MessageToJson(request)
1973
+ except:
1974
+ request_payload = None
1975
+ http_request = {
1976
+ "payload": request_payload,
1977
+ "requestMethod": method,
1978
+ "requestUrl": request_url,
1979
+ "headers": dict(metadata),
1980
+ }
1981
+ _LOGGER.debug(
1982
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.ListOperations",
1983
+ extra={
1984
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
1985
+ "rpcName": "ListOperations",
1986
+ "httpRequest": http_request,
1987
+ "metadata": http_request["headers"],
1988
+ },
1989
+ )
1990
+
1991
+ # Send the request
1992
+ response = (
1993
+ await AsyncLlmUtilityServiceRestTransport._ListOperations._get_response(
1994
+ self._host,
1995
+ metadata,
1996
+ query_params,
1997
+ self._session,
1998
+ timeout,
1999
+ transcoded_request,
2000
+ )
2001
+ )
2002
+
2003
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2004
+ # subclass.
2005
+ if response.status_code >= 400:
2006
+ content = await response.read()
2007
+ payload = json.loads(content.decode("utf-8"))
2008
+ request_url = "{host}{uri}".format(
2009
+ host=self._host, uri=transcoded_request["uri"]
2010
+ )
2011
+ method = transcoded_request["method"]
2012
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
2013
+
2014
+ content = await response.read()
2015
+ resp = operations_pb2.ListOperationsResponse()
2016
+ resp = json_format.Parse(content, resp)
2017
+ resp = await self._interceptor.post_list_operations(resp)
2018
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2019
+ logging.DEBUG
2020
+ ): # pragma: NO COVER
2021
+ try:
2022
+ response_payload = json_format.MessageToJson(resp)
2023
+ except:
2024
+ response_payload = None
2025
+ http_response = {
2026
+ "payload": response_payload,
2027
+ "headers": dict(response.headers),
2028
+ "status": response.status_code,
2029
+ }
2030
+ _LOGGER.debug(
2031
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListOperations",
2032
+ extra={
2033
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
2034
+ "rpcName": "ListOperations",
2035
+ "httpResponse": http_response,
2036
+ "metadata": http_response["headers"],
2037
+ },
2038
+ )
2039
+ return resp
2040
+
2041
+ @property
2042
+ def wait_operation(self):
2043
+ return self._WaitOperation(self._session, self._host, self._interceptor) # type: ignore
2044
+
2045
+ class _WaitOperation(
2046
+ _BaseLlmUtilityServiceRestTransport._BaseWaitOperation,
2047
+ AsyncLlmUtilityServiceRestStub,
2048
+ ):
2049
+ def __hash__(self):
2050
+ return hash("AsyncLlmUtilityServiceRestTransport.WaitOperation")
2051
+
2052
+ @staticmethod
2053
+ async def _get_response(
2054
+ host,
2055
+ metadata,
2056
+ query_params,
2057
+ session,
2058
+ timeout,
2059
+ transcoded_request,
2060
+ body=None,
2061
+ ):
2062
+
2063
+ uri = transcoded_request["uri"]
2064
+ method = transcoded_request["method"]
2065
+ headers = dict(metadata)
2066
+ headers["Content-Type"] = "application/json"
2067
+ response = await getattr(session, method)(
2068
+ "{host}{uri}".format(host=host, uri=uri),
2069
+ timeout=timeout,
2070
+ headers=headers,
2071
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
2072
+ )
2073
+ return response
2074
+
2075
+ async def __call__(
2076
+ self,
2077
+ request: operations_pb2.WaitOperationRequest,
2078
+ *,
2079
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2080
+ timeout: Optional[float] = None,
2081
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2082
+ ) -> operations_pb2.Operation:
2083
+ r"""Call the wait operation method over HTTP.
2084
+
2085
+ Args:
2086
+ request (operations_pb2.WaitOperationRequest):
2087
+ The request object for WaitOperation method.
2088
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2089
+ should be retried.
2090
+ timeout (float): The timeout for this request.
2091
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2092
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2093
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2094
+ be of type `bytes`.
2095
+
2096
+ Returns:
2097
+ operations_pb2.Operation: Response from WaitOperation method.
2098
+ """
2099
+
2100
+ http_options = (
2101
+ _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options()
2102
+ )
2103
+
2104
+ request, metadata = await self._interceptor.pre_wait_operation(
2105
+ request, metadata
2106
+ )
2107
+ transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_transcoded_request(
2108
+ http_options, request
2109
+ )
2110
+
2111
+ # Jsonify the query params
2112
+ query_params = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_query_params_json(
2113
+ transcoded_request
2114
+ )
2115
+
2116
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2117
+ logging.DEBUG
2118
+ ): # pragma: NO COVER
2119
+ request_url = "{host}{uri}".format(
2120
+ host=self._host, uri=transcoded_request["uri"]
2121
+ )
2122
+ method = transcoded_request["method"]
2123
+ try:
2124
+ request_payload = json_format.MessageToJson(request)
2125
+ except:
2126
+ request_payload = None
2127
+ http_request = {
2128
+ "payload": request_payload,
2129
+ "requestMethod": method,
2130
+ "requestUrl": request_url,
2131
+ "headers": dict(metadata),
2132
+ }
2133
+ _LOGGER.debug(
2134
+ f"Sending request for google.cloud.aiplatform_v1beta1.LlmUtilityServiceClient.WaitOperation",
2135
+ extra={
2136
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
2137
+ "rpcName": "WaitOperation",
2138
+ "httpRequest": http_request,
2139
+ "metadata": http_request["headers"],
2140
+ },
2141
+ )
2142
+
2143
+ # Send the request
2144
+ response = (
2145
+ await AsyncLlmUtilityServiceRestTransport._WaitOperation._get_response(
2146
+ self._host,
2147
+ metadata,
2148
+ query_params,
2149
+ self._session,
2150
+ timeout,
2151
+ transcoded_request,
2152
+ )
2153
+ )
2154
+
2155
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2156
+ # subclass.
2157
+ if response.status_code >= 400:
2158
+ content = await response.read()
2159
+ payload = json.loads(content.decode("utf-8"))
2160
+ request_url = "{host}{uri}".format(
2161
+ host=self._host, uri=transcoded_request["uri"]
2162
+ )
2163
+ method = transcoded_request["method"]
2164
+ raise core_exceptions.format_http_response_error(response, method, request_url, payload) # type: ignore
2165
+
2166
+ content = await response.read()
2167
+ resp = operations_pb2.Operation()
2168
+ resp = json_format.Parse(content, resp)
2169
+ resp = await self._interceptor.post_wait_operation(resp)
2170
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2171
+ logging.DEBUG
2172
+ ): # pragma: NO COVER
2173
+ try:
2174
+ response_payload = json_format.MessageToJson(resp)
2175
+ except:
2176
+ response_payload = None
2177
+ http_response = {
2178
+ "payload": response_payload,
2179
+ "headers": dict(response.headers),
2180
+ "status": response.status_code,
2181
+ }
2182
+ _LOGGER.debug(
2183
+ "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.WaitOperation",
2184
+ extra={
2185
+ "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService",
2186
+ "rpcName": "WaitOperation",
2187
+ "httpResponse": http_response,
2188
+ "metadata": http_response["headers"],
2189
+ },
2190
+ )
2191
+ return resp
2192
+
2193
+ @property
2194
+ def kind(self) -> str:
2195
+ return "rest_asyncio"
2196
+
2197
+ async def close(self):
2198
+ await self._session.close()