Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt

Use this file to discover all available pages before exploring further.

Filtering

Filters allow you to narrow down your query results. The API supports different filter operators depending on the field type.

Filter Structure

For standard fields, use fieldName:
{
    "fieldName": "modelName",
    "operator": "IN",
    "value": ["gpt-4", "gpt-3.5-turbo"]
}

Filterable Fields

FieldTypeDescription
modelNamestringThe name of the LLM model
requestTypestringType of request (e.g., “chat”, “completion”)
userEmailstringThe email of the user making requests
virtualAccountstringThe virtual account name
teamarrayTeams associated with the request
latencyMsnumberRequest latency in milliseconds
conversationIDstringThe conversation identifier
virtualModelNamestringThe virtual model name
inputTokensnumberNumber of input tokens
outputTokensnumberNumber of output tokens

Filter Operators

String Field Operators

OperatorDescriptionExample Value
EQUALExact match"gpt-4"
INMatch any value in the list["gpt-4", "gpt-3.5-turbo"]
NOT_INExclude values in the list["deprecated-model"]
STRING_CONTAINSContains substring"gpt"
STRING_STARTS_WITHStarts with prefix"gpt-"
STRING_ENDS_WITHEnds with suffix"-turbo"
GREATER_THANLexicographically greater than"gpt-3"
LESS_THANLexicographically less than"gpt-5"
GREATER_THAN_EQUALLexicographically greater than or equal"gpt-3"
LESS_THAN_EQUALLexicographically less than or equal"gpt-5"
BETWEENLexicographically between two values["a", "z"]
# Filter for specific models
{
    "fieldName": "modelName",
    "operator": "IN",
    "value": ["gpt-4", "gpt-3.5-turbo"]
}

# Exclude specific users
{
    "fieldName": "userEmail",
    "operator": "NOT_IN",
    "value": ["excluded@example.com"]
}

# Filter models containing "gpt"
{
    "fieldName": "modelName",
    "operator": "STRING_CONTAINS",
    "value": "gpt"
}

# Filter models starting with "claude"
{
    "fieldName": "modelName",
    "operator": "STRING_STARTS_WITH",
    "value": "claude"
}

Numeric Field Operators

OperatorDescriptionExample Value
EQUALExact match1000
GREATER_THANGreater than value1000
LESS_THANLess than value5000
GREATER_THAN_EQUALGreater than or equal to100
LESS_THAN_EQUALLess than or equal to1000
BETWEENBetween two values (inclusive)[500, 5000]
INMatch any value in the list[100, 200, 300]
NOT_INExclude values in the list[0]
# Filter for high latency requests
{
    "fieldName": "latencyMs",
    "operator": "GREATER_THAN",
    "value": 1000
}

# Filter for latency within a range
{
    "fieldName": "latencyMs",
    "operator": "BETWEEN",
    "value": [500, 5000]
}

# Filter for requests with significant input tokens
{
    "fieldName": "inputTokens",
    "operator": "GREATER_THAN",
    "value": 100
}

Array Field Operators (Teams)

OperatorDescriptionExample Value
ARRAY_HAS_ANYMatch if array contains any of the values["team-alpha", "team-beta"]
ARRAY_HAS_NONEMatch if array contains none of the values["excluded-team"]
# Filter for specific teams
{
    "fieldName": "team",
    "operator": "ARRAY_HAS_ANY",
    "value": ["team-alpha", "team-beta"]
}

# Exclude specific teams
{
    "fieldName": "team",
    "operator": "ARRAY_HAS_NONE",
    "value": ["excluded-team"]
}

Combining Multiple Filters

You can combine multiple filters in a single query. All filters are applied with AND logic:
{
    "startTs": "2025-01-21T00:00:00.000Z",
    "endTs": "2025-01-22T00:00:00.000Z",
    "datasource": "modelMetrics",
    "type": "distribution",
    "aggregations": [],
    "filters": [
        {
            "fieldName": "virtualModelName",
            "operator": "IS_NULL",
            "value": true
        },
        {
            "fieldName": "modelName",
            "operator": "IN",
            "value": ["gpt-4", "gpt-3.5-turbo"]
        },
        {
            "fieldName": "latencyMs",
            "operator": "LESS_THAN",
            "value": 5000
        },
        {
            "fieldName": "team",
            "operator": "ARRAY_HAS_ANY",
            "value": ["team-alpha"]
        },
        {
            "metadataKey": "environment",
            "operator": "IN",
            "value": ["production"]
        }
    ],
    "groupBy": ["modelName", "team"]
}