def add_examples(dataset_id: str):
"""Create example datasets for few-shot learning."""
examples = [
{
"input": RoomDatabaseEntry(
hotel_name="Seaside Resort",
room_count=2,
view="ocean",
beds=1,
price_per_night=250,
amenities=["wifi", "room service", "minibar", "balcony"]
).model_dump(),
"output": RoomDescription(
description="This room at Seaside Resort features an elegant 2-room oceanfront suite with a comfortable king bed and private balcony offering stunning ocean views. Premium amenities include complimentary WiFi, personalized room service, and a well-stocked minibar. Perfect for couples seeking a romantic getaway or honeymooners looking for luxury and privacy."
).model_dump(),
"comment": "Example of a luxury oceanview suite with emphasis on romantic atmosphere"
},
{
"input": RoomDatabaseEntry(
hotel_name="Mountain Lodge",
room_count=3,
view="mountain",
beds=4,
price_per_night=350,
amenities=["wifi", "fireplace", "kitchen", "ski storage", "parking"]
).model_dump(),
"output": RoomDescription(
description="This room at Mountain Lodge features a spacious 3-room suite with 4 comfortable beds, a fully equipped kitchen, and a cozy fireplace. The breathtaking mountain views complement modern amenities like WiFi and convenient ski storage, with complimentary parking included. Ideal for families or groups of friends planning an active mountain getaway."
).model_dump(),
"comment": "Example of a family-friendly mountain suite with practical amenities"
},
{
"input": RoomDatabaseEntry(
hotel_name="Urban Boutique Hotel",
room_count=1,
view="city",
beds=1,
price_per_night=150,
amenities=["wifi", "workspace", "coffee maker", "gym access"]
).model_dump(),
"output": RoomDescription(
description="This room at Urban Boutique Hotel features a modern space with a comfortable queen bed, dedicated workspace, and spectacular city views. Amenities include complimentary high-speed WiFi, an in-room coffee maker, and access to our fitness center. Perfect for business travelers who need a productive and convenient city-center base."
).model_dump(),
"comment": "Example of a business-oriented city room with focus on productivity"
}
]
# We populate the dataset of the function with these examples
for example in examples:
try:
opper.datasets.create_entry(
dataset_id=dataset_id,
input=str(example["input"]),
output=str(example["output"]),
comment=str(example["comment"])
)
except Exception as e:
print(f"Error adding example: {e}")