Skip to content

Commit

Permalink
updating the dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfmezger committed Jun 8, 2024
1 parent 6495cfe commit 1b85ab3
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 289 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ repos:
language_version: python3.11
- id: poetry-export
args: ["-f", "requirements.txt", "-o", "requirements.txt"]

# - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
# rev: v1.3.1
# hooks:
Expand Down
32 changes: 29 additions & 3 deletions agent/utils/vdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,35 @@ def init_vdb(cfg: DictConfig, collection_name: str, embedding: Embeddings) -> Qd


@load_config("config/main.yml")
def load_vec_db_conn(cfg: DictConfig) -> QdrantClient:
"""Load the Vector Database Connection."""
return QdrantClient(cfg.qdrant.url, port=cfg.qdrant.port, api_key=os.getenv("QDRANT_API_KEY"), prefer_grpc=cfg.qdrant.prefer_grpc), cfg
def load_vec_db_conn(cfg: DictConfig) -> Tuple[QdrantClient, DictConfig]:
"""
Load the Vector Database Connection.
This function creates a new QdrantClient instance using the configuration
parameters provided in the 'cfg' argument. The QdrantClient is used to
interact with the Qdrant vector database.
Args:
-----
cfg (DictConfig): A configuration object that contains the settings
for the QdrantClient. It should have 'url', 'port',
and 'prefer_grpc' fields under the 'qdrant' key.
Returns:
--------
Tuple[QdrantClient, DictConfig]: A tuple containing the created
QdrantClient instance and the
original configuration object.
"""
return (
QdrantClient(
cfg.qdrant.url,
port=cfg.qdrant.port,
api_key=os.getenv("QDRANT_API_KEY"),
prefer_grpc=cfg.qdrant.prefer_grpc
),
cfg
)


def initialize_vector_db(collection_name: str, embeddings_size: int) -> None:
Expand Down
Loading

0 comments on commit 1b85ab3

Please sign in to comment.