Generation and Evaluation

Find your optimized system prompt automatically

Given shadow traffic of inputs you expect your system to handle, Farsight will automatically generate your use case information and iteratively generate and converge to an optimal system prompt.

Make sure you have your OpenAI API Key before you begin.

Best Prompt

get_best_system_prompts()

Generates, evaluates, and iteratively improves system prompts to produce the optimized system prompt based our your shadow traffic.

Not happy with your results? Set gpt_optimized=True for better results utilizing gpt-4for prompt generation calls although it increases some costs.

Prompt Evaluation Response Format

PromptEvaluation Object: 
    score: average score accross tested inputs
    system_prompt: generated system prompt
    test_results: TestResults Object:
        score: score of test input:
        input: inputed message
        output: response generated from gpt-3.5-turbo 
from farsightai import FarsightAI

# Replace with your openAI credentials
OPEN_AI_KEY = "<openai_key>"

farsight = FarsightAI(openai_key=OPEN_AI_KEY)

shadow_traffic = [
    "What are the current job openings in the company?",
    "How can I apply for a specific position?",
    "What is the status of my job application?",
    "Can you provide information about the company's benefits and perks?",
    "What is the company's policy on remote work or flexible schedules?",
    "How do I update my personal information in the HR system?",
    "Can you explain the process for employee onboarding?",
    "What training and development opportunities are available for employees?",
    "How is performance evaluation conducted in the company?",
    "Can you assist with information about employee assistance programs or wellness initiatives?",
]

best_prompts = farsight.get_best_system_prompts(shadow_traffic, gpt_optimized=True)
print (best_prompts)
# Result:
# [
#     PromptEvaluation(
#         score=4.666666666666667, 
#         system_prompt="<SYS> Thank you for reaching out to our HR chatbot. How can I assist you with your HR-related queries while ensuring the protection ...""
#         test_results=[
#               TestResult(
#                     score=5, 
#                     input="What is the company's policy on remote work or flexible schedules?   "
#                     output="Our company recognizes the importance of work-life balance and understands that remote work or flexible schedules can contribute ..."
#               ), 
#               TestResult( ... ),
#               TestResult( ... ),
#           ]),
#     PromptEvaluation( ... ),
#     PromptEvaluation( ... )
# ]

Last updated