The code initializes a Vertex AI project with the specified...

December 7, 2023 at 09:25 PM

vertexai.init(project="qwiklabs-gcp-03-97054bdbf6e5", location="us-central1") chat_model = ChatModel.from_pretrained("chat-bison") parameters = { "candidate_count": 1, "max_output_tokens": 1024, "temperature": 0.2, "top_p": 0.8, "top_k": 40 } chat = chat_model.start_chat( context="""""", ) response = chat.send_message("""Hi PaLM!""", **parameters) print(f"Response from Model: {response.text}")

The code initializes a Vertex AI project with the specified project and location. It then loads a pretrained chat model called "chat-bison" using the ChatModel class. It sets some parameters for the chat, such as the candidate count, maximum output tokens, temperature, top_p, and top_k.

It starts a chat session using the chat_model and an empty context. It sends a message "Hi PaLM!" to the chat session with the specified parameters. Finally, it prints the response received from the model.

Generate your own explanations
Download our vscode extension
Read other generated explanations

Built by @thebuilderjr
Sponsored by beam analytics
Read our terms and privacy policy
Forked from openai-quickstart-node