Skip to content
Merged
Show file tree
Hide file tree
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
78 changes: 78 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Builds the API reference (https://googleapis.github.io/python-genai/) with the
# pinned Sphinx in docs/requirements.txt and publishes it to GitHub Pages.
#
# Run by hand from the Actions tab for now, from main: the github-pages
# environment only accepts deployments from main. Publishing also needs the
# repository's Pages source set to "GitHub Actions"; until then, leave "deploy"
# unchecked to build the site and download it as an artifact.
name: Docs

on:
workflow_dispatch:
inputs:
ref:
description: Tag or branch to build. Tags from before this workflow have no docs/source.
required: true
default: main
deploy:
description: Publish to GitHub Pages
type: boolean
default: false

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r docs/requirements.txt

- name: Build
# The docs import `genai` from the checkout, as build_and_copy_docs.sh
# does from its copy in docs/google. custom.css is copied in first, as
# that script does. The doctree cache goes outside the site, so it is
# not published.
env:
PYTHONPATH: ${{ github.workspace }}/google
run: |
mkdir -p _site/_static/css
cp docs/source/custom.css _site/_static/css/custom.css
sphinx-build -b html -d "$RUNNER_TEMP/doctrees" docs/source _site

- name: Upload the site
uses: actions/upload-pages-artifact@v3
with:
path: _site

deploy:
if: inputs.deploy
needs: build
runs-on: ubuntu-latest
# One deployment at a time; builds can run side by side.
concurrency:
group: pages
cancel-in-progress: false
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
absl-py==2.1.0
autodoc_pydantic==2.2.0
furo==2025.09.25
myst-parser==4.0.1
sphinx==8.2.3
sphinx-autodoc-typehints==3.2.0
69 changes: 69 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Google Gen AI SDK'
copyright = '2024, Google'
author = 'Google'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

autoclass_content = 'both'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_static_path = ['_static']

import html
import os
import sys
sys.path.insert(0, os.path.abspath('.')) # Add current directory to path
sys.path.insert(0, os.path.abspath('../google'))

extensions = ['sphinxcontrib.autodoc_pydantic', 'myst_parser', 'sphinx.ext.autodoc', 'sphinx_autodoc_typehints', 'sphinx.ext.napoleon']
html_theme = 'furo'

TEXT_FONTS = '"Google Sans Text", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif'
CODE_FONTS = 'Roboto Mono, "Helvetica Neue Mono", monospace'
FONT_COLOR_FOR_LIGHT_THEME = 'black'
FONT_COLOR_FOR_DARK_THEME = 'white'

html_theme_options = {
"light_css_variables": {
"font-stack": TEXT_FONTS,
"font-stack--monospace": CODE_FONTS,
"font-stack--headings": TEXT_FONTS,
"color-brand-primary": FONT_COLOR_FOR_LIGHT_THEME,
"color-brand-content": FONT_COLOR_FOR_LIGHT_THEME,
},
"dark_css_variables": {
"font-stack": TEXT_FONTS,
"font-stack--monospace": CODE_FONTS,
"font-stack--headings": TEXT_FONTS,
"color-brand-primary": FONT_COLOR_FOR_DARK_THEME,
"color-brand-content": FONT_COLOR_FOR_DARK_THEME,
},
}

# These folders are copied to the documentation's HTML output
html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]

autodoc_pydantic_model_show_json = True
autodoc_pydantic_model_show_config_summary = False
33 changes: 33 additions & 0 deletions docs/source/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import url('https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap');

body {
font-weight: 400;
}

h1 {
font-size: 32px;
font-weight: 400;
}

h2 {
font-size: 24px;
font-weight: 400;
}

h3 {
font-size: 20px;
font-weight: 400;
}

h4 {
font-size: 16px;
font-weight: 400;
}

.sidebar-brand-text {
font-size: 14px;
}

.highlight {
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
}
108 changes: 108 additions & 0 deletions docs/source/genai.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Submodules
----------

genai.client module
-------------------

.. automodule:: genai.client
:members:
:undoc-members:
:show-inheritance:


GAOS Client Resources
^^^^^^^^^^^^^^^^^^^^^

The following resource classes are returned by the client properties
``client.interactions``, ``client.agents``, ``client.webhooks``,
``client.triggers``, and ``client.environments``.

.. autoclass:: genai._gaos.google_genai.GeminiNextGenInteractions
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenInteractions
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.GeminiNextGenAgents
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenAgents
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.GeminiNextGenWebhooks
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenWebhooks
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.GeminiNextGenTriggers
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenTriggers
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.GeminiNextGenEnvironments
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: genai._gaos.google_genai.AsyncGeminiNextGenEnvironments
:members:
:undoc-members:
:show-inheritance:

genai.live module
-----------------

.. automodule:: genai.live
:members:
:undoc-members:
:show-inheritance:

genai.models module
-------------------

.. automodule:: genai.models
:members:
:undoc-members:
:show-inheritance:

genai.tokens module
-------------------

.. automodule:: genai.tokens
:members:
:undoc-members:
:show-inheritance:

genai.tunings module
--------------------

.. automodule:: genai.tunings
:members:
:undoc-members:
:show-inheritance:

genai.types module
------------------

.. automodule:: genai.types
:members:
:undoc-members:
:show-inheritance:
Loading
Loading