Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(firestore-multimodal-genai) added support for response_mime_type #511

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions firestore-multimodal-genai/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,22 @@ params:
required: false
immutable: false

- param: RESPONSE_MIME_TYPE
label: Output response mimetype of the generated candidate text.
description: >-
Supported mimetype:
- text/plain: (default) Text output.
- application/json: JSON response in the candidates.
The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined.
type: select
options:
- label: JSON
value: application/json
- label: Text
value: text/plain
default: text/plain
required: false

- param: CANDIDATE_COUNT
label: Candidate count
description: >-
Expand Down
2 changes: 1 addition & 1 deletion firestore-multimodal-genai/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@google-ai/generativelanguage": "^2.3.0",
"@google-cloud/aiplatform": "^3.19.0",
"@google-cloud/vertexai": "^1.1.0",
"@google/generative-ai": "^0.8.0",
"@google/generative-ai": "^0.11.4",
"@types/jest": "^29.5.12",
"@types/mustache": "^4.2.2",
"firebase-admin": "^12.1.0",
Expand Down
1 change: 1 addition & 0 deletions firestore-multimodal-genai/functions/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ export default {
safetySettings: getSafetySettings(),
bucketName: process.env.BUCKET_NAME || defaultBucketName,
imageField: process.env.IMAGE_FIELD,
responseMimeType: process.env.RESPONSE_MIME_TYPE || 'text/plain',
};
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class GeminiGenerativeClient extends GenerativeClient<
temperature: options.temperature,
candidateCount: options.candidateCount,
maxOutputTokens: options.maxOutputTokens,
responseMimeType: config.responseMimeType,
},
safetySettings: options.safetySettings,
});
Expand Down