Skip to content

feat(firebase-ai-logic-basics): extract text, multimodal, chat, and streaming capability guides - #212

Open
AustinBenoit wants to merge 1 commit into
ai-logic/2d-setup-webfrom
ai-logic/3-core-capabilities
Open

AustinBenoit wants to merge 1 commit into
ai-logic/2d-setup-webfrom
ai-logic/3-core-capabilities

Conversation

@AustinBenoit

@AustinBenoit AustinBenoit commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary (Stack 2/5)

Extracts the four core generation patterns out of the per-platform setup guides into unified cross-platform capability guides under references/sdk/capabilities/ covering Android (Kotlin), iOS (Swift), Flutter (Dart), and Web (JavaScript) side by side.

Changes

  • Adds text_generation.md, multimodal_input.md, chat.md, and streaming.md.
  • Removes temporary in-file usage sections from android_setup.md and flutter_setup.md (reaching their final setup-only state).
  • Updates SKILL.md routing table.

@AustinBenoit
AustinBenoit added this pull request to stack #216 October 9, 2026 14:39

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reorganizes the Firebase AI Logic SDK documentation by extracting capability-specific examples (such as text generation, multimodal input, chat, and streaming) from platform setup guides into dedicated markdown files. The review feedback highlights several API and syntax errors in the newly created guides across multiple SDKs. Specifically, the Dart SafetySetting constructor is incorrectly documented as accepting three parameters instead of two, the Swift examples incorrectly reference non-existent InlineDataPart and FileDataPart types instead of ModelContent.Part enums, and the Web JavaScript snippets incorrectly include a type property inside Part objects.

Comment on lines +166 to +168
Dart `SafetySetting` constructor has **three positional parameters**
(`category`, `threshold`, `method`); the third is a nullable `HarmBlockMethod`
that you can pass as `null`. Prompts are passed as a list of `Content`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In the Dart firebase_ai (and underlying google_generative_ai) SDK, the SafetySetting constructor only accepts two positional parameters: category and threshold. There is no third method parameter or HarmBlockMethod type, so this description is incorrect and will mislead developers.

Comment on lines +183 to +187
// Third positional argument is an optional HarmBlockMethod; pass null.
final safetySettings = [
SafetySetting(HarmCategory.harassment, HarmBlockThreshold.high, null),
SafetySetting(HarmCategory.hateSpeech, HarmBlockThreshold.medium, null),
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Remove the third positional argument (null) from the SafetySetting constructor calls, as the Dart SDK only accepts two positional parameters (category and threshold). Passing a third argument will cause a compilation error.

Suggested change
// Third positional argument is an optional HarmBlockMethod; pass null.
final safetySettings = [
SafetySetting(HarmCategory.harassment, HarmBlockThreshold.high, null),
SafetySetting(HarmCategory.hateSpeech, HarmBlockThreshold.medium, null),
];
final safetySettings = [
SafetySetting(HarmCategory.harassment, HarmBlockThreshold.high),
SafetySetting(HarmCategory.hateSpeech, HarmBlockThreshold.medium),
];

Comment on lines +123 to +124
let pdf = try InlineDataPart(data: Data(contentsOf: pdfURL), mimeType: "application/pdf")
// e.g. audio instead: InlineDataPart(data: audioData, mimeType: "audio/mpeg")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In the Swift SDK (FirebaseAILogic), there are no InlineDataPart or FileDataPart types. Instead, you should use the ModelContent.Part.inlineData enum case to wrap raw data with a MIME type.

Suggested change
let pdf = try InlineDataPart(data: Data(contentsOf: pdfURL), mimeType: "application/pdf")
// e.g. audio instead: InlineDataPart(data: audioData, mimeType: "audio/mpeg")
let pdf = ModelContent.Part.inlineData(data: try Data(contentsOf: pdfURL), mimeType: "application/pdf")
// e.g. audio instead: ModelContent.Part.inlineData(data: audioData, mimeType: "audio/mpeg")

Comment on lines +129 to +131
Cloud Storage for Firebase URL (Agent Platform Gemini API provider only): pass
`FileDataPart(uri: "gs://bucket-name/path/image.jpg", mimeType: "image/jpeg")`
in place of the `InlineDataPart`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In the Swift SDK, use ModelContent.Part.fileData instead of FileDataPart to reference files stored in Cloud Storage for Firebase.

Comment on lines +190 to +196
return {
type: "inlineData",
inlineData: {
data: await base64EncodedDataPromise,
mimeType: file.type,
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In the Firebase AI Web SDK, the Part object for inline data does not contain a type property. It should only contain the inlineData property. Adding type: "inlineData" is incorrect and may cause validation or runtime errors.

Suggested change
return {
type: "inlineData",
inlineData: {
data: await base64EncodedDataPromise,
mimeType: file.type,
},
};
return {
inlineData: {
data: await base64EncodedDataPromise,
mimeType: file.type,
},
};

directly with an explicit MIME type:

```javascript
const pdfPart = { type: "inlineData", inlineData: { data: base64Pdf, mimeType: "application/pdf" } };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Remove the type: "inlineData" property from the inline data part object, as it is not supported by the Web SDK's Part type.

Suggested change
const pdfPart = { type: "inlineData", inlineData: { data: base64Pdf, mimeType: "application/pdf" } };
const pdfPart = { inlineData: { data: base64Pdf, mimeType: "application/pdf" } };

Comment on lines +131 to +138
{
role: "user",
parts: [{ type: "text", text: "Hello, I am a developer." }],
},
{
role: "model",
parts: [{ type: "text", text: "Great to meet you. How can I help with code?" }],
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In the Firebase AI Web SDK, the Part object for text does not contain a type property. It should only contain the text property. Adding type: "text" is incorrect and may cause validation or runtime errors.

Suggested change
{
role: "user",
parts: [{ type: "text", text: "Hello, I am a developer." }],
},
{
role: "model",
parts: [{ type: "text", text: "Great to meet you. How can I help with code?" }],
},
history: [
{
role: "user",
parts: [{ text: "Hello, I am a developer." }],
},
{
role: "model",
parts: [{ text: "Great to meet you. How can I help with code?" }],
},
],

@AustinBenoit
AustinBenoit removed this pull request from stack #216 October 9, 2026 14:48
@AustinBenoit
AustinBenoit force-pushed the ai-logic/3-core-capabilities branch from 92f632f to 2952da8 Compare October 9, 2026 14:48
@AustinBenoit
AustinBenoit added this pull request to stack #218 October 9, 2026 14:48
@AustinBenoit
AustinBenoit force-pushed the ai-logic/3-core-capabilities branch from 2952da8 to 3b2fc6e Compare October 9, 2026 15:23
@AustinBenoit
AustinBenoit force-pushed the ai-logic/3-core-capabilities branch from 3b2fc6e to 6c656dd Compare October 9, 2026 15:49
@AustinBenoit
AustinBenoit force-pushed the ai-logic/3-core-capabilities branch from 6c656dd to f881918 Compare October 9, 2026 16:13
…treaming capability guides

### Summary (Stack 3/6)
Extracts the four core generation patterns out of the per-platform setup guides into unified cross-platform capability guides under `references/sdk/capabilities/` covering Android (Kotlin), iOS (Swift), Flutter (Dart), and Web (JavaScript) side by side.

### Changes
- Adds `text_generation.md`, `multimodal_input.md`, `chat.md`, and `streaming.md`.
- Removes temporary in-file usage sections from `android_setup.md` and `flutter_setup.md` (reaching their final setup-only state).
- Updates `SKILL.md` routing table.
@AustinBenoit
AustinBenoit force-pushed the ai-logic/3-core-capabilities branch from f881918 to a1889fc Compare October 9, 2026 16:51
@AustinBenoit
AustinBenoit removed this pull request from stack #218 October 9, 2026 16:53
@AustinBenoit
AustinBenoit changed the base branch from ai-logic/2-core-structure to ai-logic/2d-setup-web October 9, 2026 16:53
@AustinBenoit
AustinBenoit added this pull request to stack #223 October 9, 2026 16:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant