ilusm.dev

llm

LLM/AI integration: OpenAI, Anthropic Claude, Ollama, local models.

Load with: use llm

Quick example

use llm

result = llmoi("hello", "value")
prn(result)

Functions

OpenAI

llmoi(key, md)

Performs the operation. Takes key, md.

llmc2(ctx, msgs, opts)

Performs the operation. Takes ctx, msgs, opts.

llms3(ctx, pr)

Performs the operation. Takes ctx, pr.

llmmb(ctx, txts, md)

Performs the operation. Takes ctx, txts, md.

Anthropic Claude

llmc3(key, md)

Performs the operation. Takes key, md.

llmc0(ctx, msgs, opts)

Performs the operation. Takes ctx, msgs, opts.

llms0(ctx, pr)

Performs the operation. Takes ctx, pr.

Ollama (local)

llmll(url, md)

Performs the operation. Takes url, md.

llmc1(ctx, msgs, opts)

Performs the operation. Takes ctx, msgs, opts.

llms1(ctx, pr)

Performs the operation. Takes ctx, pr.

llmpl(ctx, md)

Performs the operation. Takes ctx, md.

llmls(ctx)

Lists items. Takes ctx.

Unified interface

llmch(ctx, msgs, opts)

Checks a condition. Takes ctx, msgs, opts.

llmst(ctx, pr)

Sets a value or starts a process. Takes ctx, pr.

Streaming

llms2(ctx, msgs, onchunk)

Performs the operation. Takes ctx, msgs, onchunk.

Tools/functions

llmcl(ctx, msgs, tools)

Closes or clears. Takes ctx, msgs, tools.

Vision

llmvs(ctx, img, pr)

Performs the operation. Takes ctx, img, pr.

Embeddings similarity

llmsm(e1, e2)

Performs the operation. Takes e1, e2.

llmsr(ctx, q, docs, topk)

Performs the operation. Takes ctx, q, docs, topk.

Caching

llmcc(ctx, key, fn, ttl)

Performs the operation. Takes ctx, key, fn, ttl.

Batch

llmbt(ctx, prs, opts)

Performs the operation. Takes ctx, prs, opts.

Notes

  • LLM integration helpers - prompt building, token estimation, streaming.