Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
"```{note}\n",
"While some model providers may offer OpenAI-compatible APIs, they may still have minor differences.\n",
"For example, the `finish_reason` field may be different in the response.\n",
"\n",
"```"
]
},
Expand Down Expand Up @@ -403,6 +404,29 @@
"await model_client.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Also, as Gemini adds new models, you may need to define the models capabilities via the model_info field. For example, to use `gemini-2.0-flash-lite` or a similar new model, you can use the following code:\n",
"\n",
"```python \n",
"from autogen_core.models import UserMessage\n",
"from autogen_ext.models.openai import OpenAIChatCompletionClient\n",
"from autogen_core.models import ModelInfo\n",
"\n",
"model_client = OpenAIChatCompletionClient(\n",
" model=\"gemini-2.0-flash-lite\",\n",
" model_info=ModelInfo(vision=True, function_calling=True, json_output=True, family=\"unknown\", structured_output=True)\n",
" # api_key=\"GEMINI_API_KEY\",\n",
")\n",
"\n",
"response = await model_client.create([UserMessage(content=\"What is the capital of France?\", source=\"user\")])\n",
"print(response)\n",
"await model_client.close()\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -516,7 +540,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Loading