Vsak operator, ki ga program .lolo lahko pokliče, iz kanoničnega registra, ki ga prevajalnik vgradi.
Imenski prostori na tej strani: llm/, nn/, tensor/, train/.
llm/call-toolsCall the LLM with tool definitions. Returns the assistant response with optional tool calls and token usage.
(llm/call-tools prompt tools)Parametri
| Ime | Tip | Opis |
|---|---|---|
prompt | string | User prompt |
tools | array | Tool definitions |
Vrne: LlmCallToolsResult · Teče na: any
Primer
(llm/call-tools [{"role":"user","content":"What time is it?"}] [{"name":"getTime","description":"Get current time","parameters":{}}])llm/compactCompact the context window. Returns before/after token counts.
(llm/compact strategy)Parametri
| Ime | Tip | Opis |
|---|---|---|
strategy | {'kind': 'union', 'of': [{'kind': 'literal', 'value': 'hybrid'}, {'kind': 'literal', 'value': 'summarize'}, {'kind': 'literal', 'value': 'truncate'}, {'kind': 'literal', 'value': 'extract'}]} | Compaction strategy |
Vrne: object · Teče na: any
Primer
(llm/compact) // => {before: 10000 after: 8000}llm/embedGenerate embeddings for an array of texts. Returns a 2D array of floats.
(llm/embed texts)Parametri
| Ime | Tip | Opis |
|---|---|---|
texts | array | Texts to embed |
Vrne: array · Teče na: any
Primer
(llm/embed ["hello" "world"])llm/generateGenerate text from an LLM. Returns the generated string.
(llm/generate prompt)Parametri
| Ime | Tip | Opis |
|---|---|---|
prompt | string | Generation prompt |
Vrne: string · Teče na: any
Primer
(llm/generate "Write a haiku") // => "Spring rain falls gently"llm/switchSwitch the active LLM provider and optionally the model.
(llm/switch provider)Parametri
| Ime | Tip | Opis |
|---|---|---|
provider | string | LLM provider name |
Vrne: void · Teče na: any
Primer
(llm/switch "claude")llm/token-countGet the current token count in the context window.
(llm/token-count)Vrne: number
Primer
(llm/token-count) // => 5432nn/batchnormBatch normalization layer
(nn/batchnorm input)Parametri
| Ime | Tip | Opis |
|---|---|---|
input | any | Input layer or config |
Vrne: nn/layer
Primer
(nn/batchnorm 64)nn/cloneCreate a deep copy of the network with same weights
(nn/clone module)Parametri
| Ime | Tip | Opis |
|---|---|---|
module | any | Neural network module |
Vrne: nn/module
Primer
(nn/clone {"layers":[{"type":"dense","units":2}]})nn/dropoutDropout layer for regularization (randomly zeros elements during training)
(nn/dropout p)Parametri
| Ime | Tip | Opis |
|---|---|---|
p | number | Dropout probability |
Vrne: nn/layer
Primer
(nn/dropout)nn/forwardExecute forward pass through network
(nn/forward module input)Parametri
| Ime | Tip | Opis |
|---|---|---|
module | any | Neural network module |
input | any | Input tensor |
Vrne: tensor
Primer
(nn/forward {"layers":[{"type":"dense","units":2}]} [0.1,0.2])nn/getWeightsGet network weights as a flat tensor
(nn/getWeights module)Parametri
| Ime | Tip | Opis |
|---|---|---|
module | any | Neural network module |
Vrne: tensor
Primer
(nn/getWeights {"layers":[{"type":"dense","units":2}]})nn/layernormLayer normalization
(nn/layernorm input)Parametri
| Ime | Tip | Opis |
|---|---|---|
input | any | Input layer or config |
Vrne: nn/layer
Primer
(nn/layernorm 64)nn/linearFully connected linear layer (output = input * weights + bias)
(nn/linear inSize outSize)Parametri
| Ime | Tip | Opis |
|---|---|---|
inSize | number | Input dimension |
outSize | number | Output dimension |
Vrne: nn/layer
Primer
(nn/linear 128 64)nn/paramCountGet total number of trainable parameters
(nn/paramCount module)Parametri
| Ime | Tip | Opis |
|---|---|---|
module | any | Neural network module |
Vrne: number
Primer
(nn/paramCount {"layers":[{"type":"dense","units":2}]})nn/reluReLU activation function: max(0, x)
(nn/relu)Vrne: nn/layer
Primer
(nn/relu)nn/sequentialCreate a sequential neural network from layers
(nn/sequential layer)Parametri
| Ime | Tip | Opis |
|---|---|---|
layer | any | First layer (variadic) |
Vrne: nn/module
Primer
(nn/sequential ["nn/linear",16,64] ["nn/relu"] ["nn/linear",64,4])nn/setWeightsSet network weights from a flat tensor
(nn/setWeights module weights)Parametri
| Ime | Tip | Opis |
|---|---|---|
module | any | Neural network module |
weights | any | Weight tensor (variadic) |
Vrne: nn/module · Teče na: any
Primer
(nn/setWeights {"layers":[{"type":"dense","units":2}]} [0.1,0.2,0.3])nn/sigmoidSigmoid activation function: 1 / (1 + e^-x)
(nn/sigmoid)Vrne: nn/layer
Primer
(nn/sigmoid)nn/softmaxSoftmax activation function (normalizes to probability distribution)
(nn/softmax dim)Parametri
| Ime | Tip | Opis |
|---|---|---|
dim | number | Dimension to apply softmax |
Vrne: nn/layer
Primer
(nn/softmax)nn/tanhTanh activation function: (e^x - e^-x) / (e^x + e^-x)
(nn/tanh)Vrne: nn/layer
Primer
(nn/tanh)tensor/addElement-wise addition
(tensor/add a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | any | First tensor |
b | any | Second tensor |
Vrne: tensor
Primer
(tensor/add [1,2] [3,4])tensor/allInRangeCheck if all elements are within range [min, max]
(tensor/allInRange tensor range)Parametri
| Ime | Tip | Opis |
|---|---|---|
tensor | any | Tensor to check |
range | array | Range [min, max] |
Vrne: boolean
Primer
(tensor/allInRange [0.5,-0.2] [-1.0,1.0]) // => truetensor/argmaxIndex of maximum value
(tensor/argmax tensor)Parametri
| Ime | Tip | Opis |
|---|---|---|
tensor | any | Tensor to search (variadic) |
Vrne: number | tensor
Primer
(tensor/argmax [0.1,0.9,0.3]) // => 1tensor/catConcatenate two tensors along the last dimension
(tensor/cat a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | First tensor |
b | tensor | Second tensor |
Vrne: tensor
Primer
(tensor/cat [1,2] [3,4])tensor/clampClamp all elements to range [min, max]
(tensor/clamp t min max)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to clamp |
min | number | Minimum value |
max | number | Maximum value |
Vrne: tensor
Primer
(tensor/clamp [5,-15,3] -10.0 10.0)tensor/clampPerDimClamp each dimension to its specified range
(tensor/clampPerDim t ranges)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to clamp |
ranges | object | Per-dimension range specifications |
Vrne: tensor
Primer
(tensor/clampPerDim [5,-15] {"0":{"min":0,"max":10},"1":{"min":-10,"max":10}})tensor/divElement-wise division
(tensor/div a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | Dividend tensor |
b | tensor | Divisor tensor |
Vrne: tensor
Primer
(tensor/div [10,20] 2)tensor/dotDot product of two 1D tensors
(tensor/dot a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | First 1D tensor |
b | tensor | Second 1D tensor |
Vrne: number
Primer
(tensor/dot [1,2] [3,4]) // => 11tensor/flattenFlatten tensor to 1D
(tensor/flatten t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to flatten |
Vrne: tensor
Primer
(tensor/flatten [[1,2],[3,4]])tensor/fromCreate tensor from array
(tensor/from arr)Parametri
| Ime | Tip | Opis |
|---|---|---|
arr | array | Array to convert |
Vrne: tensor
Primer
(tensor/from [1 2 3 4])tensor/getGet element at index
(tensor/get t idx)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to index |
idx | number | Index position |
Vrne: number
Primer
(tensor/get [10,20,30,40] 3) // => 3.14tensor/matmulMatrix multiplication
(tensor/matmul a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | First matrix |
b | tensor | Second matrix |
Vrne: tensor
Primer
(tensor/matmul [[1,2],[3,4]] [[5,6],[7,8]])tensor/maxMaximum value in tensor
(tensor/max t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number | tensor
Primer
(tensor/max [0.1,0.9,0.3]) // => 99tensor/meanMean of tensor elements
(tensor/mean t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number | tensor
Primer
(tensor/mean [0.2,0.4,0.6]) // => 50tensor/minMinimum value in tensor
(tensor/min t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number | tensor
Primer
(tensor/min [3,1,2]) // => 1tensor/mulElement-wise multiplication
(tensor/mul a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | First tensor |
b | tensor | Second tensor |
Vrne: tensor
Primer
(tensor/mul [0.5,0.7] 0.99)tensor/normL2 norm of tensor
(tensor/norm t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number
Primer
(tensor/norm [3,4]) // => 5.2tensor/onesCreate tensor filled with ones
(tensor/ones shape)Parametri
| Ime | Tip | Opis |
|---|---|---|
shape | array | Tensor shape |
Vrne: tensor
Primer
(tensor/ones [2 3])tensor/outOfRangeDimsGet dimensions that exceed their specified ranges
(tensor/outOfRangeDims t ranges)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to check |
ranges | object | Dimension range specifications |
Vrne: array
Primer
(tensor/outOfRangeDims [5,-15] {"0":{"min":0,"max":10},"1":{"min":-10,"max":10}}) // => [0]tensor/outOfRangeIndicesGet indices of elements outside range
(tensor/outOfRangeIndices t ranges)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to check |
ranges | object | Value range specifications |
Vrne: number[]
Primer
(tensor/outOfRangeIndices [0.5,1.5] [-1.0,1.0]) // => [0 2]tensor/randCreate tensor with random values in [0, 1)
(tensor/rand shape)Parametri
| Ime | Tip | Opis |
|---|---|---|
shape | array | Tensor shape |
Vrne: tensor
Primer
(tensor/rand [2 3])tensor/randnCreate tensor with random values from standard normal distribution
(tensor/randn shape)Parametri
| Ime | Tip | Opis |
|---|---|---|
shape | array | Tensor shape |
Vrne: tensor
Primer
(tensor/randn [2 3])tensor/reshapeReshape tensor to new shape (total elements must match)
(tensor/reshape t shape)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to reshape |
shape | array | New shape |
Vrne: tensor
Primer
(tensor/reshape [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] [4,4])tensor/shapeGet tensor shape as array
(tensor/shape t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number[]
Primer
(tensor/shape [[1,2],[3,4]]) // => [3 4 5]tensor/sliceGet slice of tensor
(tensor/slice t start end)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to slice |
start | number | Start index |
end | number | End index |
Vrne: tensor
Primer
(tensor/slice [10,20,30,40] 0 3)tensor/squeezeRemove all dimensions of size one
(tensor/squeeze t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to squeeze |
Vrne: tensor
Primer
(tensor/squeeze [[1,2,3]])tensor/stackStack two tensors along a new leading dimension
(tensor/stack a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | First tensor |
b | tensor | Second tensor |
Vrne: tensor
Primer
(tensor/stack [1,2] [3,4])tensor/subElement-wise subtraction
(tensor/sub a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | tensor | Minuend tensor |
b | tensor | Subtrahend tensor |
Vrne: tensor
Primer
(tensor/sub [1,2] [3,4])tensor/sumSum of tensor elements
(tensor/sum t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor |
Vrne: number | tensor
Primer
(tensor/sum [1,0,1]) // => 500tensor/toArrayConvert tensor to nested array
(tensor/toArray t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to convert |
Vrne: array
Primer
(tensor/toArray [[1,2],[3,4]]) // => [[1 2] [3 4]]tensor/toListConvert 1D tensor to flat array
(tensor/toList t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | 1D tensor |
Vrne: number[]
Primer
(tensor/toList [1,2,3]) // => [1 2 3]tensor/transposeTranspose a tensor (optionally swapping two named dimensions)
(tensor/transpose t)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to transpose |
Vrne: tensor
Primer
(tensor/transpose [[1,2],[3,4]] 0 1)tensor/unsqueezeInsert a dimension of size one at the given position
(tensor/unsqueeze t dim)Parametri
| Ime | Tip | Opis |
|---|---|---|
t | tensor | Tensor to unsqueeze |
dim | number | Dimension position |
Vrne: tensor
Primer
(tensor/unsqueeze [1,2,3] 0)tensor/zerosCreate tensor filled with zeros
(tensor/zeros shape)Parametri
| Ime | Tip | Opis |
|---|---|---|
shape | array | Tensor shape |
Vrne: tensor
Primer
(tensor/zeros [2 3])train/adamAdam optimizer step
(train/adam params grads)Parametri
| Ime | Tip | Opis |
|---|---|---|
params | object | Model parameters |
grads | object | Gradient values |
Vrne: void · Teče na: any
Primer
(train/adam {"layers":[{"type":"dense","units":2}]} 0.001)train/checkConstraintsCheck if network weights satisfy all constraints
(train/checkConstraints weights constraints)Parametri
| Ime | Tip | Opis |
|---|---|---|
weights | object | Network weights |
constraints | object | Constraint specifications |
Vrne: train/constraintResult
Primer
(train/checkConstraints [0.1,0.2] {"maxMagnitude":10})train/checkForbiddenOutputsCheck if model produces outputs in forbidden regions
(train/checkForbiddenOutputs model outputs ranges)Parametri
| Ime | Tip | Opis |
|---|---|---|
model | object | Model |
outputs | array | Model outputs |
ranges | object | Forbidden output ranges |
Vrne: train/forbiddenResult
Primer
(train/checkForbiddenOutputs {"layers":[{"type":"dense","units":2}]} [[0],[1]] {"0":{"min":100,"max":200}})train/checkRegressionCheck if new model regresses on required invariants
(train/checkRegression oldModel newModel testData)Parametri
| Ime | Tip | Opis |
|---|---|---|
oldModel | object | Old model |
newModel | object | New model |
testData | array | Test dataset |
Vrne: train/regressionResult
Primer
(train/checkRegression [0.1,0.2] {"layers":[{"type":"dense","units":2}]} [{"input":[0],"expected":[1]}])train/checkWeightMagnitudeCheck if all weights are within magnitude limit
(train/checkWeightMagnitude weights maxMag)Parametri
| Ime | Tip | Opis |
|---|---|---|
weights | object | Network weights |
maxMag | number | Maximum magnitude |
Vrne: boolean
Primer
(train/checkWeightMagnitude {"layers":[{"type":"dense","units":2}]} 10.0) // => truetrain/clipGradientsClip gradients to max norm (modifies in place)
(train/clipGradients grads maxNorm)Parametri
| Ime | Tip | Opis |
|---|---|---|
grads | object | Gradients to clip |
maxNorm | number | Maximum norm |
Vrne: number · Teče na: any
Primer
(train/clipGradients {"layers":[{"type":"dense","units":2}]} 1.0)train/clipWeightsClip weights to max magnitude (modifies in place)
(train/clipWeights weights maxMag)Parametri
| Ime | Tip | Opis |
|---|---|---|
weights | object | Weights to clip |
maxMag | number | Maximum magnitude |
Vrne: void · Teče na: any
Primer
(train/clipWeights {"layers":[{"type":"dense","units":2}]} 10.0)train/computeAdvantagesCompute GAE advantages for policy gradient
(train/computeAdvantages rewards baseline gamma)Parametri
| Ime | Tip | Opis |
|---|---|---|
rewards | array | Reward trajectory |
baseline | array | Baseline values |
gamma | number | Discount factor |
Vrne: tensor
Primer
(train/computeAdvantages [1,0,1] [0.5,0.4,0.3] {"gamma":0.99,"lambda":0.95})train/computeReturnsCompute discounted returns from rewards
(train/computeReturns rewards gamma)Parametri
| Ime | Tip | Opis |
|---|---|---|
rewards | array | Reward trajectory |
gamma | number | Discount factor |
Vrne: tensor
Primer
(train/computeReturns [1,0,1] 0.99)train/crossEntropyCross-entropy loss for classification
(train/crossEntropy predictions targets)Parametri
| Ime | Tip | Opis |
|---|---|---|
predictions | array | Predicted probabilities |
targets | array | Target labels |
Vrne: number
Primer
(train/crossEntropy [0.1 0.9] [0 1]) // => 0.105train/getGradientNormGet current gradient norm
(train/getGradientNorm gradients)Parametri
| Ime | Tip | Opis |
|---|---|---|
gradients | object | Gradient structure |
Vrne: number
Primer
(train/getGradientNorm {"layers":[{"type":"dense","units":2}]})train/getMaxWeightMagnitudeGet maximum weight magnitude in network
(train/getMaxWeightMagnitude model)Parametri
| Ime | Tip | Opis |
|---|---|---|
model | object | Neural network model |
Vrne: number
Primer
(train/getMaxWeightMagnitude {"layers":[{"type":"dense","units":2}]})train/huberHuber loss (smooth L1, robust to outliers)
(train/huber predicted target)Parametri
| Ime | Tip | Opis |
|---|---|---|
predicted | number | Predicted value |
target | number | Target value (variadic) |
Vrne: number
Primer
(train/huber 0.5 0.7 1.0)train/loopExecute training loop with constraints
(train/loop model config callback)Parametri
| Ime | Tip | Opis |
|---|---|---|
model | object | Neural network model |
config | object | Training configuration |
callback | lambda | Epoch callback |
Vrne: train/result · Teče na: any
Primer
(train/loop {"layers":[{"type":"dense","units":2}]} [{"state":[0],"action":1,"reward":1}] {"epochs":10})train/mseMean squared error loss
(train/mse predicted target)Parametri
| Ime | Tip | Opis |
|---|---|---|
predicted | array | Predicted values |
target | array | Target values |
Vrne: number
Primer
(train/mse [1.0 2.0] [1.1 2.1]) // => 0.01train/sampleBatchSample random batch from experience buffer
(train/sampleBatch buffer batch_size)Parametri
| Ime | Tip | Opis |
|---|---|---|
buffer | array | Experience buffer |
batch_size | number | Batch size |
Vrne: array
Primer
(train/sampleBatch [{"state":[0],"reward":1},{"state":[1],"reward":0}] 2)train/sgdStochastic gradient descent optimizer step
(train/sgd gradients learning_rate)Parametri
| Ime | Tip | Opis |
|---|---|---|
gradients | object | Gradient structure |
learning_rate | number | Learning rate (variadic) |
Vrne: void · Teče na: any
Primer
(train/sgd {"layers":[{"type":"dense","units":2}]} 0.01 0.9)train/stepExecute single training step (forward, loss, backward, update)
(train/step model input target optimizer)Parametri
| Ime | Tip | Opis |
|---|---|---|
model | object | Neural network model |
input | any | Input data |
target | any | Target data |
optimizer | object | Optimizer state |
Vrne: train/stepResult · Teče na: any
Primer
(train/step {"layers":[{"type":"dense","units":2}]} [0.1,0.2] [1] {"lr":0.01})train/validateValidate model on test cases, returns pass/fail metrics
(train/validate model test_data)Parametri
| Ime | Tip | Opis |
|---|---|---|
model | object | Neural network model |
test_data | array | Test dataset |
Vrne: train/validationResult
Primer
(train/validate {"layers":[{"type":"dense","units":2}]} [{"input":[0],"expected":[1]}])