Skip to main content

Farsight LLM optimizer

Project description

Revolutionize your prompt engineering with Farsight's OPRO SDK

Stop wasting time with prompt engineering, tailored to your unique inputs and targets, our sdk effortlessly identifies the optimal system prompt for you.

cartoon

Features

  • Python Compatibility: Seamlessly integrates with Python environments.
  • Efficient Prompt Optimization: Streamlines the prompt optimization process in a single step.
  • Automated Testing: Robust testing features for reliability and accuracy.
  • User-Friendly Design: Intuitive and straightforward to use, regardless of your expertise level.

Installation

Install the Farsight OPRO SDK with ease:

pip install farsight-opro

Usage

Dive into the world of optimized prompt engineering with Farsight's OPRO SDK, an implementation inspired by the innovative OPRO paper. Whether you're working on a small project or a large-scale application, our SDK adapts to your needs.

Begin optimizing promptly with this simple setup. For comprehensive guidance, visit our detailed documentation.

from opro import FarsightOPRO

# Define your datasets
train_set, examples, test_set = # ...

# Initialize with your OpenAI key
farsight = FarsightOPRO(openai_key=OPEN_AI_KEY)

# Get optimized prompts
prompts_and_scores = farsight.get_prompts(train_set, examples, test_set)

Full Example:

from opro import FarsightOPRO
import json
from sklearn.model_selection import train_test_split

# Set your OpenAI credentials
farsight = FarsightOPRO(openai_key="<openai_key>")

# Load your dataset
dataset_path = "/opro/src/bbh/movie_recommendation.json"
with open(dataset_path, "r") as file:
    data = json.load(file)

# Split the dataset
examples = data["examples"][:3]  # Choose 3 examples for the prompt
train_set, test_set = train_test_split(data["examples"], train_size=0.20)

# Train and get prompts with scores
prompts_and_scores = farsight.train(train_set, examples, test_set)

# Output example
#  [{
#    "prompt": "Select a movie matching the genres, popularity, critical acclaim, and quality of provided examples for accurate recommendations.",
#    "train_score": 0.94,
#    "test_score": 0.88
#   }, ...]

Contributing

Bug Reports & Feature Requests

Encounter an issue or have an idea? Share your feedback on our issue tracker.

Development Contributions

Your contributions are welcome! Join us in refining and enhancing our prompt optimization library.

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

farsight-opro-0.2.12.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

farsight_opro-0.2.12-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file farsight-opro-0.2.12.tar.gz.

File metadata

  • Download URL: farsight-opro-0.2.12.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for farsight-opro-0.2.12.tar.gz
Algorithm Hash digest
SHA256 6a08745ac35066ab85417e8f41631fc3e3a017f1a13afe06eab5058316a8753f
MD5 fd188945d3dce31f5d18b3e8bc9938d9
BLAKE2b-256 62df62f93caeb5ab50560da89560febfb9ee629cac59aac17f862c4f7a7a8233

See more details on using hashes here.

File details

Details for the file farsight_opro-0.2.12-py3-none-any.whl.

File metadata

File hashes

Hashes for farsight_opro-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 6367a53e8bb07ac2ffa0fa1adfcf720eb0a57662773cf378afb003fdcb33640f
MD5 516e87091056d9e7e47276bcd6e3bceb
BLAKE2b-256 a38779abb509f29deedd50febce78238a8e1a5ab8d9543b91d4d3948cb5a8479

See more details on using hashes here.

Supported by

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