Skip to content

Commit

Permalink
feat(vertexai): Update sample models to gemini-1.5-flash-001 (GoogleC…
Browse files Browse the repository at this point in the history
…loudPlatform#3705)

* feat(vertexai): Update sample models to gemini-1.5-flash-001

* fix: Revert model changes for grounding until feature is ready for release
  • Loading branch information
arbrown authored May 24, 2024
1 parent d271b5d commit c401daf
Show file tree
Hide file tree
Showing 34 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion generative-ai/snippets/count-tokens/countTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function countTokens(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/count-tokens/countTokensAdvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function countTokens(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.5-pro-preview-0409'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const generationConfig = {
async function functionCallingAdvanced(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-001'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const functionDeclarations = [
async function functionCallingBasic(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-001'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const functionResponseParts = [
async function functionCallingStreamChat(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const functionResponseParts = [
async function functionCallingStreamContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/gemini-text-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function generate_from_text_input(projectId = 'PROJECT_ID') {
const vertexAI = new VertexAI({project: projectId, location: 'us-central1'});

const generativeModel = vertexAI.getGenerativeModel({
model: 'gemini-1.0-pro-002',
model: 'gemini-1.5-flash-001',
});

const prompt =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function generateContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.5-pro-preview-0409'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex AI
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/inference/nonStreamTextBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function generateContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function generateContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.5-pro-preview-0409'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex AI
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/inference/streamTextBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function generateContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/nonStreamingChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function createNonStreamingChat(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/nonStreamingContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function createNonStreamingContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/safetySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
async function setSafetySettings(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-001'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/streamChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function createStreamChat(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/streamContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {VertexAI} = require('@google-cloud/vertexai');
async function createStreamContent(
projectId = 'PROJECT_ID',
location = 'us-central1',
model = 'gemini-1.0-pro-002'
model = 'gemini-1.5-flash-001'
) {
// Initialize Vertex with your Cloud project and location
const vertexAI = new VertexAI({project: projectId, location: location});
Expand Down
4 changes: 2 additions & 2 deletions generative-ai/snippets/test/count-tokens/countTokens.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Count tokens', async () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Count tokens', async () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should count tokens', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.5-pro-preview-0409';
const model = 'gemini-1.5-flash-001';

describe('Count tokens advanced', async () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Count tokens advanced', async () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should count tokens in a multimodal prompt', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-001';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Function Calling Advanced', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Function Calling Advanced', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should define multiple functions and have the model invoke the specified one', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-001';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Function Calling', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Function Calling', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should define a function and have the model invoke it', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.5-pro-preview-0409';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Function Calling Stream Chat', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Function Calling Stream Chat', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.5-pro-preview-0409';
// const model = 'gemini-1.5-flash-001';

it('should create stream chat and begin the conversation the same in each instance', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Function Calling Stream Content', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Function Calling Stream Content', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should create stream chat and begin the conversation the same in each instance', async () => {
const output = execSync(
Expand Down
4 changes: 2 additions & 2 deletions generative-ai/snippets/test/gemini-system-instruction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;

describe('Set sytem instruction', async () => {
it('should set sytem instruction', async () => {
describe('Set system instruction', async () => {
it('should set system instruction', async () => {
const output = execSync(`node ./gemini-system-instruction.js ${projectId}`);

assert(output.length > 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Private data grounding', async () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.0-pro-002';

it('should ground results in private VertexAI search data', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ describe('Google search grounding', async () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.0-pro-002';

it('should ground results in public search data', async () => {
const output = execSync(
`node ./grounding/groundingPublicDataBasic.js ${projectId} ${location} ${model}`
);
assert(output.match(/webSearchQueries.*Why is the sky blue?/));
assert(output.match(/webSearchQueries.*why is the sky blue?/));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Generative AI Multimodal Text Inference', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.5-pro-preview-0409';
// const model = 'gemini-1.5-flash-001';

it('should generate text based on a prompt containing text, a video, and an image', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Basic Text Inference', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Basic Text Inference', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should create a generative text model and infer text from a prompt', async () => {
const output = execSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.5-pro-preview-0409';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Basic Multimodal Text Inference Streaming', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Basic Multimodal Text Inference Streaming', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.5-pro-preview-0409';
// const model = 'gemini-1.5-flash-001';

it('should create a generative text model and infer text from a prompt, streaming the results', async () => {
const output = execSync(
Expand Down
4 changes: 2 additions & 2 deletions generative-ai/snippets/test/inference/streamTextBasic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Basic Text Inference Streaming', () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI Basic Text Inference Streaming', () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should create a generative text model and infer text from a prompt, streaming the results', async () => {
const output = execSync(
Expand Down
4 changes: 2 additions & 2 deletions generative-ai/snippets/test/nonStreamingChat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI NonStreaming Chat', async () => {
/**
Expand All @@ -30,7 +30,7 @@ describe('Generative AI NonStreaming Chat', async () => {
*/
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'YOUR_LOCATION';
// const model = 'gemini-1.0-pro';
// const model = 'gemini-1.5-flash-001';

it('should create nonstreaming chat and begin the conversation the same in each instance', async () => {
const output = execSync(
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/test/nonStreamingContent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI NonStreaming Content', () => {
/**
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/test/safetySettings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-001';
const model = 'gemini-1.5-flash-001';

describe('Safety settings', async () => {
/**
Expand Down
2 changes: 1 addition & 1 deletion generative-ai/snippets/test/streamChat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const projectId = process.env.CAIP_PROJECT_ID;
const location = process.env.LOCATION;
const model = 'gemini-1.0-pro-002';
const model = 'gemini-1.5-flash-001';

describe('Generative AI Stream Chat', () => {
/**
Expand Down
Loading

0 comments on commit c401daf

Please sign in to comment.