Skip to content

Commit

Permalink
- reran the regression tests and found regressions :-) (they are now …
Browse files Browse the repository at this point in the history
…fixed)

- status command now uses kind as an argument instead of an option
- publish workflow needs some work, commenting out the failing bits for now
  • Loading branch information
glennga committed Oct 30, 2024
1 parent 2f5e8bc commit 8b571f4
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 47 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@ jobs:
poetry build
poetry publish -r testpypi
- name: Build the agentc_cli package
run: |
cd libs/agentc_cli
poetry build
poetry publish -r testpypi
- name: Build the agentc_langchain package
run: |
cd libs/agentc_langchain
poetry build
poetry publish -r testpypi
- name: Build the agentc package
run: |
cd libs/agentc
poetry build
poetry publish -r testpypi
# TODO (GLENN): We need to add a step to make the agentc packages in pyproject.toml not relative.
# - name: Build and publish the agentc_cli package
# run: |
# cd libs/agentc_cli
# poetry build
# poetry publish -r testpypi
#
# - name: Build and publish the agentc_langchain package
# run: |
# cd libs/agentc_langchain
# poetry build
# poetry publish -r testpypi
#
# - name: Build and publish the agentc package
# run: |
# cd libs/agentc
# poetry build
# poetry publish -r testpypi
4 changes: 2 additions & 2 deletions docs/source/faqs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ versions of your agent or rolling back your agent due to some regression.
Catalog versions are Git commit hashes.
To roll back to a previous catalog version, follow these steps:

1. **List Catalog Versions** : Start by running the :command:`agentc status` command with the ``--status-db`` flag to
1. **List Catalog Versions** : Start by running the :command:`agentc status` command with the ``-db`` flag to
list all the published catalog versions of tools in your bucket (here, we are checking in ``travel-sample``):

.. code-block:: bash
# run agentc status --help for all options
agentc status --kind tool --status-db --bucket travel-sample
agentc status tool -db --bucket travel-sample
Running the command above will return a list of all the tool catalog snapshots you have published to Couchbase.

Expand Down
2 changes: 1 addition & 1 deletion libs/agentc_cli/agentc_cli/cmds/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def cmd_clean(
is_local: bool,
is_db: bool,
bucket: str,
cluster: couchbase.cluster,
cluster: couchbase.cluster.Cluster,
catalog_ids: tuple[str],
kind: list[typing.Literal["tool", "prompt"]],
ctx: Context = None,
Expand Down
6 changes: 2 additions & 4 deletions libs/agentc_cli/agentc_cli/cmds/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@

def cmd_status(
ctx: Context,
kind: typing.Literal["all", "tool", "prompt"] = "all",
kind: list[typing.Literal["tool", "prompt"]],
include_dirty: bool = True,
status_db: bool = False,
bucket: str = None,
cluster: any = None,
compare: bool = False,
):
catalog_kinds = ["tool", "prompt"] if kind == "all" else [kind]

for catalog_kind in catalog_kinds:
for catalog_kind in kind:
if status_db:
click.secho(DASHES, fg=KIND_COLORS[catalog_kind])
click.secho(catalog_kind.upper(), fg=KIND_COLORS[catalog_kind], bold=True)
Expand Down
25 changes: 13 additions & 12 deletions libs/agentc_cli/agentc_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ def clean(ctx, catalog, bucket, catalog_id, skip_confirm, kind):
kind_list = ["tool", "prompt"] if kind == "all" else [kind]
cmd_clean(
ctx=ctx.obj,
is_db=False,
is_local=True,
is_db=clean_db,
is_local=clean_local,
bucket=bucket,
cluster=cluster,
catalog_ids=catalog_id,
Expand Down Expand Up @@ -490,9 +490,6 @@ def publish(ctx, kind, bucket, annotations):
if len(kind) == 0:
kind = ["tool", "prompt"]

# Get keyspace and connection details
keyspace_details = Keyspace(bucket=bucket, scope=DEFAULT_CATALOG_SCOPE)

# Load all Couchbase connection related data from env
connection_details_env = CouchbaseConnect(
connection_url=os.getenv("AGENT_CATALOG_CONN_STRING"),
Expand All @@ -505,10 +502,10 @@ def publish(ctx, kind, bucket, annotations):
err, cluster = get_connection(conn=connection_details_env)
if err:
raise ValueError(f"Unable to connect to Couchbase!\n{err}")
cluster.close()

# Determine the bucket.
buckets = get_buckets(cluster=cluster)
cluster.close()
if bucket is None and ctx_obj.interactive:
bucket = click.prompt("Bucket", type=click.Choice(buckets), show_choices=True)

Expand All @@ -525,6 +522,9 @@ def publish(ctx, kind, bucket, annotations):
"Add --bucket BUCKET_NAME to your command or run agent clean in interactive mode."
)

# Get keyspace and connection details
keyspace_details = Keyspace(bucket=bucket, scope=DEFAULT_CATALOG_SCOPE)

cmd_publish(
ctx=ctx.obj,
kind=kind,
Expand All @@ -536,12 +536,10 @@ def publish(ctx, kind, bucket, annotations):

# TODO (GLENN): We should make kind an argument here (similar to publish and clean).
@click_main.command()
@click.option(
"--kind",
default="all",
type=click.Choice(["all", "tool", "prompt"], case_sensitive=False),
help="Kind of catalog to show status for.",
show_default=True,
@click.argument(
"kind",
type=click.Choice(["tool", "prompt"], case_sensitive=False),
nargs=-1,
)
@click.option(
"--include-dirty",
Expand Down Expand Up @@ -577,6 +575,9 @@ def status(ctx, kind, include_dirty, status_db, bucket, compare):
"""Show the status of the local catalog."""
ctx_obj: Context = ctx.obj

if len(kind) == 0:
kind = ["tool", "prompt"]

if status_db or compare:
# Get keyspace and connection details
keyspace_details = Keyspace(bucket="", scope=DEFAULT_CATALOG_SCOPE)
Expand Down
14 changes: 7 additions & 7 deletions libs/agentc_cli/tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def test_index(tmp_path):
shutil.copy(resources_folder / "_good_spec.json", tool_folder / "_good_spec.json")
invocation = runner.invoke(click_main, ["index", str(tool_folder.absolute())])

# We should see 6 files scanned and 7 tools indexed.
# We should see 8 files scanned and 9 tools indexed.
output = invocation.output
print(output)
assert "Crawling" in output
assert "Generating embeddings" in output
assert "Catalog successfully indexed" in output
assert "0/6" in output
assert "0/7" in output
assert "0/8" in output
assert "0/9" in output


# Small helper function to publish to a Couchbase catalog.
Expand Down Expand Up @@ -228,22 +228,22 @@ def test_status(tmp_path, get_isolated_server):
publish_catalog(runner, catalog, catalog_folder)

# Case 2 - tool catalog exists locally (testing for only one kind of catalog)
output = runner.invoke(click_main, ["status", "--include-dirty", "--kind", "tool"]).stdout
output = runner.invoke(click_main, ["status", "tool", "--include-dirty"]).stdout
print("Ran assertion for local status when tool catalog exists")
expected_response_local = "local catalog info:\n path : .agent-catalog/tool-catalog.json"
assert expected_response_local in output

# Case 3 - tool catalog exists in db (this test runs after publish test)
output = runner.invoke(
click_main, ["status", "--include-dirty", "--kind", "tool", "--status-db", "--bucket", "travel-sample"]
click_main, ["status", "tool", "--include-dirty", "--status-db", "--bucket", "travel-sample"]
).stdout
expected_response = "db catalog info"
print("Ran assertion for db status when tool catalog exists")
assert expected_response in output

# Case 4 - compare the two catalogs
output = runner.invoke(
click_main, ["status", "--compare", "--kind", "tool", "--bucket", "travel-sample", "--include-dirty"]
click_main, ["status", "tool", "--compare", "--bucket", "travel-sample", "--include-dirty"]
).stdout
expected_response_db_path = "path : travel-sample.agent_catalog.tool"
print("Ran assertion for compare status when tool catalog exists both locally and in db")
Expand Down Expand Up @@ -308,7 +308,7 @@ def test_clean(tmp_path, get_isolated_server):

# Test our status after clean
output = runner.invoke(
click_main, ["status", "--include-dirty", "--kind", "tool", "--status-db", "--bucket", "travel-sample"]
click_main, ["status", "tool", "--include-dirty", "--status-db", "--bucket", "travel-sample"]
).stdout
expected_response_db = (
"ERROR: db catalog of kind tool does not exist yet: please use the publish command by specifying the kind."
Expand Down
5 changes: 1 addition & 4 deletions libs/agentc_core/agentc_core/defaults.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import gitignore_parser

DEFAULT_EMBEDDING_MODEL = dict(
name="sentence-transformers/all-MiniLM-L12-v2",
endpoint="sentence_transformers",
)
DEFAULT_EMBEDDING_MODEL = "sentence-transformers/all-MiniLM-L12-v2"
DEFAULT_MODEL_CACHE_FOLDER = ".model-cache"
DEFAULT_CATALOG_FOLDER = ".agent-catalog"
DEFAULT_CATALOG_SCOPE = "agent_catalog"
Expand Down
1 change: 1 addition & 0 deletions libs/agentc_testing/agentc_testing/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def initialize_repo(
click_command, ["publish", "prompt", "--bucket", "travel-sample"] + (publish_args or [])
)
)
print(output)
return output


Expand Down

0 comments on commit 8b571f4

Please sign in to comment.