GoogleCloudPlatform / python-docs-samples

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

feat: Hardcoded samples to be migrated - Text Translation Samples #12531

Closed Thoughtseize1 closed 1 month ago

Thoughtseize1 commented 2 months ago

Description

4 Samples for this page:

Checklist

Thoughtseize1 commented 2 months ago

All new files without tests yet

Samples for this page

I have issues with two files that use the endpoint and predict methods, specifically when working with the Vertex AI API and translation LLM and Custom translations. Both examples are designed to use an endpoint. However, when I try to replicate the sample code, I encounter the following error: ValueError: Resource projects/PROJECT/locations/us-central1/publishers/google/models/text-translation is not a valid resource ID.

Indeed, such an endpoint does not exist, and the model is not deployed there. When I attempt to use an existing endpoint with a deployed model (for example, I used code-bison since it was already deployed on my endpoint), everything works fine.

Additionally, the existing Text Translation model has a different Model ID: publishers/google/models/text-translation. It also doesn't seem like this model ID can be used with the endpoint.

How should I proceed? Which endpoint should be used in this scenario?

Furthermore, I made an assumption and created a file translate_with_llm_example.py, where I outlined how I envision using a specific endpoint from the list with the client. Could you please advise on the correct approach?

Thoughtseize1 commented 2 months ago

🔷 First Sample with problem - translate_with_llm.py

image

🔷 Second Sample with problem - translate_with_custom translations.py

Screenshot from 2024-08-27 16-08-56

snippet-bot[bot] commented 1 month ago

Here is the summary of changes.

You are about to add 1 region tag. - [translate/samples/snippets/translate_with_gemini.py:15](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/ceffd285f1bf2ad74353c6b1dbbb382110b214dc/translate/samples/snippets/translate_with_gemini.py#L15), tag `aiplatform_gemini_translate`

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:

Thoughtseize1 commented 1 month ago

The decision was made to leave only work samples and update this documentation page.