diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..f4ec740 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,40 @@ +on: + pull_request: + branches: + - main +name: docs +permissions: + contents: read # This applies to all jobs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Setup Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Setup Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/CHANGELOG.md b/CHANGELOG.md index 657d2b9..ab7cc3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.2.1](https://github.com/googleapis/llama-index-alloydb-pg-python/compare/v0.2.0...v0.2.1) (2025-02-18) + + +### Documentation + +* Add API reference documentation and improve doc build ([#81](https://github.com/googleapis/llama-index-alloydb-pg-python/issues/81)) ([059a526](https://github.com/googleapis/llama-index-alloydb-pg-python/commit/059a5261e333d29a1d25bb9a2ef414a935d803a9)) +* Add integrations to README.rst ([#80](https://github.com/googleapis/llama-index-alloydb-pg-python/issues/80)) ([f7bda32](https://github.com/googleapis/llama-index-alloydb-pg-python/commit/f7bda32a81b8079d8dced40d79a7849ab202729b)) +* Adds a quickstart guide ([#74](https://github.com/googleapis/llama-index-alloydb-pg-python/issues/74)) ([fd5c24d](https://github.com/googleapis/llama-index-alloydb-pg-python/commit/fd5c24d89c33c2fa011c5c9ba758f9a5a5fce8d3)) + ## [0.2.0](https://github.com/googleapis/llama-index-alloydb-pg-python/compare/v0.1.0...v0.2.0) (2025-01-30) diff --git a/README.rst b/README.rst index 24cd9fd..6ec556f 100644 --- a/README.rst +++ b/README.rst @@ -83,7 +83,7 @@ Code samples and snippets live in the `samples/`_ folder. .. _samples/: https://github.com/googleapis/llama-index-alloydb-pg-python/tree/main/samples Vector Store Usage -~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ Use a vector store to store embedded data and perform vector search. @@ -110,8 +110,52 @@ Use a vector store to store embedded data and perform vector search. ) +Chat Store Usage +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A chat store serves as a centralized interface to store your chat history. + +.. code-block:: python + + from llama_index.core.memory import ChatMemoryBuffer + from llama_index_cloud_sql_pg import AlloyDBChatStore, AlloyDBEngine + + + engine = await AlloyDBEngine.afrom_instance( + "project-id", "region", "my-cluster", "my-instance", "my-database" + ) + chat_store = await AlloyDBChatStore.create( + engine=engine, table_name="chat_store" + ) + memory = ChatMemoryBuffer.from_defaults( + token_limit=3000, + chat_store=chat_store, + chat_store_key="user1", + ) + + +Document Reader Usage +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A Reader ingest data from different data sources and data formats into a simple `Document` representation. + +.. code-block:: python + + from llama_index.core.memory import ChatMemoryBuffer + from llama_index_cloud_sql_pg import AlloyDBReader, AlloyDBEngine + + + engine = await AlloyDBEngine.afrom_instance( + "project-id", "region", "my-cluster", "my-instance", "my-database" + ) + reader = await AlloyDBReader.create( + engine=engine, table_name="my-db-table" + ) + documents = reader.load_data() + + Document Store Usage -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ Use a document store to make storage and maintenance of data easier. diff --git a/docs/README.rst b/docs/README.rst new file mode 120000 index 0000000..89a0106 --- /dev/null +++ b/docs/README.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file diff --git a/docs/_static/custom.css b/docs/_static/custom.css new file mode 100644 index 0000000..b0a2954 --- /dev/null +++ b/docs/_static/custom.css @@ -0,0 +1,20 @@ +div#python2-eol { + border-color: red; + border-width: medium; +} + +/* Ensure minimum width for 'Parameters' / 'Returns' column */ +dl.field-list > dt { + min-width: 100px +} + +/* Insert space between methods for readability */ +dl.method { + padding-top: 10px; + padding-bottom: 10px +} + +/* Insert empty space between classes */ +dl.class { + padding-bottom: 50px +} diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 0000000..95e9c77 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,50 @@ + +{% extends "!layout.html" %} +{%- block content %} +{%- if theme_fixed_sidebar|lower == 'true' %} +