Cheatsheet
A one-page index of the dspy4s surface. Each row links to the page that covers
it in full. For runnable versions of every construct below, see
Cheatsheet.scala
in the examples module.
Declare a task
| I want to |
Use |
Page |
| Declare inputs and outputs |
Signature.fromType / Signature.fromString |
Signatures |
| Use named fields, enums, custom types |
Spec trait + Signature.of[T] |
Signatures |
Run a task
Talk to a model
| I want to |
Use |
Page |
| Configure a model |
OpenAiLanguageModel |
Configuring an LM |
| Pick text vs JSON output |
ChatAdapter / JSONAdapter |
Adapters |
| Cache or track usage |
ManagedLanguageModel, UsageTracking |
Caching & usage |
Measure and improve
Operate
| I want to |
Use |
Page |
| Configure the active model/adapter |
RuntimeContext, RuntimeEnvironment |
Runtime context |
| Observe a run |
CallbackHandler, inspectHistory |
Observability |
| Persist a tuned program |
ProgramPersistence |
Saving & loading |
| Stream output |
Streamify, StreamListener |
Streaming |