Skip to content

--count option for openai-to-sqlite search #13

@simonw

Description

@simonw

Is currently hard-coded to 10:

@cli.command()
@click.argument(
"db_path",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
)
@click.argument("query")
@click.option(
"--token",
help="OpenAI API key",
envvar="OPENAI_API_KEY",
)
@click.option(
"table_name",
"-t",
"--table",
default="embeddings",
help="Name of the table containing the embeddings",
)
def search(db_path, query, token, table_name):
"""
Search embeddings using cosine similarity against a query
"""

results.sort(key=lambda r: r[1], reverse=True)
for id, score in results[:10]:
print(f"{score:.3f} {id}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions