Skip to content

v0.5.1

Choose a tag to compare

@ktsoator ktsoator released this 25 Jun 03:13
11c0b0c

Conversation convenience helpers

One additive feature plus internal refactors. No breaking changes.

or/llm — build and read conversations with less boilerplate

The common "send some text" path no longer needs nested struct literals. The underlying Context, Message, and content types are unchanged and remain fully general.

New constructors:

  • Prompt(text) / PromptWithSystem(system, user) — build a Context from text
  • UserText / AssistantText — single-text messages
  • UserImage(data, mime) — single-image user message
  • ToolResult(callID, name, text) — tool result message
  • NewContext(messages...) — assemble a Context

New accessors on AssistantMessage:

  • Text() — all text blocks joined
  • ToolCalls() — every tool call, in order

A minimal completion drops from ~14 lines to 3:

resp, err := llm.Complete(ctx, model, llm.Prompt("Explain Go channels briefly."), llm.StreamOptions{})
if err != nil { log.Fatal(err) }
fmt.Println(resp.Text())

Internal

  • Conversation types now live in their own file, separate from Model
  • Model catalog is stored as a flat array
  • Expanded adapter/agent documentation

Examples and docs use the new helpers; longhand remains valid for mixed content such as text plus images.