# Function Calling with the Gemini API

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1beta/models/gemini-2.0-flash:generateContent:
    post:
      summary: Function Calling with the Gemini API
      deprecated: false
      description: >-
        Function calling lets you connect models to external tools and APIs.
        Instead of generating text responses, the model understands when to call
        specific functions and provides the necessary parameters to execute
        real-world actions. This allows the model to act as a bridge between
        natural language and real-world actions and data. Function calling has 3
        primary use cases:


        - **Augment Knowledge:** Access information from external sources like
        databases, APIs, and knowledge bases.

        - **Extend Capabilities:** Use external tools to perform computations
        and extend the limitations of the model, such as using a calculator or
        creating charts.

        - **Take Actions:** Interact with external systems using APIs, such as
        scheduling appointments, creating invoices, sending emails, or
        controlling smart home devices
      tags:
        - Model Capabilities/Function calling
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                          x-apidog-orders:
                            - text
                    x-apidog-orders:
                      - role
                      - parts
                tools:
                  type: array
                  items:
                    type: object
                    properties:
                      functionDeclarations:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                            description:
                              type: string
                            parameters:
                              type: object
                              properties:
                                type:
                                  type: string
                                properties:
                                  type: object
                                  properties:
                                    location:
                                      type: object
                                      properties:
                                        type:
                                          type: string
                                        description:
                                          type: string
                                      required:
                                        - type
                                        - description
                                      x-apidog-orders:
                                        - type
                                        - description
                                  required:
                                    - location
                                  x-apidog-orders:
                                    - location
                                required:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - type
                                - properties
                                - required
                              x-apidog-orders:
                                - type
                                - properties
                                - required
                          x-apidog-orders:
                            - name
                            - description
                            - parameters
                    x-apidog-orders:
                      - functionDeclarations
              required:
                - contents
                - tools
              x-apidog-orders:
                - contents
                - tools
            example:
              contents:
                - role: user
                  parts:
                    - text: What's the temperature in London?
              tools:
                - functionDeclarations:
                    - name: get_current_temperature
                      description: Gets the current temperature for a given location.
                      parameters:
                        type: object
                        properties:
                          location:
                            type: string
                            description: The city name, e.g. San Francisco
                        required:
                          - location
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apidog-orders: []
          headers: {}
          x-apidog-name: 成功
      security:
        - apikey-header-x-goog-api-key: []
      x-apidog-folder: Model Capabilities/Function calling
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/892755/apis/api-16240711-run
components:
  schemas: {}
  securitySchemes:
    apikey-header-x-goog-api-key:
      type: apiKey
      in: header
      name: x-goog-api-key
servers:
  - url: https://generativelanguage.googleapis.com
    description: Prod Env
security:
  - apikey-header-x-goog-api-key: []

```
