@@ -23,6 +23,8 @@ composer require php-llm/llm-chain
2323To use server tools, specify them in the model options when creating a Gemini instance:
2424
2525``` php
26+ <?php
27+
2628use PhpLlm\LlmChain\Platform\Bridge\Google\Gemini;
2729use PhpLlm\LlmChain\Platform\Bridge\Google\PlatformFactory;
2830
@@ -48,6 +50,8 @@ The URL Context tool allows Gemini to fetch and analyze content from web pages.
4850- Understanding context from external sources
4951
5052``` php
53+ <?php
54+
5155$llm = new Gemini('gemini-2.5-pro-preview-03-25', [
5256 'server_tools' => [
5357 'url_context' => true
@@ -66,6 +70,8 @@ $response = $chain->call($messages);
6670The Google Search tool enables the model to search the web and incorporate search results into its responses:
6771
6872``` php
73+ <?php
74+
6975$llm = new Gemini('gemini-2.5-pro-preview-03-25', [
7076 'server_tools' => [
7177 'google_search' => true
@@ -84,6 +90,8 @@ $response = $chain->call($messages);
8490The Code Execution tool provides a sandboxed environment for running code:
8591
8692``` php
93+ <?php
94+
8795$llm = new Gemini('gemini-2.5-pro-preview-03-25', [
8896 'server_tools' => [
8997 'code_execution' => true
@@ -102,6 +110,8 @@ $response = $chain->call($messages);
102110You can enable multiple server tools simultaneously:
103111
104112``` php
113+ <?php
114+
105115$llm = new Gemini('gemini-2.5-pro-preview-03-25', [
106116 'server_tools' => [
107117 'url_context' => true,
@@ -118,6 +128,8 @@ $llm = new Gemini('gemini-2.5-pro-preview-03-25', [
118128For server tools that accept parameters, you can pass an array instead of ` true ` :
119129
120130``` php
131+ <?php
132+
121133$llm = new Gemini('gemini-2.5-pro-preview-03-25', [
122134 'server_tools' => [
123135 'url_context' => [
@@ -132,6 +144,8 @@ $llm = new Gemini('gemini-2.5-pro-preview-03-25', [
132144Server tools can be used alongside custom tools from the toolbox:
133145
134146``` php
147+ <?php
148+
135149use PhpLlm\LlmChain\Chain\Toolbox\Tool\Clock;
136150use PhpLlm\LlmChain\Chain\Toolbox\Toolbox;
137151
@@ -215,12 +229,4 @@ echo $response->getContent() . PHP_EOL;
215229- API key must have appropriate permissions
216230- Server tools may have usage quotas
217231- Response times may vary based on the complexity of server tool operations
218- - Not all Gemini model versions support all server tools
219-
220- ## Future Considerations
221-
222- As the feature evolves, consider:
223-
224- - Additional server tools may become available
225- - Parameters for existing tools may be expanded
226- - Integration patterns may be refined based on usage
232+ - Not all Gemini model versions support all server tools
0 commit comments