Skip to content

Commit

Permalink
Merge pull request #3263 from GoogleCloudPlatform/b279595025-update
Browse files Browse the repository at this point in the history
fix(aiplatform): update model parameters and instances
  • Loading branch information
gericdong committed Jun 9, 2023
2 parents 5d14691 + 89b2d00 commit 8b6aff8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions ai-platform/snippets/predict-code-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ async function main(project, location = 'us-central1') {
// Configure the parent resource
const endpoint = `projects/${project}/locations/${location}/publishers/${publisher}/models/${model}`;

// Learn more about creating prompts to work with a code chat model at:
// https://cloud.google.com/vertex-ai/docs/generative-ai/code/code-chat-prompts
const prompt = {
messages: [
{
author: 'content',
author: 'user',
content: 'Hi, how are you?',
},
{
author: 'system',
content: 'I am doing good. What can I help you in the coding world?',
},
{
author: 'content',
author: 'user',
content:
'Please help write a function to calculate the min of two numbers',
},
Expand All @@ -67,8 +69,8 @@ async function main(project, location = 'us-central1') {
const instances = [instanceValue];

const parameter = {
temperature: 0.2,
maxOutputTokens: 256,
temperature: 0.5,
maxOutputTokens: 1024,
};
const parameters = helpers.toValue(parameter);

Expand Down
4 changes: 2 additions & 2 deletions ai-platform/snippets/predict-code-completion-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ async function main(project, location = 'us-central1') {
prefix:
'def reverse_string(s): \
return s[::-1] \
//This function',
#This function',
};
const instanceValue = helpers.toValue(prompt);
const instances = [instanceValue];

const parameter = {
temperature: 0.2,
maxOutputTokens: 256,
maxOutputTokens: 64,
};
const parameters = helpers.toValue(parameter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function main(project, location = 'us-central1') {

const parameter = {
temperature: 0.2,
maxOutputTokens: 256,
maxOutputTokens: 64,
};
const parameters = helpers.toValue(parameter);

Expand Down
2 changes: 1 addition & 1 deletion ai-platform/snippets/predict-code-generation-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function main(project, location = 'us-central1') {
const instances = [instanceValue];

const parameter = {
temperature: 0.2,
temperature: 0.5,
maxOutputTokens: 256,
};
const parameters = helpers.toValue(parameter);
Expand Down
4 changes: 2 additions & 2 deletions ai-platform/snippets/predict-code-generation-unittest.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ async function main(project, location = 'us-central1') {
const instances = [instanceValue];

const parameter = {
temperature: 0.2,
maxOutputTokens: 512,
temperature: 0.5,
maxOutputTokens: 256,
};
const parameters = helpers.toValue(parameter);

Expand Down

0 comments on commit 8b6aff8

Please sign in to comment.