Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/GoogleCloudPlatform/golang-samples
/ functions
Functions
5,023 in github.com/GoogleCloudPlatform/golang-samples
⨍
Functions
5,023
◇
Types & classes
329
↓ 1 callers
Function
findNearestDistanceDataExample
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_general.go:2068
↓ 1 callers
Function
findNearestDistanceExample
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_general.go:2087
↓ 1 callers
Function
findNearestLimitExample
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_general.go:2052
↓ 1 callers
Function
findNearestSyntaxExample
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_general.go:2036
↓ 1 callers
Function
findRegionTags
(pkgs <-chan string)
regiontag_test.go:55
↓ 1 callers
Function
float32Ptr
(v float32)
genai/bounding_box/boundingbox_with_txt_img.go:162
↓ 1 callers
Function
floorFunction
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_arithmetic.go:142
↓ 1 callers
Function
foo1
()
profiler/hotmid/main.go:76
↓ 1 callers
Function
foo1
(scale int)
profiler/hotapp/main.go:112
↓ 1 callers
Function
foo2
()
profiler/hotmid/main.go:80
↓ 1 callers
Function
foo2
(scale int)
profiler/hotapp/main.go:121
↓ 1 callers
Function
foo3
()
profiler/hotmid/main.go:84
↓ 1 callers
Function
foo4
()
profiler/hotmid/main.go:88
↓ 1 callers
Function
foo5
()
profiler/hotmid/main.go:92
↓ 1 callers
Function
foo6
()
profiler/hotmid/main.go:96
↓ 1 callers
Function
forceIndexExamples
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_general.go:1494
↓ 1 callers
Function
formatMargin
formatMargin calculates the difference between votes and returns a human friendly margin (e.g., 2 votes)
cloudsql/sqlserver/database-sql/cloudsql.go:90
↓ 1 callers
Function
formatMargin
formatMargin calculates the difference between votes and returns a human friendly margin (e.g., 2 votes)
cloudsql/postgres/database-sql/cloudsql.go:86
↓ 1 callers
Function
formatMargin
formatMargin calculates the difference between votes and returns a human friendly margin (e.g., 2 votes)
cloudsql/mysql/database-sql/cloudsql.go:86
↓ 1 callers
Function
formatTokens
(tokens [][]byte)
genai/count_tokens/counttoken_localtokenizer_compute_with_txt.go:61
↓ 1 callers
Function
functionCalling
functionCalling demonstrates how to submit a prompt and a function declaration to the model, allowing it to suggest a call to the function to fetch ex
vertexai/function-calling/functioncalling_basic.go:33
↓ 1 callers
Function
functionCallsChat
functionCallsChat opens a chat session and sends 4 messages to the model: - convert a first text question into a structured function call request - co
vertexai/function-calling/functioncalling.go:42
↓ 1 callers
Function
functionsExample
(w io.Writer, client *firestore.Client)
firestore/pipeline_snippets_array.go:234
↓ 1 callers
Function
geminiTranslate
geminiTranslate shows how translate text, using gemini
vertexai/snippets/gemini_translate.go:29
↓ 1 callers
Function
generateAudioTranscript
generateAudioTranscript shows how to generate an audio transcript.
genai/text_generation/textgen_transcript_with_gcs_audio.go:28
↓ 1 callers
Function
generateBatchEmbeddingsMock
(w io.Writer, outputURI string)
genai/batch_prediction/batchprediction_examples_test.go:60
↓ 1 callers
Function
generateBatchPredictMock
(w io.Writer, outputURI string)
genai/batch_prediction/batchprediction_examples_test.go:143
↓ 1 callers
Function
generateBatchPredictWithBQMock
(w io.Writer, outputURI string)
genai/batch_prediction/batchprediction_examples_test.go:232
↓ 1 callers
Function
generateBoundingBoxesWithText
(w io.Writer)
genai/bounding_box/boundingbox_with_txt_img.go:81
↓ 1 callers
Function
generateChatStreamWithText
generateChatStreamWithText shows how to generate chat stream using a text prompt.
genai/text_generation/textgen_with_chat_stream.go:28
↓ 1 callers
Function
generateChatWithText
generateChatWithText shows how to generate chat using a text prompt.
genai/text_generation/textgen_chat_with_txt.go:28
↓ 1 callers
Function
generateContent
(w io.Writer, projectID, modelName string)
vertexai/stream-multimodality-basic/streammultimodalitybasic.go:28
↓ 1 callers
Function
generateContent
generateContent shows how to send a basic streaming text prompt, writing the response to the provided io.Writer.
vertexai/stream-text-basic/streamtextbasic.go:30
↓ 1 callers
Function
generateContent
generateContent generates text from prompt and configurations provided.
vertexai/safety-settings/safety-settings.go:27
↓ 1 callers
Function
generateContentFromText
(w io.Writer, projectID string)
vertexai/snippets/text_input.go:26
↓ 1 callers
Function
generateContentWithThoughts
generateContentWithThoughts demonstrates how to generate text including the model's thought process.
genai/thinking/thinkgen_include_thoughts_with_txt.go:28
↓ 1 callers
Function
generateContentWithTxt
generateContentWithTxt demonstrates how to generate text with thinking model.
genai/thinking/thinking_with_txt.go:28
↓ 1 callers
Function
generateEmbedContentWithText
generateEmbedContentWithText shows how to embed content with text.
genai/embeddings/embeddings_docretrieval_with_txt.go:28
↓ 1 callers
Function
generateEncryptionKey
generateEncryptionKey generates a 256 bit (32 byte) AES encryption key and prints the base64 representation.
storage/objects/generate_encryption_key.go:27
↓ 1 callers
Function
generateExampleDefaultMessages
generateExampleMessages generates a slice of serialized protobuf messages using a statically defined and compiled protocol buffer file, and returns th
bigquery/snippets/managedwriter/bigquerystorage_append_rows_default.go:34
↓ 1 callers
Function
generateForImageTextAndVideo
generateForImageTextAndVideo shows how to use the multimodal model to generate embeddings for image, text and video data.
vertexai/embeddings/generate_for_image_text_and_video.go:35
↓ 1 callers
Function
generateForTextAndImage
generateForTextAndImage shows how to use the multimodal model to generate embeddings for text and image inputs.
vertexai/embeddings/generate_for_image_and_text.go:34
↓ 1 callers
Function
generateForVideo
generateForVideo shows how to use the multimodal model to generate embeddings for video input.
vertexai/embeddings/generate_for_video.go:34
↓ 1 callers
Function
generateGoogleMapsCoordinatesWithText
generateGoogleMapsCoordinatesWithText demonstrates using the Google Maps tool to get responses localized to specific coordinates.
genai/tools/tools_google_maps_coordinates_with_txt.go:29
↓ 1 callers
Function
generateGoogleSearchURLContextWithText
generateGoogleSearchURLContextWithText demonstrates using both the Google Search Tool and the URL Context Tool with Gemini.
genai/tools/tools_google_search_and_urlcontext_with_txt.go:29
↓ 1 callers
Function
generateGroundSearchWithTxt
generateGroundSearchWithTxt demonstrates using a live Gemini model with Google Search grounded responses.
genai/live/live_ground_googsearch_with_txt.go:28
↓ 1 callers
Function
generateImageMMFlashEditWithTextImg
generateImageMMFlashEditWithTextImg demonstrates editing an image with text and image inputs.
genai/image_generation/imggen_mmflash_edit_img_with_txt_img.go:29
↓ 1 callers
Function
generateImageWithText
generateImageWithText demonstrates how to generate an image from a text prompt.
genai/image_generation/imggen_with_txt.go:29
↓ 1 callers
Function
generateImgVirtualTryOnWithTextImg
generateImgVirtualTryOnWithTextImg demonstrates how to apply a product image to a person image.
genai/image_generation/imggen_virtual_try_on_with_txt_img.go:30
↓ 1 callers
Function
generateJWT
[START endpoints_generate_jwt_sa] generateJWT creates a signed JSON Web Token using a Google API Service Account.
endpoints/getting-started/client/main.go:63
↓ 1 callers
Function
generateLiveAudioConversationMock
Mock version of generateLiveAudioConversation
genai/live/live_examples_test.go:67
↓ 1 callers
Function
generateLiveAudioWithTextMock
(w io.Writer)
genai/live/live_examples_test.go:97
↓ 1 callers
Function
generateLiveCodeExecMock
(w io.Writer)
genai/live/live_examples_test.go:74
↓ 1 callers
Function
generateLiveFuncCallWithTxtMock
(w io.Writer)
genai/live/live_examples_test.go:27
↓ 1 callers
Function
generateLiveRAGWithTextMock
(w io.Writer, memoryCorpus string)
genai/live/live_examples_test.go:52
↓ 1 callers
Function
generateLiveTextWithAudioMock
Mock function simulating generateLiveTextWithAudio without API/WebSocket.
genai/live/live_examples_test.go:59
↓ 1 callers
Function
generateLiveTranscribeWithAudioMock
(w io.Writer)
genai/live/live_examples_test.go:80
↓ 1 callers
Function
generateLiveWithTextMock
(w io.Writer)
genai/live/live_examples_test.go:90
↓ 1 callers
Function
generateMMFlashLocaleAwareWithText
generateMMFlashLocaleAwareWithText demonstrates how to generate an image with locale awareness.
genai/image_generation/imggen_mmflash_locale_aware_with_txt.go:30
↓ 1 callers
Function
generateMMFlashMultipleImgsWithText
generateMMFlashMultipleImgsWithText demonstrates how to generate multiple images with text.
genai/image_generation/imggen_mmflash_multiple_imgs_with_txt.go:30
↓ 1 callers
Function
generateMMFlashTxtImgWithText
generateMMFlashTxtImgWithText demonstrates how to generate an illustrated recipe combining text and image outputs into a markdown file.
genai/image_generation/imggen_mmflash_txt_img_with_txt.go:31
↓ 1 callers
Function
generateMMFlashWithText
generateMMFlashWithText demonstrates how to generate both text and image outputs.
genai/image_generation/imggen_mmflash_with_txt.go:29
↓ 1 callers
Function
generateModel
generateModel creates an example BigQuery ML model.
bigquery/snippets/job/integration_test.go:226
↓ 1 callers
Function
generateModelOptimizerWithTxt
generateModelOptimizerWithTxt shows how to generate text using a text prompt and model optimizer.
genai/text_generation/textgen_model_optimizer_with_txt.go:28
↓ 1 callers
Function
generateMultimodalContent
generateMultimodalContent shows how to send video and text prompts to a model, writing the response to the provided io.Writer.
vertexai/multimodal-video-with-audio/multimodalvideoaudio.go:32
↓ 1 callers
Function
generateRandomBytes
generateRandomBytes generates random bytes with entropy sourced from the given location.
kms/generate_random_bytes.go:30
↓ 1 callers
Function
generateSignedPostPolicyV4
generateSignedPostPolicyV4 generates a signed post policy.
storage/objects/generate_signed_post_policy_v4.go:41
↓ 1 callers
Function
generateStructuredOutputWithTxtMock
(w io.Writer)
genai/live/live_examples_test.go:33
↓ 1 callers
Function
generateText
generateText shows how to generate text Provisioned Throughput.
genai/provisioned_throughput/provisionedthroughput_with_txt.go:29
↓ 1 callers
Function
generateTextAndCount
generateTextAndCount shows how to generate text and obtain token count metadata from the model response.
genai/count_tokens/counttoken_resp_with_txt.go:29
↓ 1 callers
Function
generateTextWithPDF
generateTextWithPDF shows how to generate text using a PDF file input.
genai/text_generation/textgen_with_pdf.go:28
↓ 1 callers
Function
generateTextWithSafety
generateTextWithSafety shows how to apply safety settings to a text generation request.
genai/safety/safety_with_txt.go:28
↓ 1 callers
Function
generateThinkingBudgetContentWithText
generateThinkingBudgetContentWithText demonstrates how to generate text including the model's thought process.
genai/thinking/thinking_budget_with_txt.go:28
↓ 1 callers
Function
generateThinkingWithText
generateThinkingWithText shows how to generate thinking using a text prompt.
genai/text_generation/textgen_thinking_with_txt.go:28
↓ 1 callers
Function
generateURLContentWithText
generateURLContentWithText demonstrates using the URL Context tool to compare and reason over the content of external URLs.
genai/tools/tools_urlcontext_with_txt.go:29
↓ 1 callers
Function
generateV4GetObjectSignedURL
generateV4GetObjectSignedURL generates object signed URL with GET method.
storage/objects/generate_v4_get_object_signed_url.go:28
↓ 1 callers
Function
generateV4PutObjectSignedURL
generateV4PutObjectSignedURL generates object signed URL with PUT method.
storage/objects/generate_v4_put_object_signed_url.go:28
↓ 1 callers
Function
generateVideoFromImageMock
(w io.Writer, outputGCSURI string)
genai/video_generation/video_generation_examples_test.go:70
↓ 1 callers
Function
generateVideoWithTextMock
(w io.Writer, outputGCSURI string)
genai/video_generation/video_generation_examples_test.go:155
↓ 1 callers
Function
generateWithAudio
generateWithAudio shows how to generate text using an audio input.
genai/text_generation/textgen_with_gcs_audio.go:28
↓ 1 callers
Function
generateWithClassSchema
generateWithClassSchema shows how to use class schema to generate output.
genai/controlled_generation/ctrlgen_with_class_schema.go:35
↓ 1 callers
Function
generateWithCodeExec
generateWithCodeExec shows how to generate text using the code execution tool.
genai/tools/tools_code_exec_with_txt.go:28
↓ 1 callers
Function
generateWithConfig
generateWithConfig shows how to generate text using a text prompt and custom configuration.
genai/text_generation/textgen_config_with_txt.go:28
↓ 1 callers
Function
generateWithEnumClassSchema
generateWithEnumClassSchema shows how to use a class-like enum schema to generate output.
genai/controlled_generation/ctrlgen_with_enum_class_schema.go:44
↓ 1 callers
Function
generateWithEnumSchema
generateWithEnumSchema shows how to use enum schema to generate output.
genai/controlled_generation/ctrlgen_with_enum_schema.go:28
↓ 1 callers
Function
generateWithFuncCall
generateWithFuncCall shows how to submit a prompt and a function declaration to the model, allowing it to suggest a call to the function to fetch exte
genai/tools/tools_func_desc_with_txt.go:30
↓ 1 callers
Function
generateWithGoogleSearch
generateWithGoogleSearch shows how to generate text using Google Search.
genai/tools/tools_google_search_with_txt.go:28
↓ 1 callers
Function
generateWithGoogleVAISMock
(w io.Writer, dataStore string)
genai/tools/tools_examples_test.go:43
↓ 1 callers
Function
generateWithLocalImgAndCodeExec
generateWithLocalImgAndCodeExec shows how to combine a local image, a text prompt, and enable the code execution tool in a request.
genai/tools/tools_code_exec_with_txt_local_img.go:30
↓ 1 callers
Function
generateWithLocalVideo
generateWithLocalVideo shows how to generate text using a local video input.
genai/text_generation/textgen_with_local_video.go:29
↓ 1 callers
Function
generateWithLowerDimension
generateWithLowerDimension shows how to generate lower-dimensional embeddings for text and image inputs.
vertexai/embeddings/generate_with_lower_dimension.go:33
↓ 1 callers
Function
generateWithMultiLocalImages
generateWithMultiLocalImages shows how to generate text using multiple local image inputs.
genai/text_generation/textgen_with_multi_local_img.go:29
↓ 1 callers
Function
generateWithMuteVideo
generateWithMuteVideo shows how to generate text using a video with no sound as the input.
genai/text_generation/textgen_with_mute_video.go:28
↓ 1 callers
Function
generateWithNestedClassSchema
generateWithNestedClassSchema shows how to use nested class schema to generate output.
genai/controlled_generation/ctrlgen_with_nested_class_schema.go:44
↓ 1 callers
Function
generateWithNullables
generateWithNullables shows how to use the response schema with nullable values.
genai/controlled_generation/ctrlgen_with_nullable_schema.go:28
↓ 1 callers
Function
generateWithPDF
generateWithPDF shows how to generate code using a PDF file input.
genai/text_generation/textgen_code_with_pdf.go:28
↓ 1 callers
Function
generateWithRespSchema
generateWithRespSchema shows how to use a response schema to generate output in a specific format.
genai/controlled_generation/ctrlgen_with_resp_schema.go:28
↓ 1 callers
Function
generateWithRouting
generateWithRouting shows how to generate text using a text prompt and routing configuration.
genai/text_generation/textgen_with_routing.go:28
↓ 1 callers
Function
generateWithSystem
generateWithSystem shows how to generate text using a text prompt and system instruction.
genai/text_generation/textgen_sys_instr_with_txt.go:28
↓ 1 callers
Function
generateWithText
generateWithText shows how to generate text using a text prompt.
genai/text_generation/textgen_with_txt.go:28
← previous
next →
1,601–1,700 of 5,023, ranked by callers