Skip to content

Commit

Permalink
feat: add cli for preparing env
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Nov 26, 2023
1 parent 49412b0 commit f7568b4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions srctag/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import chromadb
import click

from chromadb.utils.embedding_functions import SentenceTransformerEmbeddingFunction


@click.group()
def cli():
pass


@cli.command()
def prepare():
# try to embed
chromadb_cli = chromadb.Client()
collection = chromadb_cli.get_or_create_collection(
"testonly",
embedding_function=SentenceTransformerEmbeddingFunction(),
)
collection.add(
documents=["doc"],
metadatas=[{}],
ids=["id"],
)
assert collection.count() == 1

click.echo("ok.")


if __name__ == '__main__':
cli()

0 comments on commit f7568b4

Please sign in to comment.