vertex-completion-example

command module
v0.0.0-...-3308821 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Vertex AI Completion Example

Welcome to this cheerful example of using Google's Vertex AI with LangChain Go! 🎉

This example demonstrates how to use the Vertex AI API to generate text completions using LangChain Go. It's a simple and fun way to interact with Google's powerful language models!

What This Example Does

  1. Sets Up Vertex AI: The code configures a connection to Google's Vertex AI service using your GCP project details and credentials.

  2. Creates a Language Model: It initializes a language model (LLM) using the Vertex AI service.

  3. Generates Text: The example then uses this LLM to generate an answer to the question "Who was the second person to walk on the moon?"

  4. Prints the Result: Finally, it prints the generated answer to the console.

How to Run

Before running this example, make sure you've set the following environment variables:

  • VERTEX_PROJECT: Your Google Cloud Project ID
  • VERTEX_LOCATION: The GCP location (region) for Vertex AI (e.g., "us-central1")
  • VERTEX_CREDENTIALS: Path to your GCP service account credentials JSON file

Once you've set these up, just run the Go file, and watch the magic happen! 🚀

Why It's Cool

This example showcases how easy it is to tap into advanced AI capabilities using LangChain Go and Google's Vertex AI. Whether you're building a chatbot, a question-answering system, or any other AI-powered application, this code provides a great starting point!

Happy coding, and may your AI adventures be ever exciting! 🌟

Documentation

Overview

Set the VERTEX_PROJECT env var to your GCP project with Vertex AI APIs enabled. Set VERTEX_LOCATION to a GCP location (region); if you're not sure about the location, set us-central1 Set the VERTEX_CREDENTIALS env var to the path of your GCP service account credentials JSON file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL