Example
A single evaluation example with flexible key-value properties. Use `Example.create()` to construct an example with arbitrary fields such as `input`, `actualOutput`, `expectedOutput`, etc.
A single evaluation example with flexible key-value properties.
Use Example.create() to construct an example with arbitrary fields
such as input, actualOutput, expectedOutput, etc.
const example = Example.create({
input: "What is the capital of France?",
actual_output: "Paris is the capital of France.",
expected_output: "Paris",
});
example.get("input"); // "What is the capital of France?"Attributes
exampleId
:string
createdAt
:string
name
:string | null
Static Method
create()
Create an example with the given properties.
Any key-value pairs passed in props become accessible via .get().
Common keys: input, actual_output, expected_output, retrieval_context.
function create(props: Record<string, unknown> = {}): ExampleParameters
props
:Record<string, unknown>
{}
Returns
Example
Static Method
from()
Reconstruct an Example from an API response dict.
Separates the fixed metadata fields (example_id, created_at, name)
from user-defined properties.
function from(data: ExampleDict): ExampleParameters
data
required:ExampleDict
Returns
Example
get()
Get a property by key.
function get(key: string): unknownParameters
key
required:string
Returns
unknown
has()
Check if a property key exists.
function has(key: string): booleanParameters
key
required:string
Returns
boolean
toJSON()
Serialize to the API wire format.
function toJSON(): ExampleDictReturns
ExampleDict
Last updated on