8000 fix: API reference doc pipeline by averikitsch · Pull Request #108 · googleapis/langchain-google-cloud-sql-pg-python · GitHub
[go: up one dir, main page]

Skip to content
8000

fix: API reference doc pipeline #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2024
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
3 changes: 2 additions & 1 deletion .kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ python3 -m nox --version
# build docs
nox -s docs

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

# create metadata
python3 -m docuploader create-metadata \
Expand Down
70 changes: 34 additions & 36 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Cloud SQL for PostgreSQL for LangChain
|preview| |pypi| |versions|

- `Client Library Documentation`_
- `How-to Guides`_
- `Product Documentation`_

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

Quick Start
Expand Down Expand Up @@ -87,70 +85,70 @@ Vector Store Usage

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

.. code:: python
.. code-block:: python

from langchain_google_cloud_sql_pg import PostgresVectorstore, PostgresEngine
from langchain.embeddings import VertexAIEmbeddings
from langchain_google_cloud_sql_pg import PostgresVectorstore, PostgresEngine
from langchain.embeddings import VertexAIEmbeddings


engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
engine.init_vectorstore_table(
table_name="my-table",
vector_size=768, # Vector size for `VertexAIEmbeddings()`
)
embeddings_service = VertexAIEmbeddings()
vectorstore = PostgresVectorStore.create_sync(
engine,
table_name="my-table",
embeddings=embedding_service
)
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
engine.init_vectorstore_table(
table_name="my-table",
vector_size=768, # Vector size for `VertexAIEmbeddings()`
)
embeddings_service = VertexAIEmbeddings()
vectorstore = PostgresVectorStore.create_sync(
engine,
table_name="my-table",
embeddings=embedding_service
)

See the full `Vector Store`_ tutorial.

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

Document Loader Usage
~~~~~~~~~~~~~~~~~~~~~

Use a document loader to load data as Documents.

.. code:: python
.. code-block:: python

from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader
from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader


engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
loader = PostgresSQLLoader.create_sync(
engine,
table_name="my-table-name"
)
docs = loader.lazy_load()
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
loader = PostgresSQLLoader.create_sync(
engine,
table_name="my-table-name"
)
docs = loader.lazy_load()

See the full `Document Loader`_ tutorial.

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

Chat Message History Usage
~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

.. code:: python
.. code-block:: python

from langchain_google_cloud_sql_pg import PostgresChatMessageHistory, PostgresEngine
from langchain_google_cloud_sql_pg import PostgresChatMessageHistory, PostgresEngine


engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
engine.init_chat_history_table(table_name="my-message-store")
history = PostgresChatMessageHistory.create_sync(
engine,
table_name="my-message-store",
session_id="my-session_id"
)
engine = PostgresEngine.from_instance("project-id", "region", "my-instance", "my-database")
engine.init_chat_history_table(table_name="my-message-store")
history = PostgresChatMessageHistory.create_sync(
engine,
table_name="my-message-store",
session_id="my-session_id"
)

See the full `Chat Message History`_ tutorial.

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

Contributing
~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import os
import pathlib
import shutil
from pathlib import Path
from typing import Optional

import nox

Expand All @@ -28,6 +30,7 @@
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
nox.options.sessions = [
"docs",
"docfx",
]

# Error if a python version is missing
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "langchain-google-cloud-sql-pg"
dynamic = ["version"]
description = "LangChain integrations for Google Cloud SQL for PostgreSQL"
readme = "README.md"
readme = "README.rst"
license = {file = "LICENSE"}
requires-python = ">=3.8"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion samples/langchain_quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1016,4 +1016,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
0