Hypster Docs
Github 🌟Contact Us
  • 👋Welcome
  • Getting Started
    • 🖥️Installation
    • 🚀Defining of A Config Function
    • ⚡Instantiating a Config Function
    • 🍡Selecting Output Variables
    • 🎮Interactive Instantiation (UI)
    • 🪄Usage Examples
      • Machine Learning
      • LLM Generation
  • In Depth
    • 🤖Parameter Naming
    • 🍱HP Call Types
      • Selectable Types
      • Numeric Types
      • Boolean Types
      • Textual Types
      • Nested Configurations
    • 🧠Best Practices
Powered by GitBook

Contact & Follow the Author

  • Website
  • LinkedIn
  • Github
  • Medium

© Gilad Rubin 2024

On this page
  • Function Signatures
  • Usage Examples
  • Single Text Values
  • Multiple Text Values
  • Reproducibility

Was this helpful?

Edit on GitHub
  1. In Depth
  2. HP Call Types

Textual Types

Hypster provides string parameter configuration through text and multi_text methods. These methods handle string values without additional validation.

Function Signatures

def text(
    default: str,
    *,
    name: Optional[str] = None
) -> str

def multi_text(
    default: List[str] = [],
    *,
    name: Optional[str] = None
) -> List[str]

Usage Examples

Single Text Values

# Single text parameter with default
model_name = hp.text("gpt-4")
prompt_prefix = hp.text("You are a helpful assistant.")

# Usage
config(values={"model_name": "claude-3"})
config(values={"prompt_prefix": "You are an expert programmer."})

Multiple Text Values

# Multiple text parameters with defaults
stop_sequences = hp.multi_text(["###", "END"])
system_prompts = hp.multi_text([
    "You are a helpful assistant.",
    "Answer concisely."
])

# Usage
config(values={"stop_sequences": ["STOP", "END", "DONE"]})
config(values={"system_prompts": ["Be precise.", "Show examples."]})

Reproducibility

All textual parameters are fully serializable and reproducible:

# Configuration will be exactly reproduced
snapshot = config.get_last_snapshot()
restored_config = config(values=snapshot)
PreviousBoolean TypesNextNested Configurations

Last updated 6 months ago

Was this helpful?

🍱