AI model flags
Read time: 4 minutes
Last edited: Sep 20, 2024
AI model flags are available only if you opt in through a feature preview. To enable AI model flags, click your member icon in the left sidenav and choose Feature preview from the menu. In the Feature preview dialog, toggle the "AI flag templates" on or off.
Overview
This topic explains how you can use artificial intelligence (AI) model flags to roll out and test new large language models (LLMs) within your generative AI applications. You can use AI model flags to deliver new AI models and configurations for large language models.
About AI model flags
AI model flags, sometimes called LLM flags, are JSON flags. Each flag variation contains the following:
- A
modelID
field, which identifies the LLM in use. Over time LaunchDarkly will introduce new models to adjust to different use cases, training data parameters, vendors, and more. - One or more configuration parameters, which are specific to the LLM. For example, many LLMs include parameters for
temperature
,max_token
,top_p
, ortop_k
. Each LLM provider uses different parameters.
Create AI model flags
To create an AI model flag:
- Navigate to the Flags list.
- Click Create flag. The "Create new flag" page appears.
- Enter a unique, human-readable Name.
- (Optional) Update the flag Key. You'll use this key to reference the flag in your code. A suggested key auto-populates from the name you enter, but you can customize it if you wish.
- (Optional) Enter a Description of the flag. A brief, human-readable description helps your account members understand what the flag is for.
- (Optional) Update the Maintainer for the flag.
- (Optional) Check the Include flag in this project's release pipeline box. To learn more, read Release pipelines.
- Choose the AI model template in the Configuration section:
- Choose Yes or No to indicate whether this flag is temporary. AI model flags are usually permanent.
- Select the JSON flag type.
- In the "Variations" section, review each variation and update as needed. Each variation identifies the LLM, in the
modelID
field, and its configuration parameters. - (Optional) Update the default variations.
- Choose one or more tags from the Tags menu.
- Check the SDKs using Mobile Key and/or SDKs using client-side ID boxes to indicate which client-side SDKs you will use to evaluate this flag. If you are using a server-side SDK, leave these boxes unchecked.
- Click Create flag.
To learn more, read Creating new flags.
Common use cases
In the most common use case, your application includes several AI models within its server-side API configuration. Your application uses a LaunchDarkly SDK to evaluate the AI model flag, and parses the flag variation returned. Then, it uses the LLM and configuration parameters from that flag variation as part of an API request to a specific LLM that is part of your application.
Applications working with AI models typically include a default model, and then have different variations of that model using different model types. For example, you might use an existing Anthropic Claude model for v1 instant, as well as a model variation that supports Claude 3 Haiku, and another variation that supports Claude 3 Sonnet. Each model variation corresponds to a flag variation in your AI model flag. Your application might use all model variations for testing purposes, to determine which one is most viable based on data and cost.
Organizations introduce new AI models frequently, so we expect that you will create new flag variations for your AI model flag to reflect this. For example, you may add new flag variations for additional versions of an existing configuration. You may also add new flag variations to introduce new models from different vendors or upgraded models from your existing vendor.
We recommend that you use experiments to measure the effectiveness of these models, alongside metrics such as user sentiment, token count, or content conversion. To learn more, read Experimentation.
Modify the AI model flag template
To modify your AI model flag template:
- Click the project dropdown. The project menu appears:
- Select Project settings.
- Select Flags. The Flags settings list appears.
- In the "Flag templates section, click pencil icon next to "AI model."
- Choose Yes or No to mark all AI model flags as temporary or permanent.
- In the "Variations" section, edit the flag variation Names.
- In the "Default variations" section, choose which default variations to serve when the flag is toggled On or Off.
- In the "Tags" section, type to add tags to each new flag by default.
- Click Save.
Verify that the updated default template settings are correct by navigating to the Flags list and creating a new AI model flag.