Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Latest commit

 

History

History
52 lines (42 loc) · 2.05 KB

experimentation.mdx

File metadata and controls

52 lines (42 loc) · 2.05 KB
title description icon
Experimentation Support
This tutorial explains how to do experiments in your Wyvern Pipelines.
flask

Wyvern experimentation framework is designed to be agnostic to your preferred experimentation provider. It is designed to be flexible and allow you to use any experimentation provider you want. In this tutorial, we will show you how to use Wyvern with Eppo as your experimentation provider. Currently, Wyvern only supports Eppo as an experimentation provider, but we are working on adding support for other providers.

Prerequisites

  • Install wyvern-ai
  • Create an account on Eppo
  • Set the following environment variables:
    • EXPERIMENTATION_ENABLED: Whether experimentation is enabled, set it to true
    • EXPERIMENTATION_PROVIDER: The experimentation provider, set it to eppo
    • EPPO_API_KEY: The API key for Eppo, you can find it in your Eppo account

Assign treatments to your users

from wyvern.experimentation.client import experimentation_client

treatment = experimentation_client.get_experiment_result(
    "wyvern-test-feature-flag",
    request.user.user_id,
    # Add additional targeting attributes as you defined
    # them in your experiment in Eppo.
    # You can add as many as you like but instead of
    # passing a dictionary, you need to pass them as separate
    # keyword arguments.
    userID=12345678,
)

Use the treatment in your pipeline

if treatment == "on":
    # Do something
elif treatment == "off":
    # Do something else
else:
    # Do something else

This is how you can use Wyvern with Eppo. If you want to use Wyvern with another experimentation provider, please feel free to get your hands dirty and contribute to Wyvern Library. We are always looking for contributors.

Here is the link to the source code for the experimentation module in Wyvern.