"GoogleGemini" (サービス接続)
このサービス接続には次が必要です:LLMアクセス »
接続と認証
ServiceConnect["GoogleGemini"]はGoogle Gemini APIへの接続を確立する.それまでに保存された接続が見付かった場合は,それが使われる.それ以外の場合は,新たな認証リクエストが起動される.
リクエスト
ServiceExecute["GoogleGemini","request",params]は,パラメータparams を使ってGoogle Gemini APIにリクエストを送信する.次は可能なリクエストである.
テキスト
"Chat" — 与えられたチャットの会話に対する応答を作成する
| "Messages" | (必須) | 会話中のメッセージのリスト | |
| "Model" | Automatic | 使用するモデルの名前 | |
| "N" | Automatic | 返す補完の数(1から8まで) | |
| "Temperature" | Automatic | サンプリング温度(0から1まで) | |
| "TopProbabilities" | Automatic | 最高確率の k クラスでのみサンプリングする | |
| "TotalProbabilityCutoff" | None | 累積確率が最低でも p の最も確率が高いクラスからサンプリングする(核サンプリング) |
"Embedding" — 入力テキストを表す埋込みベクトルを作成する
| "Text" | (必須) | 会話中のメッセージのリスト | |
| "Model" | Automatic | 使用するモデルの名前 |
"TokenCount" — プロンプトでモデルのトークナイザを実行してトークン数を返す
| "Content" | (必須) | 使用するモデルの名前 | |
| "Model" | Automatic | 使用するモデルの名前 |
モデルリスト
例題
すべて開く すべて閉じる例 (1)
スコープ (9)
チャット (6)
ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {
<|"Role" -> "User", "Content" -> "tell me three colors"|>}}]ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {<|"Role" -> "User", "Content" -> "tell me three colors"|>}, "Temperature" -> 0}]ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {<|"Role" -> "User", "Content" -> "say: the cat is on the mat"|>}, "StopTokens" -> {"cat"}}]ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {<|"Role" -> "User", "Content" -> "say: the cat is on the mat"|>}, "MaxTokens" -> 4}]ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {<|"Role" -> "User", "Content" -> "who are you?"|>}, "TotalProbabilityCutoff" -> .2}]//Lookup["Content"]ServiceExecute["GoogleGemini", "Chat", {"Messages" -> {<|"Role" -> "User", "Content" -> "who are you?"|>}, "TopProbabilities" -> 3}]//Lookup["Content"]埋込み (2)
ServiceExecute["GoogleGemini", "Embedding", {"Text" -> "ciao"}]//Shortembeddings =
Table[
ServiceExecute["GoogleGemini", "Embedding", {"Text" -> text}],
{text, {"Paris", "London", "I love rock'n'roll"}}
];DistanceMatrix[embeddings]//MatrixPlot関連項目
ServiceExecute ▪ ServiceConnect ▪ LLMFunction ▪ LLMSynthesize ▪ ChatEvaluate ▪ LLMConfiguration
サービス接続: AlephAlpha ▪ Anthropic ▪ Cohere ▪ DeepSeek ▪ Groq ▪ MistralAI ▪ OpenAI ▪ TogetherAI