Skip to content

fix(docs): correct example for GenerateContent using an HTTP URL#610

Open
Daquisu wants to merge 2 commits intogoogleapis:mainfrom
Daquisu:daquisu/fix-example-httpurl-vertexai
Open

fix(docs): correct example for GenerateContent using an HTTP URL#610
Daquisu wants to merge 2 commits intogoogleapis:mainfrom
Daquisu:daquisu/fix-example-httpurl-vertexai

Conversation

@Daquisu
Copy link
Copy Markdown

@Daquisu Daquisu commented Nov 15, 2025

The current example does not work. It suggests one can directly create a genai.Part from an image URL such as https://storage.googleapis.com/cloud-samples-data/generative-ai/image/scones.jpg, but it is not possible.

One workaround is to download the file and store it in-memory, so we can create a genai.Part from the bytes of a file. This is done in the example for document processing using the same Go SDK: https://ai.google.dev/gemini-api/docs/document-processing#inline_data

I created a repo to show that the current example does not work, and the new example provided by this PR works. See https://github.com/Daquisu/go-genai-example

@google-cla
Copy link
Copy Markdown

google-cla bot commented Nov 15, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Daquisu Daquisu force-pushed the daquisu/fix-example-httpurl-vertexai branch from 29c82d5 to 8520e3e Compare November 15, 2025 15:12
@Daquisu
Copy link
Copy Markdown
Author

Daquisu commented Nov 15, 2025

I just fixed the CLA issue - sorry about that

@Sivasankaran25 Sivasankaran25 self-assigned this Nov 16, 2025
@Daquisu Daquisu force-pushed the daquisu/fix-example-httpurl-vertexai branch from 8520e3e to bfe6149 Compare December 26, 2025 17:19
@Sivasankaran25 Sivasankaran25 added the api:gemini-api Issues related to Gemini API label Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:gemini-api Issues related to Gemini API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants