Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vertexai): Non-stream basic text sample #4142

Closed

Conversation

ianlewis
Copy link

@ianlewis ianlewis commented May 22, 2024

Description

Go version of the Python sample at
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/generative_ai/inference/non_stream_text_basic.py

Region tag generativeaionvertexai_non_stream_text_basic.

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@ianlewis ianlewis requested a review from a team as a code owner May 22, 2024 05:45
Copy link

snippet-bot bot commented May 22, 2024

Here is the summary of changes.

You are about to add 1 region tag.

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:

  • Refresh this comment

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label May 22, 2024
@ianlewis ianlewis force-pushed the non-stream-text-basic branch 3 times, most recently from bf1d950 to 12237b7 Compare May 22, 2024 06:17
Go version of the Python sample at
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/generative_ai/inference/non_stream_text_basic.py

Region tag `generativeaionvertexai_non_stream_text_basic`

Signed-off-by: Ian Lewis <[email protected]>
@grayside grayside self-requested a review May 24, 2024 16:38
Copy link
Contributor

@grayside grayside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sample is LGTM, but before approving I wanted to confirm we should create this sample instead of somehow reuse https://github.com/GoogleCloudPlatform/golang-samples/blob/main/vertexai/snippets/text_input.go#L16, which seems very similar. @gericdong

@Deleplace
Copy link
Contributor

We're leaning towards reusing the existing code samples, when possible

@ianlewis
Copy link
Author

This sample is LGTM, but before approving I wanted to confirm we should create this sample instead of somehow reuse https://github.com/GoogleCloudPlatform/golang-samples/blob/main/vertexai/snippets/text_input.go#L16, which seems very similar. @gericdong

I think the page contexts are a bit different, the sample on the quickstarts page looks like it should support replacing the PROJECT_ID like the Python sample does.

However, I kind of agree that the inference API samples and these quickstart samples could probably just be reused.
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#non-stream-text

@ianlewis
Copy link
Author

I do wonder about the difference in structure for the prompt passed to generateContent in the Quickstart Node.js sample and the model inference API reference Node.js sample but I based on the surrounding docs it doesn't seem germane.

I propose that we just use the quickstart samples for text-only and audio and video on the model inference page for non-streaming text and non-streaming multimodal samples.

Though I think we will need to have streaming examples on the model inference page. WDUT? @grayside @gericdong

@gericdong
Copy link
Contributor

@ianlewis I agree with your assessment. Thanks.

@ianlewis
Copy link
Author

Closing. Will submit changes to the doc to reuse the existing samples.

@ianlewis ianlewis closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants