Opik Query Language (OQL)
OQL provides a powerful, SQL-like syntax for filtering data in Opik. Itβs used with various SDK methods like searchPrompts()
to find exactly the data you need using expressive filter conditions.
Operators
String Operators
Comparison Operators
List Operators
Combining Conditions
Use AND
to combine multiple filter conditions. All conditions must be true for a result to match:
Currently, only AND
logic is supported. OR
logic is not available in OQL.
Examples
These examples use searchPrompts()
but the same OQL syntax works with other
search methods. Specific resource types may support additional fields - see
their respective documentation.
Syntax Rules
String Values
Always wrap string values in double quotes:
Error Handling
Best Practices
- Use descriptive tag hierarchies - Structure tags like
"production"
,"staging"
,"team-alpha"
for effective filtering - Use naming conventions - Implement consistent naming patterns (e.g.,
"prod-"
prefix) to enable powerful filtering - Handle errors - Always wrap OQL queries in try-catch blocks to handle syntax errors gracefully