Open2

Gemini1.5

dorarepdorarep

1.5Pro vs 1.5Flash

https://cloud.google.com/vertex-ai/generative-ai/pricing
コストは約1/10

https://staffing.archetyp.jp/magazine/gemini-1-5-flash/

開発手法としては「蒸留(Distillation)」を利用しています。この手法は、親となる既存モデルの出力を使って新しいモデルをトレーニングするもので、親モデルに比べてパラメーター数を小さくすることができます。Gemini 1.5 Flashは親モデルとして1.5 Proを利用し、その情報を効率よく小型モデルに取り込んでいます。Google DeepMindのCTOによると、これにより小型でありながら高効率なモデルが実現したとのことです。

dorarepdorarep

素直にプロンプトを書く

	const generativeVisionModel = vertexAI.getGenerativeModel({
		model,
		generationConfig: {
			responseMimeType: 'application/json',
		}
	});

https://github.com/googleapis/nodejs-vertexai

https://github.com/googleapis/nodejs-vertexai/issues/392

  • 型が欠落してるだけらしいので一旦anyで動かせそう

設定値
https://cloud.google.com/vertex-ai/docs/reference/rest/v1/Schema

-> Request with response_schema config is not supported.エラーはいた

	const generativeVisionModel = vertexAI.getGenerativeModel({
		model: "gemini-1.5-pro",
		generationConfig: {
			responseMimeType: 'application/json',
			responseSchema: {
				type: 'object',
				"properties": Object.fromEntries(keys.map((key) => 
					[key, {
						"type": "string",
					}]
				)),
			}
		} as any
	});

-> proだと動いた

https://medium.com/google-cloud/vertex-ai-controlled-generation-with-gemini-8a60d0581f62

As of writing this article, Gemini 1.5 Pro supports schema, while Gemini 1.5 Flash only supports the mime_type with a prompt description.

まだ未対応か