mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 04:49:17 +00:00
community: docstrings (#23202)
Added missed docstrings. Format docstrings to the consistent format (used in the API Reference)
This commit is contained in:
@@ -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:
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user