Prerequisites
To query prompts, you need to:- Enable prompt management in your Maxim SDK configuration
- Have deployed prompts on the Maxim platform with deployment rules
Setup
Initialize the Maxim SDK with prompt management enabled:Querying a Single Prompt
Retrieve a specific prompt using deployment variables to match your environment:Querying Multiple Prompts
Retrieve all prompts that match specific deployment criteria:Using Tags for Fine-Grained Filtering
Query prompts using tags for more specific filtering:Folder-Based Organization
Query prompts from specific folders to organize by team or feature:Matching algorithm
Before going into the details of how to use the SDK, let’s understand how the matching algorithm works. Maxim SDK uses best matching entity algorithm.- Let’s assume that, you have asked for a prompt with deployment var
env
asprod
,customerId
as"123"
and a tag,tenantId
as456
forpromptId
-"abc"
. - SDK will first try to find a prompt matching all conditions.
- If we don’t find any matching entity, we enforce only
deploymentVar
conditions (you can override this behaviour, as explained in the next section) and match as many tags as possible. - If we still don’t find any prompt, we check for a prompt version marked as fallback.
- If we still don’t find any prompt, we return
null
.
Overriding fallback algorithm
- You can override fallback algorithm by calling
.exactMatch()
onQueryBuilder
object. That will enforce all conditions to be matched.
- You can override fallback algorithm at each variable level. The third optional parameter in
deploymentVar
&tag
function isenforce
. If you passtrue
to this parameter, it will enforce exact match for that variable.
Caching and Performance
The Maxim SDK automatically caches prompt configurations to improve performance using the cache provided to the constructor.Best Practices
- Environment Separation: Use deployment variables to separate dev/staging/production prompts
- Graceful Degradation: Implement fallback prompts for critical functionality
- Version Management: Use tags to manage prompt versions and gradual rollouts
Next Steps
- CI/CD Integration - Automate prompt testing and deployment
- Local Prompt Testing - Test changes before deployment
- Maxim Prompt Testing - Validate prompt versions