| Purpose-built AI models | Gemini models |
|---|---|
| Cloud Natural Language API | Gemini 1.0 Pro |
| Cloud Translation API | Gemini 1.0 Pro Vision |
| Cloud Vision API | |
| Document AI API | |
| Speech-to-Text API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def generate_sql(request: str, project_id: str = project_id) -> str: | |
| """ | |
| Generate a valid BigQuery SQL query that fulfills the user request | |
| Args: | |
| request (str): The task that defines the query output | |
| project_id (str): A string the project ID for the relevant project | |
| Returns: | |
| json: A JSON object containing a BigQuery SQL query that fulfills the user request and an explanation of why this query was generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| generate_sql_func = FunctionDeclaration( | |
| name="generate_sql", | |
| description=""" | |
| Generate a valid BigQuery SQL query that fulfills the user request | |
| Args: | |
| request (str): The task that defines the query output | |
| project_id (str): The project ID for the relevant Google Cloud project | |
| Returns: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "from_table": "order_items", | |
| "from_join_columns": [ | |
| "product_id" | |
| ], | |
| "to_table": "products", | |
| "to_join_columns": [ | |
| "id" | |
| ], | |
| "join_type": "INNER JOIN" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_table_schemas(schema_folder=schema_dir, | |
| project_id=project_id): | |
| """ | |
| Generate schema files for all tables in BigQuery datasets within the given project | |
| Used to improve the quality of sql generation across the project. | |
| Args: | |
| schema_folder (str): The directory with a folder for each BigQuery dataset that contain schema files for each table | |
| project_id (str): A string the project ID for the relevant project |