From fa6c0e88725820c1d8aec39382e45438e94d0419 Mon Sep 17 00:00:00 2001 From: Tanvi Johari Date: Wed, 15 Jan 2025 12:31:17 +0530 Subject: [PATCH 1/2] AV-93813 exec find bug (#43) --- .../agentc_core/catalog/catalog/db.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libs/agentc_core/agentc_core/catalog/catalog/db.py b/libs/agentc_core/agentc_core/catalog/catalog/db.py index 134156d..ac17448 100644 --- a/libs/agentc_core/agentc_core/catalog/catalog/db.py +++ b/libs/agentc_core/agentc_core/catalog/catalog/db.py @@ -63,7 +63,9 @@ def find( """Returns the catalog items that best match a query.""" # Catalog item has to be queried directly - if name is not None and snapshot is not None: + if name is not None: + if snapshot == LATEST_SNAPSHOT_VERSION: + snapshot = self.version.identifier # TODO (GLENN): Need to add some validation around bucket (to prevent injection) # TODO (GLENN): Need to add some validation around name (to prevent injection) item_query = f""" @@ -77,18 +79,6 @@ def find( return [] query_embeddings = None - elif name is not None: - item_query = f""" - FROM `{self.bucket}`.`{DEFAULT_CATALOG_SCOPE}`.`{self.kind}_catalog` AS a - WHERE a.name = $name - SELECT a.*; - """ - res, err = execute_query_with_parameters(self.cluster, item_query, {"name": name}) - if err is not None: - logger.error(err) - return [] - query_embeddings = None - else: # Generate embeddings for user query query_embeddings = self.embedding_model.encode(query) @@ -202,6 +192,9 @@ def find( descriptors.append(descriptor) # We compute the true cosine distance here (Couchbase uses a different score :-)). + if name is not None: + return [SearchResult(entry=descriptors[0], delta=1)] + deltas = self.get_deltas(query_embeddings, [t.embedding for t in descriptors]) results = [SearchResult(entry=descriptors[i], delta=deltas[i]) for i in range(len(deltas))] return sorted(results, key=lambda t: t.delta, reverse=True) From 0fd86da0b260a8a3088029131cb2fac3e243e408 Mon Sep 17 00:00:00 2001 From: Tanvi Johari Date: Wed, 15 Jan 2025 15:45:59 +0530 Subject: [PATCH 2/2] Tj202/pr poetry shell (#45) * Removing poetry shell instruction --- libs/agentc_core/tests/README.md | 2 +- templates/agents/with_controlflow/README.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/agentc_core/tests/README.md b/libs/agentc_core/tests/README.md index 03208df..376548b 100644 --- a/libs/agentc_core/tests/README.md +++ b/libs/agentc_core/tests/README.md @@ -1,5 +1,5 @@ # Agent-Catalog Core Tests 1. Set your current working directory to be the parent folder (`libs/agentc_core`). -2. Activate your Poetry environment with `poetry shell`. +2. Activate your Poetry environment. 3. Run `pytest tests` and wait for the results! To run just the smoke tests, use `pytest tests -m smoke`. \ No newline at end of file diff --git a/templates/agents/with_controlflow/README.md b/templates/agents/with_controlflow/README.md index 42f5aad..f9a4934 100644 --- a/templates/agents/with_controlflow/README.md +++ b/templates/agents/with_controlflow/README.md @@ -27,7 +27,6 @@ This directory contains a starter project for building agents with Couchbase, Co ```bash poetry install --with analysis - poetry shell ``` 5. Run `agentc` to make sure this project has installed correctly (note that your first run will take a couple of