File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change 16
16
from google .cloud .aiplatform import BatchPredictionJob
17
17
18
18
PROJECT_ID = os .getenv ("GOOGLE_CLOUD_PROJECT" )
19
- OUTPUT_URI = os .getenv ("GCS_OUTPUT_URI" )
20
19
21
20
22
- def embed_text_batch () -> BatchPredictionJob :
21
+ def embed_text_batch (OUTPUT_URI : str ) -> BatchPredictionJob :
23
22
"""Example of how to generate embeddings from text using batch processing.
24
23
25
24
Read more: https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings
Original file line number Diff line number Diff line change 22
22
from google .cloud import aiplatform
23
23
from google .cloud .aiplatform import initializer as aiplatform_init
24
24
25
- import pytest
26
25
27
26
import batch_example
28
27
import code_retrieval_example
35
34
36
35
37
36
@backoff .on_exception (backoff .expo , ResourceExhausted , max_time = 10 )
38
- @pytest .fixture (scope = "session" )
39
37
def test_embed_text_batch () -> None :
40
- os .environ ["GCS_OUTPUT_URI" ] = "gs://python-docs-samples-tests/"
41
- batch_prediction_job = batch_example .embed_text_batch ()
38
+ batch_prediction_job = batch_example .embed_text_batch ("gs://python-docs-samples-tests/" )
42
39
assert batch_prediction_job
43
40
44
41
You can’t perform that action at this time.
0 commit comments