Vigia

将 @firebase/ai 从 2.x 升级到 3.x

根据 TypeScript 类型自动比较 @firebase/ai 2.16.0 与 3.0.0 的公开 API。签名变化表示可能存在不兼容变更,并非确定结论。

概要

已删除的导入路径0
已删除的导出2
已修改的签名3
已删除的类或接口成员53
已修改的类或接口成员8
新增弃用11
要求变化(engines、peer 依赖)1
新增导出1

已删除的导出

importexportkind之前
@firebase/aiChatSessionBaseclassclass
@firebase/aiVertexAIBackendclassclass

已修改的签名

export之前之后
@firebase/ai · ToolFunctionDeclarationsTool | CodeExecutionTool | GoogleMapsTool | GoogleSearchTool | URLContextToolCodeExecutionTool | FunctionDeclarationsTool | GoogleMapsTool | GoogleSearchTool | URLContextTool
@firebase/ai · BackendType"AGENT_PLATFORM" | "VERTEX_AI" | "GOOGLE_AI""AGENT_PLATFORM" | "GOOGLE_AI"
@firebase/ai · ChatSessionclassinterface

已删除的类或接口成员

memberimport之前
AI.location@firebase/aistring
TextPart.inlineData@firebase/aiundefined
TextPart.functionCall@firebase/aiundefined
TextPart.executableCode@firebase/aiundefined
TextPart.functionResponse@firebase/aiundefined
TextPart.codeExecutionResult@firebase/aiundefined
GoogleMaps.enableWidget@firebase/aiboolean | undefined
ChatSession._history@firebase/aiContent[]
ChatSession._apiSettings@firebase/aiApiSettings
ChatSession.chromeAdapter@firebase/aiany
LiveSession.sendMediaChunks@firebase/ai(mediaChunks: GenerativeContentBlob[]): Promise<void>
LiveSession.sendMediaStream@firebase/ai(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>
FileDataPart.text@firebase/aiundefined
FileDataPart.inlineData@firebase/aiundefined
FileDataPart.functionCall@firebase/aiundefined
FileDataPart.executableCode@firebase/aiundefined
FileDataPart.functionResponse@firebase/aiundefined
FileDataPart.codeExecutionResult@firebase/aiundefined
InlineDataPart.text@firebase/aiundefined
InlineDataPart.functionCall@firebase/aiundefined
InlineDataPart.executableCode@firebase/aiundefined
InlineDataPart.functionResponse@firebase/aiundefined
InlineDataPart.codeExecutionResult@firebase/aiundefined
FunctionCallPart.text@firebase/aiundefined
FunctionCallPart.inlineData@firebase/aiundefined
FunctionCallPart.executableCode@firebase/aiundefined
FunctionCallPart.functionResponse@firebase/aiundefined
FunctionCallPart.codeExecutionResult@firebase/aiundefined
GroundingMetadata.retrievalQueries@firebase/aistring[] | undefined
ExecutableCodePart.text@firebase/aiundefined
ExecutableCodePart.thought@firebase/aiundefined
ExecutableCodePart.fileData@firebase/ainever
ExecutableCodePart.inlineData@firebase/aiundefined
ExecutableCodePart.functionCall@firebase/aiundefined
ExecutableCodePart.functionResponse@firebase/aiundefined
ExecutableCodePart.codeExecutionResult@firebase/aiundefined
CountTokensResponse.totalBillableCharacters@firebase/ainumber | undefined
FunctionResponsePart.text@firebase/aiundefined
FunctionResponsePart.inlineData@firebase/aiundefined
FunctionResponsePart.functionCall@firebase/aiundefined
FunctionResponsePart.executableCode@firebase/aiundefined
FunctionResponsePart.codeExecutionResult@firebase/aiundefined
CodeExecutionResultPart.text@firebase/aiundefined
CodeExecutionResultPart.thought@firebase/aiundefined
CodeExecutionResultPart.fileData@firebase/ainever
CodeExecutionResultPart.inlineData@firebase/aiundefined
CodeExecutionResultPart.functionCall@firebase/aiundefined
CodeExecutionResultPart.executableCode@firebase/aiundefined
CodeExecutionResultPart.functionResponse@firebase/aiundefined
LanguageModelCreateOptions.topK@firebase/ainumber | undefined
LanguageModelCreateOptions.temperature@firebase/ainumber | undefined
LanguageModelCreateCoreOptions.topK@firebase/ainumber | undefined
LanguageModelCreateCoreOptions.temperature@firebase/ainumber | undefined

已修改的类或接口成员

member之前之后
ChatSession.constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined): ChatSession
GenerativeModel.generateContent(request: string | GenerateContentRequest | (string | Part)[], singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentResult>(request: string | (string | Part)[] | GenerateContentRequest, singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentResult>
GenerativeModel.generateContentStream(request: string | GenerateContentRequest | (string | Part)[], singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentStreamResult>(request: string | (string | Part)[] | GenerateContentRequest, singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentStreamResult>
ExecutableCodePart.executableCodeExecutableCode | undefinedExecutableCode
CodeExecutionResultPart.codeExecutionResultCodeExecutionResult | undefinedCodeExecutionResult
StartTemplateChatParams.templateVariablesRecord<string, unknown> | undefinedRecord<string, unknown>
TemplateGenerativeModel.generateContent(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions | undefined, templateToolConfig?: TemplateToolConfig | undefined): Promise<GenerateContentResult>(request: TemplateRequest, singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentResult>
TemplateGenerativeModel.generateContentStream(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions | undefined, templateToolConfig?: TemplateToolConfig | undefined): Promise<GenerateContentStreamResult>(request: TemplateRequest, singleRequestOptions?: SingleRequestOptions | undefined): Promise<GenerateContentStreamResult>

新增弃用

export@deprecated
@firebase/ai · GenerationConfig.topKNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · GenerationConfig.topPNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · GenerationConfig.temperatureNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · GenerationConfig.candidateCountNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Make parallel requests instead.
@firebase/ai · GenerationConfig.presencePenaltyNot supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter.
@firebase/ai · GenerationConfig.frequencyPenaltyNot supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter.
@firebase/ai · LiveGenerationConfig.topKNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · LiveGenerationConfig.topPNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · LiveGenerationConfig.temperatureNot supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically.
@firebase/ai · LiveGenerationConfig.presencePenaltyNot supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter.
@firebase/ai · LiveGenerationConfig.frequencyPenaltyNot supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter.

要求变化(engines、peer 依赖)

之前之后
engines.node>=20.0.0>=24.12.0
新增导出 (1)
importexportkind
@firebase/aiTemplateRequestinterface

把这些数据交给你的 AI 智能体

Vigia 是免费的 MCP 服务器:你的编程智能体在写代码之前就能检查版本、不兼容变更和安全漏洞。无需注册,无需 API 密钥。

claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp

添加到 Cursor添加到 VS Code★ 在 GitHub 上加星

任何其他 MCP 客户端
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }

智能体技能(SKILL.md):告诉智能体何时使用 Vigia · 用于拉取请求的 GitHub Action

常见问题

将 @firebase/ai 从 2 升级到 3 有哪些不兼容变更?

在 @firebase/ai 2.16.0 与 3.0.0 之间,Vigia 发现 2 个已删除的导出、3 个已修改的签名,以及 61 个已删除或修改的类或接口成员。

@firebase/ai 3 中弃用了哪些内容?

@firebase/ai 3.0.0 中有 11 个导出或成员新被标记为弃用。

供智能体使用

GET https://vigia.coredls.cloud/v1/packages/npm/@firebase/ai/upgrade?from=2.16.0&to=3.0.0