An Overview of Google Vertex AI With Generative AI Studio
Google Vertex AI recently added a Generative AI Studio. The aim of Google Vertex AI is to allow users to build, deploy & scale machine learning (ML) models faster. Together with fully managed ML tools for any use case.
I’m currently the Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; ranging from LLMs, Chatbots, Voicebots, Development Frameworks, Data-Centric latent spaces and more.
Google’s Generative AI Studio is more advanced and structured than the OpenAI playground. I would say that the Google studio reminds of the Cohere dashboard in terms of a workspace for planning, executing and storing generative AI tasks.
Google’s efforts to add structure to prompt engineering is evident in a few ways.
There is a segregation between voice and text functions; with a fully fledged Speech Studio.
Google make various models available for selection on the top right with a clear distinction between generative and multi-turn conversation models.
A further indication of structure being introduced, is the pre-sets available. Prompt examples include chat, summarisation, classification, extraction, writing, ideation, with most having “Structured” prompt options, or Freeform. The objective of the structure, is to guide the user through the fashioning and engineering of prompt.
Generative AI support in Vertex AI gives data science teams access to foundation models from Google and others, letting them build and customise models on the same platform they use for homegrown ML models and MLOps. ~ Google
Considering the image above, notice the structure added to Google’s studio environment, with freeform or structured options top right. And in this hashtag generator example, additional columns or lines can be added for in-line comparisons.
OpenAI introduced Chat Markup Language in an effort to add structure to multi-turn conversation implementations. Together with an effort to stem prompt injection attacks to some extent.
Below is one of Google’s chat examples. Showing context, and a few dialog turns between the user and the AI which can be defined. The chat interface can be tested on the right, with the model selection and model settings.
⭐️ Please consider subscribing to my Medium ⭐️
Below the code generated via the prompt interface, notice how context is set via chat_model.start_chat
, and the dialog turns defined via examples
and InputOutputTextPair
.
!pip install google-cloud-aiplatform >= 1.25.0
from google.colab import auth as google_auth
google_auth.authenticate_user()
import vertexai
from vertexai.preview.language_models import ChatModel, InputOutputTextPair
def predict_large_language_model_sample(
project_id: str,
model_name: str,
temperature: float,
max_output_tokens: int,
top_p: float,
top_k: int,
location: str = "us-central1",
) :
"""Predict using a Large Language Model."""
vertexai.init(project=project_id, location=location)
chat_model = ChatModel.from_pretrained(model_name)
parameters = {
"temperature": temperature,
"max_output_tokens": max_output_tokens,
"top_p": top_p,
"top_k": top_k,
}
chat = chat_model.start_chat(
context='''You are a travel assistant which helps users book a trip and you give good general travel advise. ''',
examples=[
InputOutputTextPair(
input_text='''I am a single person who loves to travel the world''',
output_text='''Hi'''
),
InputOutputTextPair(
input_text='''I love to travel, can you assist me?''',
output_text='''yes, gladly, tell me where you would like to go?'''
)
]
)
response=chat.send_message('''HALLO''',**parameters)
print(response.text)
response=chat.send_message('''I would like to travel to Bosnia''',**parameters)
print(response.text)
predict_large_language_model_sample("brave-sunspot-381409", "chat-bison@001", 0.2, 256, 0.8, 40, "us-central1")
Lastly, Google makes transitioning easy from Vertex to Colab notebooks, as seen below with options to view code in Python, Python Colab or cURL.
⭐️ Please follow me on LinkedIn for updates on Conversational AI ⭐️
I’m currently the Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; ranging from LLMs, Chatbots, Voicebots, Development Frameworks, Data-Centric latent spaces and more.