community: docstrings (#23202)

Added missed docstrings. Format docstrings to the consistent format
(used in the API Reference)
This commit is contained in:
Leonid Ganeline
2024-06-20 08:08:13 -07:00
committed by GitHub
parent 6a1a0d977a
commit 51e75cf59d
11 changed files with 199 additions and 4 deletions

View File

@@ -173,6 +173,16 @@ def create_index(
vector_store: OracleVS,
params: Optional[dict[str, Any]] = None,
) -> None:
"""Create an index on the vector store.
Args:
client: The OracleDB connection object.
vector_store: The vector store object.
params: Optional parameters for the index creation.
Raises:
ValueError: If an invalid parameter is provided.
"""
if params:
if params["idx_type"] == "HNSW":
_create_hnsw_index(
@@ -351,6 +361,15 @@ def _create_ivf_index(
@_handle_exceptions
def drop_table_purge(client: Connection, table_name: str) -> None:
"""Drop a table and purge it from the database.
Args:
client: The OracleDB connection object.
table_name: The name of the table to drop.
Raises:
RuntimeError: If an error occurs while dropping the table.
"""
if _table_exists(client, table_name):
cursor = client.cursor()
with cursor:
@@ -364,6 +383,15 @@ def drop_table_purge(client: Connection, table_name: str) -> None:
@_handle_exceptions
def drop_index_if_exists(client: Connection, index_name: str) -> None:
"""Drop an index if it exists.
Args:
client: The OracleDB connection object.
index_name: The name of the index to drop.
Raises:
RuntimeError: If an error occurs while dropping the index.
"""
if _index_exists(client, index_name):
drop_query = f"DROP INDEX {index_name}"
with client.cursor() as cursor:

View File

@@ -748,6 +748,14 @@ class VectaraRetriever(VectorStoreRetriever):
class VectaraRAG(Runnable):
"""Vectara RAG runnable.
Parameters:
vectara: Vectara object
config: VectaraQueryConfig object
chat: bool, default False
"""
def __init__(
self, vectara: Vectara, config: VectaraQueryConfig, chat: bool = False
):
@@ -762,10 +770,12 @@ class VectaraRAG(Runnable):
config: Optional[RunnableConfig] = None,
**kwargs: Any,
) -> Iterator[dict]:
"""get streaming output from Vectara RAG
"""Get streaming output from Vectara RAG.
Args:
query: The input query
input: The input query
config: RunnableConfig object
kwargs: Any additional arguments
Returns:
The output dictionary with question, answer and context