Skip to content

Commit 6ab1a40

Browse files
authored
fix: API reference doc pipeline (#108)
* fix: API reference doc pipeline * use code blocks * remove breaking changes
1 parent 0b8df1e commit 6ab1a40

File tree

8 files changed

+42
-40
lines changed

8 files changed

+42
-40
lines changed

.kokoro/publish-docs.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ python3 -m nox --version
2727
# build docs
2828
nox -s docs
2929

30-
VERSION=$(python -c "import langchain_google_cloud_sql_pg;print(langchain_google_cloud_sql_pg.__version__)")
30+
python3 -m pip install .
31+
VERSION=$(python3 -c "import langchain_google_cloud_sql_pg;print(langchain_google_cloud_sql_pg.__version__)")
3132

3233
# create metadata
3334
python3 -m docuploader create-metadata \

README.rst

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Cloud SQL for PostgreSQL for LangChain
44
|preview| |pypi| |versions|
55

66
- `Client Library Documentation`_
7-
- `How-to Guides`_
87
- `Product Documentation`_
98

109
.. |preview| image:: https://img.shields.io/badge/support-preview-orange.svg
@@ -14,7 +13,6 @@ Cloud SQL for PostgreSQL for LangChain
1413
.. |versions| image:: https://img.shields.io/pypi/pyversions/langchain-google-cloud-sql-pg.svg
1514
:target: https://pypi.org/project/langchain-google-cloud-sql-pg/
1615
.. _Client Library Documentation: https://github.com/googleapis/langchain-google-cloud-sql-pg-python
17-
.. _How-to Guides: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/samples
1816
.. _Product Documentation: https://cloud.google.com/sql/docs
1917

2018
Quick Start
@@ -87,70 +85,70 @@ Vector Store Usage
8785

8886
Use a Vector Store to store embedded data and perform vector search.
8987

90-
.. code:: python
88+
.. code-block:: python
9189
92-
from langchain_google_cloud_sql_pg import PostgresVectorstore, PostgresEngine
93-
from langchain.embeddings import VertexAIEmbeddings
90+
from langchain_google_cloud_sql_pg import PostgresVectorstore, PostgresEngine
91+
from langchain.embeddings import VertexAIEmbeddings
9492
9593
96-
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
97-
engine.init_vectorstore_table(
98-
table_name="my-table",
99-
vector_size=768, # Vector size for `VertexAIEmbeddings()`
100-
)
101-
embeddings_service = VertexAIEmbeddings()
102-
vectorstore = PostgresVectorStore.create_sync(
103-
engine,
104-
table_name="my-table",
105-
embeddings=embedding_service
106-
)
94+
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
95+
engine.init_vectorstore_table(
96+
table_name="my-table",
97+
vector_size=768, # Vector size for `VertexAIEmbeddings()`
98+
)
99+
embeddings_service = VertexAIEmbeddings()
100+
vectorstore = PostgresVectorStore.create_sync(
101+
engine,
102+
table_name="my-table",
103+
embeddings=embedding_service
104+
)
107105
108106
See the full `Vector Store`_ tutorial.
109107

110-
.. _`Vector Store`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/samples/vector_store.ipynb
108+
.. _`Vector Store`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/docs/vector_store.ipynb
111109

112110
Document Loader Usage
113111
~~~~~~~~~~~~~~~~~~~~~
114112

115113
Use a document loader to load data as Documents.
116114

117-
.. code:: python
115+
.. code-block:: python
118116
119-
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader
117+
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader
120118
121119
122-
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
123-
loader = PostgresSQLLoader.create_sync(
124-
engine,
125-
table_name="my-table-name"
126-
)
127-
docs = loader.lazy_load()
120+
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
121+
loader = PostgresSQLLoader.create_sync(
122+
engine,
123+
table_name="my-table-name"
124+
)
125+
docs = loader.lazy_load()
128126
129127
See the full `Document Loader`_ tutorial.
130128

131-
.. _`Document Loader`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/samples/document_loader.ipynb
129+
.. _`Document Loader`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/docs/document_loader.ipynb
132130

133131
Chat Message History Usage
134132
~~~~~~~~~~~~~~~~~~~~~~~~~~~
135133

136134
Use Chat Message History to store messages and provide conversation history to LLMs.
137135

138-
.. code:: python
136+
.. code-block:: python
139137
140-
from langchain_google_cloud_sql_pg import PostgresChatMessageHistory, PostgresEngine
138+
from langchain_google_cloud_sql_pg import PostgresChatMessageHistory, PostgresEngine
141139
142140
143-
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
144-
engine.init_chat_history_table(table_name="my-message-store")
145-
history = PostgresChatMessageHistory.create_sync(
146-
engine,
147-
table_name="my-message-store",
148-
session_id="my-session_id"
149-
)
141+
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
142+
engine.init_chat_history_table(table_name="my-message-store")
143+
history = PostgresChatMessageHistory.create_sync(
144+
engine,
145+
table_name="my-message-store",
146+
session_id="my-session_id"
147+
)
150148
151149
See the full `Chat Message History`_ tutorial.
152150

153-
.. _`Chat Message History`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/samples/chat_message_history.ipynb
151+
.. _`Chat Message History`: https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/docs/chat_message_history.ipynb
154152

155153
Contributing
156154
~~~~~~~~~~~~

samples/chat_message_history.ipynb renamed to docs/chat_message_history.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,4 +555,4 @@
555555
},
556556
"nbformat": 4,
557557
"nbformat_minor": 5
558-
}
558+
}
File renamed without changes.
File renamed without changes.

noxfile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import os
2020
import pathlib
2121
import shutil
22+
from pathlib import Path
23+
from typing import Optional
2224

2325
import nox
2426

@@ -28,6 +30,7 @@
2830
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
2931
nox.options.sessions = [
3032
"docs",
33+
"docfx",
3134
]
3235

3336
# Error if a python version is missing

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "langchain-google-cloud-sql-pg"
33
dynamic = ["version"]
44
description = "LangChain integrations for Google Cloud SQL for PostgreSQL"
5-
readme = "README.md"
5+
readme = "README.rst"
66
license = {file = "LICENSE"}
77
requires-python = ">=3.8"
88
authors = [

samples/langchain_quick_start.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,4 +1016,4 @@
10161016
},
10171017
"nbformat": 4,
10181018
"nbformat_minor": 0
1019-
}
1019+
}

0 commit comments

Comments
 (0)