Skip to content

Commit

Permalink
fix: Update non-streaming example (#3737)
Browse files Browse the repository at this point in the history
* fix: Update non-streaming example

Also remove diuplicate region tag to disambiguate correct sample

* fix: Lint error
  • Loading branch information
arbrown authored Jul 12, 2024
1 parent 4046b51 commit 9aaca6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 3 additions & 6 deletions generative-ai/snippets/nonStreamingMultipartContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,13 @@ async function createNonStreamingMultipartContent(
console.log(request.contents[0].parts[1].text);

console.log('Non-Streaming Response Text:');
// Create the response stream
const responseStream =
await generativeVisionModel.generateContentStream(request);

// Wait for the response stream to complete
const aggregatedResponse = await responseStream.response;
// Generate a response
const response = await generativeVisionModel.generateContent(request);

// Select the text from the response
const fullTextResponse =
aggregatedResponse.candidates[0].content.parts[0].text;
response.response.candidates[0].content.parts[0].text;

console.log(fullTextResponse);
}
Expand Down
2 changes: 0 additions & 2 deletions generative-ai/snippets/streamMultipartContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// [START generativeaionvertexai_gemini_get_started]
// [START aiplatform_gemini_get_started]
const {VertexAI} = require('@google-cloud/vertexai');

Expand Down Expand Up @@ -64,7 +63,6 @@ async function createStreamMultipartContent(
}
}
// [END aiplatform_gemini_get_started]
// [END generativeaionvertexai_gemini_get_started]

createStreamMultipartContent(...process.argv.slice(2)).catch(err => {
console.error(err.message);
Expand Down

0 comments on commit 9aaca6e

Please sign in to comment.