index
Enumerations
Classes
- BaseContainer
- CommitLog
- CSVFile
- Error
- EvaluatableBaseContainer
- EvaluateContainer
- EventEmittingBaseContainer
- Generation
- LogWriter
- Maxim
- MaximLogger
- MaximLogsAPI
- QueryBuilder
- Retrieval
- Session
- Span
- ToolCall
- Trace
Interfaces
- ChatCompletionChoice
- ChatCompletionMessage
- ChatCompletionResult
- ChatCompletionToolCall
- CompletionRequest
- GenerationError
- Logprobs
- MaximCache
- TestRunLogger
- TextCompletionChoice
- TextCompletionResult
- ToolCallConfig
- ToolCallError
- ToolCallFunction
- Usage
Type Aliases
AgentResponse
AgentResponse = object
Defined in: src/lib/models/promptChain.ts:23
Properties
meta
meta: AgentResponseMeta
Defined in: src/lib/models/promptChain.ts:25
response
response: string
Defined in: src/lib/models/promptChain.ts:24
AgentResponseMeta
AgentResponseMeta = object
Defined in: src/lib/models/promptChain.ts:16
Properties
boundVariableResponses?
Defined in: src/lib/models/promptChain.ts:19optionalboundVariableResponses:object
Index Signature
[key: string]: any
cost
cost: AgentCost
Defined in: src/lib/models/promptChain.ts:17
retrievedContext?
Defined in: src/lib/models/promptChain.ts:20optionalretrievedContext:string
usage
usage: AgentUsage
Defined in: src/lib/models/promptChain.ts:18
Attachment
Attachment =Defined in: src/lib/logger/components/attachment.ts:60 Discriminated union type representing all possible attachment types.FileAttachment|FileDataAttachment|UrlAttachment
BaseAttachmentProps
BaseAttachmentProps = object
Defined in: src/lib/logger/components/attachment.ts:9
Base properties shared by all attachment types in the Maxim logging system.
Properties
id
id: string
Defined in: src/lib/logger/components/attachment.ts:10
metadata?
Defined in: src/lib/logger/components/attachment.ts:15optionalmetadata:Record<string,string>
mimeType?
Defined in: src/lib/logger/components/attachment.ts:12optionalmimeType:string
name?
Defined in: src/lib/logger/components/attachment.ts:11optionalname:string
size?
Defined in: src/lib/logger/components/attachment.ts:13optionalsize:number
tags?
Defined in: src/lib/logger/components/attachment.ts:14optionaltags:Record<string,string>
BaseConfig
BaseConfig = object
Defined in: src/lib/logger/components/base.ts:9
Configuration object for base container initialization.
Properties
id
id: string
Defined in: src/lib/logger/components/base.ts:10
name?
Defined in: src/lib/logger/components/base.ts:12optionalname:string
spanId?
Defined in: src/lib/logger/components/base.ts:11optionalspanId:string
tags?
Defined in: src/lib/logger/components/base.ts:13optionaltags:Record<string,string>
CacheEntry
CacheEntry = PromptVersionsAndRules
Defined in: src/lib/models/cache.ts:12
Type alias representing an entry stored in the Maxim cache.
Currently aliases PromptVersionsAndRules, which contains prompt configurations,
deployment rules, and version information. This type may be extended in the
future to support additional cache entry types.
See
PromptVersionsAndRules For the full structure of cached prompt dataChoice
Choice = object
Defined in: src/lib/models/prompt.ts:163
Represents a single choice/response option from an AI model completion.
Contains the generated message, its position in the response array, and
the reason why generation finished (e.g., natural stop, length limit).
Example
Properties
finishReason
finishReason: string
Defined in: src/lib/models/prompt.ts:166
Reason generation stopped (“stop”, “length”, “function_call”, “tool_calls”, etc.)
index
index: number
Defined in: src/lib/models/prompt.ts:164
Zero-based index of this choice in the response array
message
message: ChatCompletionMessage
Defined in: src/lib/models/prompt.ts:165
The generated assistant message
ColumnStructure
ColumnStructure =Defined in: src/lib/utils/csvParser.ts:64 Type representing the structure of columns in a CSV file. Maps column names to their zero-based index positions.Record<string,number>
Example
CombinedLocalEvaluatorType<T, U>
CombinedLocalEvaluatorType<Defined in: src/lib/models/evaluator.ts:31T,U> =object
Type Parameters
T
T extends DataStructure | undefined
U
U extends Record<string, PassFailCriteriaType>
Properties
evaluationFunction()
evaluationFunction: (Defined in: src/lib/models/evaluator.ts:33result,data) =>Promise<Record<keyofU,LocalEvaluatorReturnType>> |Record<keyofU,LocalEvaluatorReturnType>
Parameters
result
contextToEvaluate?
string | string[]
output
string
data
Data<T>
Returns
Promise<Record<keyof U, LocalEvaluatorReturnType>> | Record<keyof U, LocalEvaluatorReturnType>
names
names: keyof U[]
Defined in: src/lib/models/evaluator.ts:32
passFailCriteria
passFailCriteria: U
Defined in: src/lib/models/evaluator.ts:37
CompletionRequestContent
CompletionRequestContent =Defined in: src/lib/models/prompt.ts:80CompletionRequestTextContent|CompletionRequestImageUrlContent
CompletionRequestImageUrlContent
CompletionRequestImageUrlContent = object
Defined in: src/lib/models/prompt.ts:72
Represents an image URL with optional detail level for vision-enabled models.
Properties
image_url
image_url: object
Defined in: src/lib/models/prompt.ts:74
Image URL configuration
detail?
optionaldetail:string
url
url: string
type
type: "image_url"
Defined in: src/lib/models/prompt.ts:73
Content type identifier
CompletionRequestTextContent
CompletionRequestTextContent = object
Defined in: src/lib/models/prompt.ts:59
Properties
text
text: string
Defined in: src/lib/models/prompt.ts:61
type
type: "text"
Defined in: src/lib/models/prompt.ts:60
Config
Config = object
Defined in: src/lib/maxim.ts:26
Configuration object for initializing the Maxim SDK.
Properties
apiKey
apiKey: string
Defined in: src/lib/maxim.ts:38
API key for authenticating requests to the Maxim API.
Required for all API calls.
See
https://app.getmaxim.ai/workspace?redirect=/settings/api-keys to generate your API keybaseUrl?
Defined in: src/lib/maxim.ts:31 Base URL for the Maxim API.optionalbaseUrl:string
Default
cache?
Defined in: src/lib/maxim.ts:51 Custom cache implementation for storing and retrieving data.optionalcache:MaximCache
Default
debug?
Defined in: src/lib/maxim.ts:58 Enable debug mode for additional logging and troubleshooting information. Useful during development and integration.optionaldebug:boolean
Default
promptManagement?
Defined in: src/lib/maxim.ts:45 Enable prompt management features. When enabled, allows synchronization of prompts, prompt chains, and folders from Maxim.optionalpromptManagement:boolean
Default
raiseExceptions?
Defined in: src/lib/maxim.ts:64 Raise exceptions instead of logging them.optionalraiseExceptions:boolean
Default
ContextToEvaluateColumn
ContextToEvaluateColumn = "CONTEXT_TO_EVALUATE"
Defined in: src/lib/models/dataset.ts:82
CSVParseOptions
CSVParseOptions = object
Defined in: src/lib/utils/csvParser.ts:30
Configuration options for parsing CSV files.
Examples
Properties
delimiter?
Defined in: src/lib/utils/csvParser.ts:31 Character used to separate fields in the CSVoptionaldelimiter:string
escapeChar?
Defined in: src/lib/utils/csvParser.ts:34 Character used to escape quote characters within quoted fieldsoptionalescapeChar:string
hasHeader?
Defined in: src/lib/utils/csvParser.ts:32 Whether the first row contains column headersoptionalhasHeader:boolean
quoteChar?
Defined in: src/lib/utils/csvParser.ts:33 Character used to quote fields containing special charactersoptionalquoteChar:string
CSVWriteOptions
CSVWriteOptions = object
Defined in: src/lib/utils/csvParser.ts:45
Configuration options for writing CSV files.
Properties
delimiter?
Defined in: src/lib/utils/csvParser.ts:46 Character used to separate fieldsoptionaldelimiter:string
escapeChar?
Defined in: src/lib/utils/csvParser.ts:49 Character used to escape quote characters within quoted fieldsoptionalescapeChar:string
includeHeader?
Defined in: src/lib/utils/csvParser.ts:47 Whether to include column headers in the outputoptionalincludeHeader:boolean
quoteChar?
Defined in: src/lib/utils/csvParser.ts:48 Character used to quote fields containing special charactersoptionalquoteChar:string
Data<T>
Data<Defined in: src/lib/models/dataset.ts:131 Type representing a data entry that conforms to a specific data structure. Provides type-safe access to dataset columns based on the defined data structure. The type automatically handles required vs optional fields based on column types, with nullable variable columns being optional and others being required.T> =TextendsDataStructure? { [K in keyof T as (undefined | null) extends MapDataStructureToValue<T[K]> ? never : K]: MapDataStructureToValue<T[K]> } & { [K in keyof T as (undefined | null) extends MapDataStructureToValue<T[K]> ? K : never]?: MapDataStructureToValue<T[K]> } :Record<string,MapDataStructureToValue<DataStructure[string]> |undefined>
Type Parameters
T
T extends DataStructure | undefined
The data structure type defining column names and types
Example
DatasetEntry
DatasetEntry = object
Defined in: src/lib/models/dataset.ts:42
Properties
context?
Defined in: src/lib/models/dataset.ts:44optionalcontext:Variable
expectedOutput?
Defined in: src/lib/models/dataset.ts:45optionalexpectedOutput:Variable
input
input: Variable
Defined in: src/lib/models/dataset.ts:43
DataStructure
DataStructure =Defined in: src/lib/models/dataset.ts:87Record<string,InputColumn|ExpectedOutputColumn|ContextToEvaluateColumn|VariableColumn|NullableVariableColumn>
DataValue<T>
DataValue<Defined in: src/lib/models/dataset.ts:137T> =TextendsDataStructure?Data<T>[] |string|CSVFile<Record<keyofT,number>> | (page) =>Promise<Data<T>[] |null|undefined> |Data<T>[] |null|undefined:string
Type Parameters
T
T extends DataStructure | undefined
DeploymentVersionDeploymentConfig
DeploymentVersionDeploymentConfig = object
Defined in: src/lib/models/deployment.ts:27
Index Signature
[key: string]: VersionSpecificDeploymentConfig[]
ErrorConfig
ErrorConfig = object
Defined in: src/lib/logger/components/error.ts:8
Configuration object for error.
Properties
code?
Defined in: src/lib/logger/components/error.ts:11optionalcode:string
id
id: string
Defined in: src/lib/logger/components/error.ts:9
message
message: string
Defined in: src/lib/logger/components/error.ts:10
metadata?
Defined in: src/lib/logger/components/error.ts:15optionalmetadata:Record<string,any>
name?
Defined in: src/lib/logger/components/error.ts:12optionalname:string
tags?
Defined in: src/lib/logger/components/error.ts:14optionaltags:Record<string,string>
type?
Defined in: src/lib/logger/components/error.ts:13optionaltype:string
ExpectedOutputColumn
ExpectedOutputColumn = "EXPECTED_OUTPUT"
Defined in: src/lib/models/dataset.ts:81
FileAttachment
FileAttachment =Defined in: src/lib/logger/components/attachment.ts:21 File attachment type for referencing files on the local filesystem.BaseAttachmentProps&object
Type declaration
path
path: string
type
type: "file"
FileDataAttachment
FileDataAttachment =Defined in: src/lib/logger/components/attachment.ts:34 File data attachment type for directly embedding binary data.BaseAttachmentProps&object
Type declaration
data
data: Buffer
type
type: "fileData"
Folder
Folder = object
Defined in: src/lib/models/folder.ts:3
Properties
id
id: string
Defined in: src/lib/models/folder.ts:4
name
name: string
Defined in: src/lib/models/folder.ts:5
parentFolderId
parentFolderId: string
Defined in: src/lib/models/folder.ts:6
tags
tags: PromptTags
Defined in: src/lib/models/folder.ts:7
GenerationConfig
GenerationConfig = object
Defined in: src/lib/logger/components/generation.ts:76
Configuration object for generation.
Properties
id
id: string
Defined in: src/lib/logger/components/generation.ts:77
maximPromptId?
Defined in: src/lib/logger/components/generation.ts:81optionalmaximPromptId:string
messages
messages: (Defined in: src/lib/logger/components/generation.ts:82CompletionRequest|ChatCompletionMessage)[]
model
model: string
Defined in: src/lib/logger/components/generation.ts:80
modelParameters
modelParameters:Defined in: src/lib/logger/components/generation.ts:83Record<string,any>
name?
Defined in: src/lib/logger/components/generation.ts:78optionalname:string
provider
provider:Defined in: src/lib/logger/components/generation.ts:79"openai"|"bedrock"|"anthropic"|"huggingface"|"azure"|"together"|"groq"|"google"
tags?
Defined in: src/lib/logger/components/generation.ts:84optionaltags:Record<string,string>
HumanEvaluationConfig
HumanEvaluationConfig = object
Defined in: src/lib/models/evaluator.ts:98
Properties
emails
emails: string[]
Defined in: src/lib/models/evaluator.ts:99
instructions?
Defined in: src/lib/models/evaluator.ts:100optionalinstructions:string
ImageUrl
ImageUrl =Defined in: src/lib/models/prompt.ts:142 Type alias for image URL configuration used in vision requests.CompletionRequestImageUrlContent["image_url"]
See
CompletionRequestImageUrlContent For the full image content structureInputColumn
InputColumn = "INPUT"
Defined in: src/lib/models/dataset.ts:80
LocalEvaluationResult
LocalEvaluationResult = object
Defined in: src/lib/models/evaluator.ts:92
Result object containing the outcome of a local evaluator execution.
Represents the complete evaluation result from running a local evaluator
on a single test run entry, including the score, reasoning, evaluator name,
and the pass/fail criteria used for assessment.
Examples
Properties
name
name: string
Defined in: src/lib/models/evaluator.ts:94
The name of the evaluator that produced this result
passFailCriteria
passFailCriteria: PassFailCriteriaType
Defined in: src/lib/models/evaluator.ts:95
The criteria used to determine pass/fail status
result
result: LocalEvaluatorReturnType
Defined in: src/lib/models/evaluator.ts:93
The evaluation result containing score and optional reasoning
LocalEvaluatorType<T>
LocalEvaluatorType<Defined in: src/lib/models/evaluator.ts:22T> =object
Type Parameters
T
T extends DataStructure | undefined = undefined
Properties
evaluationFunction()
evaluationFunction: (Defined in: src/lib/models/evaluator.ts:24result,data) =>Promise<LocalEvaluatorReturnType> |LocalEvaluatorReturnType
Parameters
result
contextToEvaluate?
string | string[]
output
string
data
Data<T>
Returns
Promise<LocalEvaluatorReturnType> | LocalEvaluatorReturnType
name
name: string
Defined in: src/lib/models/evaluator.ts:23
passFailCriteria
passFailCriteria: PassFailCriteriaType
Defined in: src/lib/models/evaluator.ts:28
LoggerConfig
LoggerConfig = object
Defined in: src/lib/logger/logger.ts:17
Configuration object for initializing a MaximLogger instance.
Properties
autoFlush?
Defined in: src/lib/logger/logger.ts:19optionalautoFlush:boolean
flushIntervalSeconds?
Defined in: src/lib/logger/logger.ts:20optionalflushIntervalSeconds:number
id
id: string
Defined in: src/lib/logger/logger.ts:18
LogWriterConfig
LogWriterConfig = object
Defined in: src/lib/logger/writer.ts:19
Properties
apiKey
apiKey: string
Defined in: src/lib/logger/writer.ts:21
autoFlush?
Defined in: src/lib/logger/writer.ts:23optionalautoFlush:boolean
baseUrl
baseUrl: string
Defined in: src/lib/logger/writer.ts:20
flushInterval?
Defined in: src/lib/logger/writer.ts:24optionalflushInterval:number
isDebug?
Defined in: src/lib/logger/writer.ts:25optionalisDebug:boolean
maxInMemoryLogs?
Defined in: src/lib/logger/writer.ts:26optionalmaxInMemoryLogs:number
repositoryId
repositoryId: string
Defined in: src/lib/logger/writer.ts:22
MapDataStructureToValue<T>
MapDataStructureToValue<Defined in: src/lib/models/dataset.ts:92T> =TextendsInputColumn?string:TextendsExpectedOutputColumn?string:TextendsContextToEvaluateColumn?string|string[] :TextendsVariableColumn?string|string[] :TextendsNullableVariableColumn?string|string[] |undefined|null:never
Type Parameters
T
T
NullableVariableColumn
NullableVariableColumn = "NULLABLE_VARIABLE"
Defined in: src/lib/models/dataset.ts:84
OperatorType
OperatorType =Defined in: src/lib/models/evaluator.ts:8">="|"<"|"<="|">"|"="|"!="
PassFailCriteriaType
PassFailCriteriaType = object
Defined in: src/lib/models/evaluator.ts:9
Properties
forTestrunOverall
forTestrunOverall: object
Defined in: src/lib/models/evaluator.ts:19
for
for:"average"|"percentageOfPassedResults"
overallShouldBe
overallShouldBe: OperatorType
value
value: number
onEachEntry
onEachEntry: {Defined in: src/lib/models/evaluator.ts:10scoreShouldBe:"="|"!=";value:boolean; } | {scoreShouldBe:OperatorType;value:number; }
Prompt
Prompt = object
Defined in: src/lib/models/prompt.ts:230
Properties
messages
messages: (Defined in: src/lib/models/prompt.ts:234CompletionRequest|ChatCompletionMessage)[]
model
model: string
Defined in: src/lib/models/prompt.ts:236
modelParameters
modelParameters: object
Defined in: src/lib/models/prompt.ts:235
Index Signature
[key: string]: any
promptId
promptId: string
Defined in: src/lib/models/prompt.ts:231
provider
provider: string
Defined in: src/lib/models/prompt.ts:237
run()
run: (Defined in: src/lib/models/prompt.ts:239input,options?) =>Promise<PromptResponse>
Parameters
input
string
options?
imageUrls?
ImageUrl[]
variables?
{[key: string]: string; }
Returns
Promise<PromptResponse>
tags
tags: PromptTags
Defined in: src/lib/models/prompt.ts:238
version
version: number
Defined in: src/lib/models/prompt.ts:232
versionId
versionId: string
Defined in: src/lib/models/prompt.ts:233
PromptChain
PromptChain = object
Defined in: src/lib/models/promptChain.ts:28
Properties
nodes
nodes:Defined in: src/lib/models/promptChain.ts:32object&PromptNode[]
promptChainId
promptChainId: string
Defined in: src/lib/models/promptChain.ts:29
run()
run: (Defined in: src/lib/models/promptChain.ts:33input,options?) =>Promise<AgentResponse>
Parameters
input
string
options?
variables?
{[key: string]: string; }
Returns
Promise<AgentResponse>
version
version: number
Defined in: src/lib/models/promptChain.ts:30
versionId
versionId: string
Defined in: src/lib/models/promptChain.ts:31
PromptNode
PromptNode = object
Defined in: src/lib/models/promptChain.ts:36
Properties
prompt
prompt: Prompt
Defined in: src/lib/models/promptChain.ts:37
PromptResponse
PromptResponse = object
Defined in: src/lib/models/prompt.ts:221
Complete response object from a prompt execution.
Contains the full response from an AI model including all generated choices,
usage statistics, model information, and configuration parameters used.
This is the primary response format returned by prompt execution methods.
Examples
Properties
choices
choices: Choice[]
Defined in: src/lib/models/prompt.ts:225
Array of generated response choices
id
id: string
Defined in: src/lib/models/prompt.ts:222
Unique identifier for this response
model
model: string
Defined in: src/lib/models/prompt.ts:224
Specific model used (e.g., “gpt-4”, “claude-3-sonnet”)
modelParams
modelParams: object
Defined in: src/lib/models/prompt.ts:227
Model parameters used for generation
Index Signature
[key: string]: any
provider
provider: string
Defined in: src/lib/models/prompt.ts:223
AI provider name (e.g., “openai”, “anthropic”, “azure”)
usage
usage: PromptUsage
Defined in: src/lib/models/prompt.ts:226
Token usage and latency information
PromptTags
PromptTags = object
Defined in: src/lib/models/prompt.ts:3
Index Signature
[key: string]: undefined | string | number | boolean
PromptTagValues
PromptTagValues = object
Defined in: src/lib/models/prompt.ts:242
Index Signature
[key: string]: undefined | string | number | boolean
PromptUsage
PromptUsage = object
Defined in: src/lib/models/prompt.ts:169
Properties
completionTokens
completionTokens: number
Defined in: src/lib/models/prompt.ts:171
latency
latency: number
Defined in: src/lib/models/prompt.ts:173
promptTokens
promptTokens: number
Defined in: src/lib/models/prompt.ts:170
totalTokens
totalTokens: number
Defined in: src/lib/models/prompt.ts:172
PromptVersion
PromptVersion = object
Defined in: src/lib/models/prompt.ts:255
Properties
config?
Defined in: src/lib/models/prompt.ts:260optionalconfig:PromptVersionConfig
createdAt
createdAt: string
Defined in: src/lib/models/prompt.ts:261
description?
Defined in: src/lib/models/prompt.ts:259optionaldescription:string
id
id: string
Defined in: src/lib/models/prompt.ts:256
promptId
promptId: string
Defined in: src/lib/models/prompt.ts:258
updatedAt
updatedAt: string
Defined in: src/lib/models/prompt.ts:262
version
version: number
Defined in: src/lib/models/prompt.ts:257
PromptVersionConfig
PromptVersionConfig = object
Defined in: src/lib/models/prompt.ts:246
Properties
id
id: string
Defined in: src/lib/models/prompt.ts:247
messages
messages: object[]
Defined in: src/lib/models/prompt.ts:248
content
content: string
role
role: string
model
model: string
Defined in: src/lib/models/prompt.ts:250
modelParameters
modelParameters: object
Defined in: src/lib/models/prompt.ts:249
Index Signature
[key: string]: any
provider
provider: string
Defined in: src/lib/models/prompt.ts:251
tags?
Defined in: src/lib/models/prompt.ts:252optionaltags:PromptTagValues
PromptVersionsAndRules
PromptVersionsAndRules = object
Defined in: src/lib/models/prompt.ts:265
Properties
fallbackVersion
fallbackVersion:Defined in: src/lib/models/prompt.ts:269PromptVersion|undefined
folderId
folderId: string
Defined in: src/lib/models/prompt.ts:266
rules
rules: DeploymentVersionDeploymentConfig
Defined in: src/lib/models/prompt.ts:267
versions
versions: PromptVersion[]
Defined in: src/lib/models/prompt.ts:268
QueryRule
QueryRule = object
Defined in: src/lib/models/queryBuilder.ts:27
Configuration object for prompt and prompt chain queries.
Defines the parameters used to filter and select specific versions of prompts
or prompt chains based on deployment variables, tags, and matching criteria.
Used internally by the QueryBuilder to construct queries for the Maxim API.
See
QueryBuilder For constructing QueryRule objectsExample
Properties
exactMatch
exactMatch: boolean
Defined in: src/lib/models/queryBuilder.ts:30
Whether to require exact matching of all criteria
operator
operator:Defined in: src/lib/models/queryBuilder.ts:29 Logical operator for combining multiple criteria"AND"|"OR"
query
query: string
Defined in: src/lib/models/queryBuilder.ts:28
The query string containing comma-separated key=value pairs
scopes
scopes: Scopes
Defined in: src/lib/models/queryBuilder.ts:31
Additional scope filters like folder restrictions
RetrievalConfig
RetrievalConfig = object
Defined in: src/lib/logger/components/retrieval.ts:9
Configuration object for retrieval.
Properties
id
id: string
Defined in: src/lib/logger/components/retrieval.ts:10
name?
Defined in: src/lib/logger/components/retrieval.ts:11optionalname:string
tags?
Defined in: src/lib/logger/components/retrieval.ts:12optionaltags:Record<string,string>
Scopes
Scopes = object
Defined in: src/lib/models/queryBuilder.ts:34
Index Signature
[key: string]: string
SessionConfig
SessionConfig = object
Defined in: src/lib/logger/components/session.ts:9
Configuration object for session.
Properties
id
id: string
Defined in: src/lib/logger/components/session.ts:10
name?
Defined in: src/lib/logger/components/session.ts:11optionalname:string
tags?
Defined in: src/lib/logger/components/session.ts:12optionaltags:Record<string,string>
SpanConfig
SpanConfig = object
Defined in: src/lib/logger/components/span.ts:13
Configuration object for span.
Properties
id
id: string
Defined in: src/lib/logger/components/span.ts:14
name?
Defined in: src/lib/logger/components/span.ts:15optionalname:string
tags?
Defined in: src/lib/logger/components/span.ts:16optionaltags:Record<string,string>
TestRunBuilder<T>
TestRunBuilder<Defined in: src/lib/models/testRun.ts:293T> =object
Type Parameters
T
T extends DataStructure | undefined = undefined
Properties
getConfig()
getConfig: () =>Defined in: src/lib/models/testRun.ts:555 Gets the current TestRunConfig.TestRunConfig<T>
Returns
TestRunConfig<T>
The current TestRunConfig.
run()
run: (Defined in: src/lib/models/testRun.ts:598 Runs the test run with the configured configuration.timeoutInMinutes?) =>Promise<{failedEntryIndices:number[];testRunResult:TestRunResult; }>
Parameters
timeoutInMinutes?
number
The timeout in minutes for the test run. Will be rounded to the nearest whole number if given a floating value (optional, defaults to 15 minutes)
Returns
Promise<{ failedEntryIndices: number[]; testRunResult: TestRunResult; }>
The test run result.
Async
Throws
for any of the following reasons:- If the test run is not configured properly (sanitization error)
- If the test run is taking too long to complete, i.e., passed the timeout limit (you can still view the report on our web portal though)
- If the test run itself fails due to any reason.
Example
withConcurrency()
withConcurrency: (Defined in: src/lib/models/testRun.ts:549 Sets the concurrency for the test run. (optional, defaults to 10).concurrency) =>TestRunBuilder<T>
Parameters
concurrency
TestRunConfig<T>["concurrency"]
The concurrency to set.
Returns
TestRunBuilder<T>
The TestRunBuilder with the concurrency set.
Example
withData()
withData: (Defined in: src/lib/models/testRun.ts:358 Sets the data for the test run.data) =>TestRunBuilder<T>
Parameters
data
TestRunConfig<T>["data"]
The data to set. Can be a datasetId(string), a CSV file, an array of column to value mappings, or a function that returns the data in the format of the data structure. (if the data structure is not provided, only datasetId would be a valid type)
Note: If the data is a function, you will need to return null or undefined to indicate the end of the data.
Returns
TestRunBuilder<T>
The TestRunBuilder with the data set.
See
withDataStructureThrows
for any of the following reasons:- if the data argument is not a datasetId (when the data structure is not provided)
- if the data does not match the data structure. (The data structure can differ from the remote data structure but the keys/column names shouldn’t)
- if the data is a CSVFile and it does not exist.
Example
withDataStructure()
withDataStructure: <Defined in: src/lib/models/testRun.ts:312 Sets the data structure for the data being used in the test run. Note: Data structure is necessary for manual / CSV data as column types cannot be inferred without it.U>(dataStructure) =>TestRunBuilder<U>
Type Parameters
U
U extends DataStructure
Parameters
dataStructure
U
The data structure to set.
Returns
TestRunBuilder<U>
The TestRunBuilder with the data structure set.
See
withDataThrows
if the data structure contains more than one input, expectedOutput or contextToEvaluate column. (there can be multiple variable columns)Example
withEvaluators()
withEvaluators: (…Defined in: src/lib/models/testRun.ts:420 Sets the evaluators from the platform to be used in the test run. Note:evaluators) =>TestRunBuilder<T>
- You may create an evaluator locally through code or use an evaluator that is installed in your workspace through the name directly.
- If the evaluators contain a human evaluator, you will need to set the human evaluation config or the test run will fail.
Parameters
evaluators
…TestRunConfig<T>["evaluators"]
The evaluators to execute.
Returns
TestRunBuilder<T>
The TestRunBuilder with the evaluators set.
See
Throws
for any of the following reasons:- if multiple evaluators have the same name
Example
withHumanEvaluationConfig()
withHumanEvaluationConfig: (Defined in: src/lib/models/testRun.ts:436 Sets the human evaluation config for the test run.humanEvaluationConfig) =>TestRunBuilder<T>
Parameters
humanEvaluationConfig
HumanEvaluationConfig
The human evaluation config.
Returns
TestRunBuilder<T>
The ComparisonTestRunBuilder with the human evaluation config set.
Throws
if the emails passed are not validExample
withLogger()
withLogger: (Defined in: src/lib/models/testRun.ts:538 Sets the logger for the test run. (optional, we have a default logger implemented already).logger) =>TestRunBuilder<T>
Parameters
logger
TestRunConfig<T>["logger"]
The logger satisfying TestRunLogger interface.
Returns
TestRunBuilder<T>
The TestRunBuilder with the logger set.
See
TestRunLoggerExample
withPromptChainVersionId()
withPromptChainVersionId: (Defined in: src/lib/models/testRun.ts:501 Sets the prompt chain version ID for the test run. Optionally, you can also set the context to evaluate for the prompt chain. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)id,contextToEvaluate?) =>TestRunBuilder<T>
Parameters
id
string
The prompt chain version ID to set.
contextToEvaluate?
string
The context to evaluate for the prompt chain (variable name essentially).
Returns
TestRunBuilder<T>
The TestRunBuilder with the prompt chain version set.
Example
withPromptVersionId()
withPromptVersionId: (Defined in: src/lib/models/testRun.ts:489 Sets the prompt version ID for the test run. Optionally, you can also set the context to evaluate for the prompt. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)id,contextToEvaluate?) =>TestRunBuilder<T>
Parameters
id
string
The prompt version ID to set.
contextToEvaluate?
string
The context to evaluate for the prompt (variable name essentially).
Returns
TestRunBuilder<T>
The TestRunBuilder with the prompt version set.
Example
withWorkflowId()
withWorkflowId: (Defined in: src/lib/models/testRun.ts:513 Sets the workflow ID for the test run. Optionally, you can also set the context to evaluate for the workflow. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)id,contextToEvaluate?) =>TestRunBuilder<T>
Parameters
id
string
The workflow ID to set.
contextToEvaluate?
string
The context to evaluate for the workflow (variable name essentially).
Returns
TestRunBuilder<T>
The TestRunBuilder with the workflow set.
Example
yieldsOutput()
yieldsOutput: (Defined in: src/lib/models/testRun.ts:477 Sets the output retrieval function for the test run. Note: Throwing from this function will cause the test run entry being executed to fail and not added to the test run on the server. You will still get back the indices of all the failed entries once the run is finished.outputFunction) =>TestRunBuilder<T>
Parameters
outputFunction
TestRunConfig<T>["outputFunction"]
The output retrieval function.
Returns
TestRunBuilder<T>
The TestRunBuilder with the output retrieval function set.
Example
TestRunConfig<T>
TestRunConfig<Defined in: src/lib/models/testRun.ts:266 Configuration for a test run.T> =object
Type Parameters
T
T extends DataStructure | undefined = undefined
Properties
apiKey
apiKey: string
Defined in: src/lib/models/testRun.ts:268
baseUrl
baseUrl: string
Defined in: src/lib/models/testRun.ts:267
concurrency?
Defined in: src/lib/models/testRun.ts:290optionalconcurrency:number
data?
Defined in: src/lib/models/testRun.ts:273optionaldata:DataValue<T>
dataStructure?
Defined in: src/lib/models/testRun.ts:272optionaldataStructure:T
evaluators
evaluators: (Defined in: src/lib/models/testRun.ts:274LocalEvaluatorType<T> |CombinedLocalEvaluatorType<T,Record<string,PassFailCriteriaType>> |string)[]
humanEvaluationConfig?
Defined in: src/lib/models/testRun.ts:275optionalhumanEvaluationConfig:HumanEvaluationConfig
logger?
Defined in: src/lib/models/testRun.ts:289optionallogger:TestRunLogger<T>
name
name: string
Defined in: src/lib/models/testRun.ts:270
outputFunction()?
Defined in: src/lib/models/testRun.ts:276optionaloutputFunction: (data) =>YieldedOutput|Promise<YieldedOutput>
Parameters
data
Data<T>
Returns
YieldedOutput | Promise<YieldedOutput>
promptChainVersion?
Defined in: src/lib/models/testRun.ts:281optionalpromptChainVersion:object
contextToEvaluate?
optionalcontextToEvaluate:string
id
id: string
promptVersion?
Defined in: src/lib/models/testRun.ts:277optionalpromptVersion:object
contextToEvaluate?
optionalcontextToEvaluate:string
id
id: string
testConfigId?
Defined in: src/lib/models/testRun.ts:271optionaltestConfigId:string
workflow?
Defined in: src/lib/models/testRun.ts:285optionalworkflow:object
contextToEvaluate?
optionalcontextToEvaluate:string
id
id: string
workspaceId
workspaceId: string
Defined in: src/lib/models/testRun.ts:269
TestRunResult
TestRunResult = object
Defined in: src/lib/models/testRun.ts:226
Complete results and metrics from a test run execution.
Contains comprehensive information about test run performance including
individual evaluator scores, aggregated metrics, token usage, costs,
and latency statistics. Provides both detailed results and a link to
view the full report in the Maxim web interface.
Examples
Properties
link
link: string
Defined in: src/lib/models/testRun.ts:227
URL to view the detailed test run report in Maxim
result
result: object[]
Defined in: src/lib/models/testRun.ts:228
Array of test run result objects (typically one)
cost?
optionalcost:object
cost.completion
completion: number
cost.input
input: number
cost.total
total: number
individualEvaluatorMeanScore
individualEvaluatorMeanScore: object
Index Signature
[key: string]: object & { outOf?: number; score: number; } | { score: boolean | string; }
latency?
optionallatency:object
latency.max
max: number
latency.mean
mean: number
latency.min
min: number
latency.p50
p50: number
latency.p90
p90: number
latency.p95
p95: number
latency.p99
p99: number
latency.standardDeviation
standardDeviation: number
latency.total
total: number
name
name: string
usage?
optionalusage:object
usage.completion
completion: number
usage.input
input: number
usage.total
total: number
TraceConfig
TraceConfig = object
Defined in: src/lib/logger/components/trace.ts:14
Configuration object for trace.
Properties
id
id: string
Defined in: src/lib/logger/components/trace.ts:15
name?
Defined in: src/lib/logger/components/trace.ts:16optionalname:string
sessionId?
Defined in: src/lib/logger/components/trace.ts:17optionalsessionId:string
tags?
Defined in: src/lib/logger/components/trace.ts:18optionaltags:Record<string,string>
UrlAttachment
UrlAttachment =Defined in: src/lib/logger/components/attachment.ts:47 URL attachment type for referencing external resources.BaseAttachmentProps&object
Type declaration
type
type: "url"
url
url: string
Variable
Variable = object
Defined in: src/lib/models/dataset.ts:37
Properties
payload
payload: string
Defined in: src/lib/models/dataset.ts:39
type
type: VariableType
Defined in: src/lib/models/dataset.ts:38
VariableColumn
VariableColumn = "VARIABLE"
Defined in: src/lib/models/dataset.ts:83
VersionSpecificDeploymentConfig
VersionSpecificDeploymentConfig = object
Defined in: src/lib/models/deployment.ts:20
Properties
id
id: string
Defined in: src/lib/models/deployment.ts:21
isFallback
isFallback: boolean
Defined in: src/lib/models/deployment.ts:24
rules
rules: DeploymentRules
Defined in: src/lib/models/deployment.ts:23
timestamp
timestamp: Date
Defined in: src/lib/models/deployment.ts:22
YieldedOutput
YieldedOutput = object
Defined in: src/lib/models/testRun.ts:144
Output data structure returned by test run output functions.
Contains the generated output data along with optional metadata about
the generation process including token usage, costs, and retrieved context.
This is the expected return type for functions passed to yieldsOutput().
Examples
Properties
data
data: string
Defined in: src/lib/models/testRun.ts:145
The main generated output text
meta?
Defined in: src/lib/models/testRun.ts:147 Optional metadata about the generation processoptionalmeta:object
cost?
optionalcost:object
cost.input
input: number
cost.output
output: number
cost.total
total: number
usage?
optionalusage: {completionTokens:number;latency?:number;promptTokens:number;totalTokens:number; } | {latency:number; }
retrievedContextToEvaluate?
Defined in: src/lib/models/testRun.ts:146 Context retrieved during generation for evaluationoptionalretrievedContextToEvaluate:string|string[]
Functions
createCustomCombinedEvaluatorsFor()
createCustomCombinedEvaluatorsFor<Defined in: src/lib/evaluators/evaluators.ts:134 Creates a builder for combined evaluators that can output multiple evaluator scores under the same evaluation function. Combined evaluators allow a single evaluation function to return multiple named scores, useful when one analysis can produce several metrics. Each named score must have corresponding pass/fail criteria.U>(…names):object
Type Parameters
U
U extends string[]
String literal array type containing evaluator names
Parameters
names
…U
Array of evaluator names that will be returned by the evaluation function
Returns
Builder object with abuild method to create the combined evaluator
build()
build: <Builds the combined evaluator with evaluation function and pass/fail criteria.T>(evaluationFunction,passFailCriteria) =>CombinedLocalEvaluatorType<T,Record<U[number],PassFailCriteriaType>>
Type Parameters
T
T extends undefined | DataStructure = undefined
The data structure type for the evaluator
Parameters
evaluationFunction
(result, data) => Record<U[number], LocalEvaluatorReturnType> | Promise<Record<U[number], LocalEvaluatorReturnType>>
Function returning multiple named scores
passFailCriteria
Record<U[number], PassFailCriteriaType>
Criteria for each named evaluator
Returns
CombinedLocalEvaluatorType<T, Record<U[number], PassFailCriteriaType>>
The configured combined evaluator
Throws
When passFailCriteria is missing or contains invalid criteriaThrows
When passFailCriteria contains evaluator names not in the names arrayExample
createCustomEvaluator()
createCustomEvaluator<Defined in: src/lib/evaluators/evaluators.ts:67 Creates a custom evaluator for local evaluation of test run outputs. Local evaluators run client-side during test runs to score each executed row (with output and retrieved context). They must define both an evaluation function and pass/fail criteria to determine success.T>(name,evaluationFunction,passFailCriteria):LocalEvaluatorType<T>
Type Parameters
T
T extends undefined | DataStructure = undefined
The data structure type for the evaluator, extending DataStructure or undefined
Parameters
name
string
Unique name for the evaluator. Must be unique within a test run.
evaluationFunction
(result, data) => LocalEvaluatorReturnType | Promise<LocalEvaluatorReturnType>
Function that scores outputs
passFailCriteria
PassFailCriteriaType
Criteria defining pass/fail thresholds
Returns
LocalEvaluatorType<T>
A configured local evaluator ready for use in test runs
Throws
When passFailCriteria is null, undefined, or invalidExamples
createDataStructure()
createDataStructure<Defined in: src/lib/dataset/dataset.ts:24 Creates and validates a data structure definition for test run. Data structures define the schema and column types for datasets used in test runs and evaluations within. This function ensures the structure is valid and returns it for use within test runs.T>(dataStructure):T
Type Parameters
T
T extends undefined | DataStructure = undefined
The data structure type, extending the type DataStructure or undefined
Parameters
dataStructure
T
The data structure definition to create and validate
Returns
T
The validated data structure, unchanged if valid
Throws
When the data structure contains multiple INPUT, EXPECTED_OUTPUT, or CONTEXT_TO_EVALUATE columnsExample
sanitizeDataStructure()
sanitizeDataStructure(Defined in: src/lib/dataset/dataset.ts:29dataStructure):void
Parameters
dataStructure
undefined | DataStructure
Returns
void
validateDataStructure()
validateDataStructure(Defined in: src/lib/dataset/dataset.ts:52dataStructure,againstDataStructure):void
Parameters
dataStructure
DataStructure
againstDataStructure
DataStructure
Returns
void