diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8ca14e7f..5d3a11b3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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 diff --git a/docs/source/faqs.rst b/docs/source/faqs.rst index b0a900dc..7c8b060b 100644 --- a/docs/source/faqs.rst +++ b/docs/source/faqs.rst @@ -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. diff --git a/libs/agentc_cli/agentc_cli/cmds/clean.py b/libs/agentc_cli/agentc_cli/cmds/clean.py index e9487794..c707c2a5 100644 --- a/libs/agentc_cli/agentc_cli/cmds/clean.py +++ b/libs/agentc_cli/agentc_cli/cmds/clean.py @@ -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, diff --git a/libs/agentc_cli/agentc_cli/cmds/status.py b/libs/agentc_cli/agentc_cli/cmds/status.py index 0abd91a9..3d5ebf78 100644 --- a/libs/agentc_cli/agentc_cli/cmds/status.py +++ b/libs/agentc_cli/agentc_cli/cmds/status.py @@ -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) diff --git a/libs/agentc_cli/agentc_cli/main.py b/libs/agentc_cli/agentc_cli/main.py index 10d62ace..be6c3b29 100644 --- a/libs/agentc_cli/agentc_cli/main.py +++ b/libs/agentc_cli/agentc_cli/main.py @@ -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, @@ -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"), @@ -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) @@ -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, @@ -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", @@ -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) diff --git a/libs/agentc_cli/tests/test_click.py b/libs/agentc_cli/tests/test_click.py index 547b207e..34437040 100644 --- a/libs/agentc_cli/tests/test_click.py +++ b/libs/agentc_cli/tests/test_click.py @@ -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. @@ -228,14 +228,14 @@ 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") @@ -243,7 +243,7 @@ def test_status(tmp_path, get_isolated_server): # 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") @@ -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." diff --git a/libs/agentc_core/agentc_core/defaults.py b/libs/agentc_core/agentc_core/defaults.py index b21f748a..80a69f8b 100644 --- a/libs/agentc_core/agentc_core/defaults.py +++ b/libs/agentc_core/agentc_core/defaults.py @@ -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" diff --git a/libs/agentc_testing/agentc_testing/repo.py b/libs/agentc_testing/agentc_testing/repo.py index 06b84775..e50a9dca 100644 --- a/libs/agentc_testing/agentc_testing/repo.py +++ b/libs/agentc_testing/agentc_testing/repo.py @@ -101,6 +101,7 @@ def initialize_repo( click_command, ["publish", "prompt", "--bucket", "travel-sample"] + (publish_args or []) ) ) + print(output) return output