llm/

directory
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT

README

LLM examples

These programs demonstrate focused features of github.com/ktsoator/or/llm. They call live model APIs and may incur provider charges.

Set the environment variables required by each example before running it. The programs intentionally use the process environment directly so applications can choose their own configuration or secret-management library.

Example What it demonstrates Required environment variables
complete A minimal non-streaming completion DEEPSEEK_API_KEY
stream Text, reasoning, terminal events, and usage DEEPSEEK_API_KEY
tool Typed tools, validation, diagnostics, and a tool loop DEEPSEEK_API_KEY
image Sending a local image to a multimodal model XIAOMI_API_KEY
model-switching Reusing one history across two protocols DEEPSEEK_API_KEY, MINIMAX_CN_API_KEY

For example:

export DEEPSEEK_API_KEY=your-deepseek-api-key
go run ./example/llm/complete

The image example also expects a local file path:

export XIAOMI_API_KEY=your-xiaomi-api-key
go run ./example/llm/image ./screenshot.png

See the LLM documentation for detailed guides and API behavior.

Directories

Path Synopsis
Command complete demonstrates the smallest non-streaming model request.
Command complete demonstrates the smallest non-streaming model request.
Command image sends a local image to a multimodal model.
Command image sends a local image to a multimodal model.
Command model-switching reuses one provider-neutral conversation across two models that speak different wire protocols.
Command model-switching reuses one provider-neutral conversation across two models that speak different wire protocols.
Command stream demonstrates incremental reasoning and text events.
Command stream demonstrates incremental reasoning and text events.
Command tool demonstrates a complete typed-tool execution loop.
Command tool demonstrates a complete typed-tool execution loop.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL