GoogleCloudPlatform / python-docs-samples

Code samples used on cloud.google.com
Apache License 2.0
7.38k stars 6.4k forks source link

feat: New text Generation Samples #12543

Closed Thoughtseize1 closed 4 weeks ago

Thoughtseize1 commented 1 month ago

I noticed that some samples were missing from our repository. This PR addresses this by adding 2 new samples (listed below) and introducing an extendable test structure.

File Documentation Link Region_tag
batch_code_predict.py Get batch code predictions aiplatform_batch_code_predict
batch_text_predict.py Get batch text generations aiplatform_batch_text_predict

For proper testing, please upload the 2 files to the test environment of the test project with the .JSNOL extension and provide the paths to the model prompts in the format gs://[cloud-samples-data]/[PATH_TO_FILE].jsonl

.json example for batch_code_predict.py. Possible name: prompt_for_batch_code_predict.jsonl

{"prefix":"Write a Python function that determines if a year is a leap year:"}
{"prefix":"Write a unit test for Python code that reverses a string:"}

.json example for batch_text_predict.py. Possible name:prompt_for_batch_text_predict.jsonl

{"prompt":"Give a short description of a machine learning model:"}
{"prompt":"Best recipe for banana bread:"}

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

snippet-bot[bot] commented 1 month ago

Here is the summary of changes.

You are about to add 2 region tags. - [generative_ai/batch_predict/batch_code_predict.py:31](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/c40a84844b09e9a9c662a4db668a8643a97e6d2b/generative_ai/batch_predict/batch_code_predict.py#L31), tag `aiplatform_batch_code_predict` - [generative_ai/batch_predict/batch_text_predict.py:31](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/c40a84844b09e9a9c662a4db668a8643a97e6d2b/generative_ai/batch_predict/batch_text_predict.py#L31), tag `aiplatform_batch_text_predict`

This comment is generated by snippet-bot. If you find problems with this result, please file an issue at: https://github.com/googleapis/repo-automation-bots/issues. To update this comment, add snippet-bot:force-run label or use the checkbox below:

m-strzelczyk commented 4 weeks ago

I made the following: