AI SQL and eval helpers (GraphQL)

Related queries and mutations in AI features. Each has its own section.

Queries

createSqlQuery (query)

createSqlQuery is a query in the Monte Carlo GraphQL API, in AI features. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Convert natural language into a SQL query

Arguments

ArgumentTypeDescription
messages[AIMessageInput]!Messages between the user and the AI
warehouseUuidUUID!The identifier of the data warehouse that is being queried
requestUuidUUIDThe identifier of the request if we want to stream the results
existingSqlStringSQL in the user's editor when the conversation started. When provided, the generated query edits or extends it instead of starting from scratch

Returns

AIMessageOutput

Example

query CreateSqlQuery($messages: [AIMessageInput]!, $warehouseUuid: UUID!) {
  createSqlQuery(messages: $messages, warehouseUuid: $warehouseUuid) {
    message
    actor
    status
  }
}

Types used only by createSqlQuery

AIMessageInput

Input object type.

FieldTypeDescription
messageString!Message from the specified actor
actorActorType!The actor that sends the message
mcons[String]The mcons for the tables added in this message

Related types

AIMessageOutput, ActorType, UUID

fixSqlQuery (query)

fixSqlQuery is a query in the Monte Carlo GraphQL API, in AI features. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Given a SQL query it uses AI to fix it

Arguments

ArgumentTypeDescription
sqlQueryString!SQL query to fix
errorMessageString!Error message
warehouseUuidUUID!The identifier of warehouse that is being queried
requestUuidUUIDThe identifier of the request if we want to stream the results

Returns

AIMessageOutput

Example

query FixSqlQuery($sqlQuery: String!, $errorMessage: String!, $warehouseUuid: UUID!) {
  fixSqlQuery(sqlQuery: $sqlQuery, errorMessage: $errorMessage, warehouseUuid: $warehouseUuid) {
    message
    actor
    status
  }
}

Related types

AIMessageOutput, UUID

generateEvalPrompt (query)

generateEvalPrompt is a query in the Monte Carlo GraphQL API, in AI features. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Generate an LLM-as-a-judge evaluation prompt from a description

Arguments

ArgumentTypeDescription
descriptionTextString!Natural language description of what to evaluate
scaleScale!Scoring scale
contextUsageContextUsage!Which template variables to include in the prompt
strictnessStrictness!Strictness tone for evaluation
mconStringMCON of the data source table (required for CUSTOM_FIELDS when schemaFields is not provided)
connectionUuidUUIDConnection UUID for schema lookup (used with CUSTOM_FIELDS)
schemaFields[EvalSchemaFieldInput!]Schema fields to use for CUSTOM_FIELDS context usage. When provided, skips internal schema resolution from mcon/connection_uuid.

Returns

GenerateEvalPromptOutput

Example

query GenerateEvalPrompt($descriptionText: String!, $scale: Scale!, $contextUsage: ContextUsage!, $strictness: Strictness!) {
  generateEvalPrompt(descriptionText: $descriptionText, scale: $scale, contextUsage: $contextUsage, strictness: $strictness) {
    prompt
    alias
    outputType
    rubric
    biasGuardrail
  }
}

Types used only by generateEvalPrompt

ContextUsage

Enum type.

ValueDescription
PROMPT_AND_RESPONSE
RESPONSE_ONLY
PROMPT_ONLY
CUSTOM_FIELDS
EvalSchemaFieldInput

Input object type.

FieldTypeDescription
nameString!Field name
typeString!Field type (e.g. STRING, NUMBER, BOOLEAN)
GenerateEvalPromptOutput

Object type.

FieldTypeDescription
promptString!The generated evaluation prompt template
aliasString!Score field name for the transform
outputTypeString!Output type: 'number' or 'boolean'
rubric[String!]!Evaluation criteria bullets
scoringAnchors[ScoringAnchorOutput!]!Score level descriptions
biasGuardrailString!Bias avoidance guidance
Scale

Enum type.

ValueDescription
SCALE_1_5
SCALE_1_10
SCALE_PASS_FAIL
ScoringAnchorOutput

Object type.

FieldTypeDescription
scoreString!The score value
descriptionString!What this score level means
Strictness

Enum type.

ValueDescription
LENIENT
BALANCED
STRICT

Related types

UUID

generateSqlEval (query)

generateSqlEval is a query in the Monte Carlo GraphQL API, in AI features. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Generate a SQL evaluation expression from a description

Arguments

ArgumentTypeDescription
descriptionTextString!Natural language description of what to evaluate
outputTypeString!Expected output type: string, number, or boolean
mconString!MCON of the agent data source
connectionUuidUUIDConnection UUID for schema and warehouse type lookup

Returns

GenerateSqlEvalOutput

Example

query GenerateSqlEval($descriptionText: String!, $outputType: String!, $mcon: String!) {
  generateSqlEval(descriptionText: $descriptionText, outputType: $outputType, mcon: $mcon) {
    sqlExpression
    alias
    description
    returns
    customize
  }
}

Types used only by generateSqlEval

GenerateSqlEvalOutput

Object type.

FieldTypeDescription
sqlExpressionString!The SQL expression for evaluation
aliasString!A short snake_case score field name
descriptionString!What the SQL expression does
returnsString!What the expression returns and when
customizeString!How to modify the expression for different use cases

Related types

UUID

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.