This repository was archived by the owner on Dec 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 482
Improve key naming clarity and consistency across REST requests #683 #714
Open
demoncoder-crypto
wants to merge
2
commits into
google-gemini:main
Choose a base branch
from
demoncoder-crypto:fix-rest-api-naming-consistency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+138
−39
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to apply the consistency changes to the following files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #!/bin/bash | ||
| # -*- coding: utf-8 -*- | ||
| # Copyright 2023 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # This example demonstrates how to use inline PDF data with the generative API | ||
|
|
||
| # Set default values for environment variables if they don't exist | ||
| MEDIA_DIR="${MEDIA_DIR:-$(dirname "$0")/../../third_party}" | ||
|
|
||
| # Check if we're on macOS or Linux | ||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||
| B64FLAGS="-b 0" | ||
| else | ||
| B64FLAGS="--wrap=0" | ||
| fi | ||
|
|
||
| echo "[START text_gen_multimodal_two_pdf_inline]" | ||
| # Use temporary files to hold the base64 encoded pdf data | ||
| PDF_PATH_1=${MEDIA_DIR}/test.pdf | ||
| PDF_PATH_2=${MEDIA_DIR}/test.pdf | ||
|
|
||
| TEMP_1_B64=$(mktemp) | ||
| trap 'rm -f "$TEMP_1_B64"' EXIT | ||
| base64 $B64FLAGS $PDF_PATH_1 > "$TEMP_1_B64" | ||
|
|
||
| TEMP_2_B64=$(mktemp) | ||
| trap 'rm -f "$TEMP_2_B64"' EXIT | ||
| base64 $B64FLAGS $PDF_PATH_2 > "$TEMP_2_B64" | ||
|
|
||
| # Use a temporary file to hold the JSON payload | ||
| TEMP_JSON=$(mktemp) | ||
| trap 'rm -f "$TEMP_JSON"' EXIT | ||
|
|
||
| cat > "$TEMP_JSON" << EOF | ||
| { | ||
| "contents": [{ | ||
| "role": "user", | ||
| "parts":[ | ||
| {"text": "Extract the pet names, type and ages from these documents."}, | ||
| { | ||
| "inlineData": { | ||
| "mimeType":"application/pdf", | ||
| "data": "$(cat "$TEMP_1_B64")" | ||
| } | ||
| }, | ||
| { | ||
| "inlineData": { | ||
| "mimeType":"application/pdf", | ||
| "data": "$(cat "$TEMP_2_B64")" | ||
| } | ||
| } | ||
| ] | ||
| }], | ||
| "systemInstruction": { | ||
| "parts": [ | ||
| {"text": "Extract the pet names and ages from these documents and return them in the following JSON format: | ||
|
|
||
| Pet = {\"name\": str, \"type\": str, \"age\": int} | ||
| Return: list[Pet]" | ||
| } | ||
| ] | ||
| }, | ||
| "generationConfig": { | ||
| "temperature": 0.2, | ||
| "topP": 0.95, | ||
| "topK": 40, | ||
| "maxOutputTokens": 1000, | ||
| "responseMimeType": "application/json" | ||
| } | ||
| } | ||
| EOF | ||
|
|
||
| curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GOOGLE_API_KEY" \ | ||
| -H 'Content-Type: application/json' \ | ||
| -X POST \ | ||
| -d "@$TEMP_JSON" 2> /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to apply the consistency changes to the following places:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will fix this immediately |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to apply the consistency changes to the following files: