Skip to main content

A library for efficient text-based prompt search with resource monitoring.

Project description

Search Prompts

search-prompts is a library for efficient text search in Hugging Face datasets with resource monitoring (CPU, memory, network).

Installation

You can install the library via pip: pip install search-prompts

Example Usage

from search_prompts import search_prompts_with_monitoring

Search parameters

query = "You are an AI assistant" dataset_name = "rombodawg/Everything_Instruct" config_name = "default"

Perform search with resource monitoring

matching_prompts, resource_usage = search_prompts_with_monitoring( query=query, dataset_name=dataset_name, config_name=config_name, batch_size=1000, max_results=5, chunk_size=5000, monitor_interval=1, )

Perform search without resource monitoring

matching_prompts = search_prompts_direct( query=query, dataset_name=dataset_name, config_name=config_name, batch_size=1000, max_results=5, chunk_size=5000, )

Display search results

print("\nSearch Results:") if matching_prompts: for instruction in matching_prompts: print(f"- {instruction}") else: print("No matches found.")

Display resource usage

print("\nResource Usage During Execution:") print(f"Average CPU Usage: {resource_usage['avg_cpu_usage']:.2f}%") print(f"Peak Memory Usage: {resource_usage['peak_memory_usage']:.2f} MB") print(f"Network Data Sent: {resource_usage['network_sent_mb']:.2f} MB") print(f"Network Data Received: {resource_usage['network_recv_mb']:.2f} MB") print(f"Total Execution Time: {resource_usage['total_execution_time']:.2f} seconds")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

search_prompts-1.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

search_prompts-1.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file search_prompts-1.2.0.tar.gz.

File metadata

  • Download URL: search_prompts-1.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for search_prompts-1.2.0.tar.gz
Algorithm Hash digest
SHA256 d6e67be40e1a24dfd5b7f6326c766737b554c1931e0c44fb802a66eb66bede21
MD5 9af3747eb61682a3a321feee12443cdc
BLAKE2b-256 ba3b7c4e93782390ab726df67428f525a61c9c1dd82cd504c09feb161ac89851

See more details on using hashes here.

File details

Details for the file search_prompts-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: search_prompts-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for search_prompts-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3ab4721c08b0285a13790ea12e31334ee9a332eca5c2baae4d576f05441f607
MD5 fb1f50080dde056a8aa4d03a4dda262a
BLAKE2b-256 70542039246f15b42d91ebc8d79081a261f494df20b4e5bee1e2e3ae3e5450a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page