Skip to content

Commit

Permalink
Merge branch 'master' into ignore_file
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ202 authored Jan 16, 2025
2 parents 662e797 + 0892c4d commit e4871b2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ The mono-repo for the Couchbase Agent Catalog project.
git clone [email protected]:couchbaselabs/agent-catalog.git
```

3. You are now ready to install the Agent Catalog package!
3. You are now ready to install the Agent Catalog package! We recommend using Anaconda to create a virtual environment
for your project to ensure no global dependencies interfere with the project.
Using your project's Python environment, execute the following command to install a local package with `pip`:

```bash
Expand All @@ -45,6 +46,11 @@ The mono-repo for the Couchbase Agent Catalog project.
# Install the agentc package.
pip install libs/agentc
```
If you are interested in developing with langchain, also install `agentc_langchain` by running the following:

```bash
pip install libs/agentc_langchain
```

If you are interested in building a ``.whl`` file (for later use in ``.whl``-based installs), use :command:`poetry`
directly:
Expand Down Expand Up @@ -107,12 +113,12 @@ Commands:
execute Search and execute a specific tool.
find Find items from the catalog based on a natural language QUERY string or by name.
index Walk the source directory trees (SOURCE_DIRS) to index source files into the local catalog.
ls List all tools or prompts in the catalog.
publish Upload the local catalog to a Couchbase instance.
ls List all indexed tools and/or prompts in the catalog.
publish Upload the local catalog and/or logs to a Couchbase instance.
status Show the status of the local catalog.
version Show the current version of agentc.

See: https://docs.couchbase.com for more information.
See: https://docs.couchbase.com or https://couchbaselabs.github.io/agent-catalog/index.html# for more information.
```

If you see the output above, you are all set! Head on over to our [docs](https://couchbaselabs.github.io/agent-catalog/) or our [templates](templates) to start
Expand Down
2 changes: 1 addition & 1 deletion libs/agentc_cli/agentc_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def resolve_command(self, ctx, args):

@click.group(
cls=AliasedGroup,
epilog="See: https://docs.couchbase.com for more information.",
epilog="See: https://docs.couchbase.com or https://couchbaselabs.github.io/agent-catalog/index.html# for more information.",
context_settings=dict(max_content_width=800),
)
@click.option(
Expand Down
19 changes: 6 additions & 13 deletions libs/agentc_core/agentc_core/catalog/catalog/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion libs/agentc_core/tests/README.md
Original file line number Diff line number Diff line change
@@ -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`.
3 changes: 1 addition & 2 deletions templates/agents/with_controlflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,7 +56,7 @@ This directory contains a starter project for building agents with Couchbase, Co
status Show the status of the local catalog.
version Show the current version of agentc.

See: https://docs.couchbase.com for more information.
See: https://docs.couchbase.com or https://couchbaselabs.github.io/agent-catalog/index.html# for more information.
```

6. Make sure your Git repo is clean, and run `agentc index` to index your tools and prompts.
Expand Down

0 comments on commit e4871b2

Please sign in to comment.