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.3.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.3.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: search_prompts-1.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 3cf29a228b9e35321e84a4179ff9df3f65f87a0dca40caf344b4efa8ee3c8dbc
MD5 d86185322a3a0fe8057f30a27495c049
BLAKE2b-256 4ed8baafcdb31ee9b687c6d53f46d0074f034074209e30d9301df7482de58e66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: search_prompts-1.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cca274e68df0ed68ab58975e7fcad341cdc7dcfb4e5d2f1baca118de93f1e35
MD5 659e7a795326f2186093eb752648a223
BLAKE2b-256 eeec4ba1e45c8e41f354933dad5d7ddf0ebe5c97d5c2f517254a3201c1b0c5ba

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