Skip to content

Commit 985fb17

Browse files
docs: Add API reference docs (#79)
1 parent bbfab21 commit 985fb17

File tree

17 files changed

+742
-38
lines changed

17 files changed

+742
-38
lines changed

.github/workflows/docs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: docs
6+
permissions:
7+
contents: read # This applies to all jobs
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
14+
- name: Setup Python
15+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
16+
with:
17+
python-version: "3.10"
18+
- name: Install nox
19+
run: |
20+
python -m pip install --upgrade setuptools pip wheel
21+
python -m pip install nox
22+
- name: Run docs
23+
run: |
24+
nox -s docs
25+
docfx:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30+
- name: Setup Python
31+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
32+
with:
33+
python-version: "3.10"
34+
- name: Install nox
35+
run: |
36+
python -m pip install --upgrade setuptools pip wheel
37+
python -m pip install nox
38+
- name: Run docfx
39+
run: |
40+
nox -s docfx

README.rst

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Code samples and snippets live in the `samples/`_ folder.
8282
.. _samples/: https://github.com/googleapis/llama-index-cloud-sql-pg-python/tree/main/samples
8383

8484
Vector Store Usage
85-
~~~~~~~~~~~~~~~~~~~
85+
~~~~~~~~~~~~~~~~~~~~~~~~~~
8686

8787
Use a vector store to store embedded data and perform vector search.
8888

@@ -109,8 +109,52 @@ Use a vector store to store embedded data and perform vector search.
109109
)
110110
111111
112+
Chat Store Usage
113+
~~~~~~~~~~~~~~~~~~~~~~~~~~
114+
115+
A chat store serves as a centralized interface to store your chat history.
116+
117+
.. code-block:: python
118+
119+
from llama_index.core.memory import ChatMemoryBuffer
120+
from llama_index_cloud_sql_pg import PostgresChatStore, PostgresEngine
121+
122+
123+
engine = await PostgresEngine.afrom_instance(
124+
"project-id", "region", "my-instance", "my-database"
125+
)
126+
chat_store = await PostgresChatStore.create(
127+
engine=engine, table_name="chat_store"
128+
)
129+
memory = ChatMemoryBuffer.from_defaults(
130+
token_limit=3000,
131+
chat_store=chat_store,
132+
chat_store_key="user1",
133+
)
134+
135+
136+
Document Reader Usage
137+
~~~~~~~~~~~~~~~~~~~~~~~~~~
138+
139+
A Reader ingest data from different data sources and data formats into a simple `Document` representation.
140+
141+
.. code-block:: python
142+
143+
from llama_index.core.memory import ChatMemoryBuffer
144+
from llama_index_cloud_sql_pg import PostgresReader, PostgresEngine
145+
146+
147+
engine = await PostgresEngine.afrom_instance(
148+
"project-id", "region", "my-instance", "my-database"
149+
)
150+
reader = await PostgresReader.create(
151+
engine=engine, table_name="my-db-table"
152+
)
153+
documents = reader.load_data()
154+
155+
112156
Document Store Usage
113-
~~~~~~~~~~~~~~~~~~~~~
157+
~~~~~~~~~~~~~~~~~~~~~~~~~~
114158

115159
Use a document store to make storage and maintenance of data easier.
116160

docs/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.rst

docs/_static/custom.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
div#python2-eol {
2+
border-color: red;
3+
border-width: medium;
4+
}
5+
6+
/* Ensure minimum width for 'Parameters' / 'Returns' column */
7+
dl.field-list > dt {
8+
min-width: 100px
9+
}
10+
11+
/* Insert space between methods for readability */
12+
dl.method {
13+
padding-top: 10px;
14+
padding-bottom: 10px
15+
}
16+
17+
/* Insert empty space between classes */
18+
dl.class {
19+
padding-bottom: 50px
20+
}

docs/_templates/layout.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
{% extends "!layout.html" %}
3+
{%- block content %}
4+
{%- if theme_fixed_sidebar|lower == 'true' %}
5+
<div class="document">
6+
{{ sidebar() }}
7+
{%- block document %}
8+
<div class="documentwrapper">
9+
{%- if render_sidebar %}
10+
<div class="bodywrapper">
11+
{%- endif %}
12+
13+
{%- block relbar_top %}
14+
{%- if theme_show_relbar_top|tobool %}
15+
<div class="related top">
16+
&nbsp;
17+
{{- rellink_markup () }}
18+
</div>
19+
{%- endif %}
20+
{% endblock %}
21+
22+
<div class="body" role="main">
23+
<div class="admonition" id="python2-eol">
24+
As of January 1, 2020 this library no longer supports Python 2 on the latest released version.
25+
Library versions released prior to that date will continue to be available. For more information please
26+
visit <a href="https://cloud.google.com/python/docs/python2-sunset/">Python 2 support on Google Cloud</a>.
27+
</div>
28+
{% block body %} {% endblock %}
29+
</div>
30+
31+
{%- block relbar_bottom %}
32+
{%- if theme_show_relbar_bottom|tobool %}
33+
<div class="related bottom">
34+
&nbsp;
35+
{{- rellink_markup () }}
36+
</div>
37+
{%- endif %}
38+
{% endblock %}
39+
40+
{%- if render_sidebar %}
41+
</div>
42+
{%- endif %}
43+
</div>
44+
{%- endblock %}
45+
<div class="clearer"></div>
46+
</div>
47+
{%- else %}
48+
{{ super() }}
49+
{%- endif %}
50+
{%- endblock %}

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CHANGELOG.md

0 commit comments

Comments
 (0)