Type-Safe LLM Orchestration for Go. Synapses. Sessions. Structure.
Interact with LLMs through typed synapses that return validated Go structs, not raw strings. Sessions maintain conversation context across calls, and pipz integration provides retry, timeout, and circuit breaking out of the box.
Getting Startedimport "github.com/zoobz-io/zyn"
type Contact struct {
Name string `json:"name"`
Email string `json:"email"`
Role string `json:"role"`
}
func (c Contact) Validate() error {
if c.Email == "" {
return errors.New("email required")
}
return nil
}
// Type-safe extraction — LLM output → validated struct
extractor, _ := zyn.Extract[Contact]("contact information", provider)
// Sessions carry conversation context across calls
session := zyn.NewSession()
contact, _ := extractor.Fire(ctx, session, "Reach John at john@acme.com, he's the CTO")
// contact.Name = "John", contact.Email = "john@acme.com", contact.Role = "CTO"
// 8 synapse types for different reasoning tasks
decision, _ := zyn.Binary("Is this a business email?", provider)
result, _ := decision.Fire(ctx, session, contact.Email) // true
category, _ := zyn.Classification("department", provider, "engineering", "sales", "support")
dept, _ := category.Fire(ctx, session, "I need help with the API integration")
// dept = "engineering"Why Zyn?
Structured, type-safe LLM interactions with conversational context and built-in reliability.
Type-Safe at the Edges
Generics ensure LLM outputs match expected types at compile time. Invalid responses fail validation before reaching your code.
8 Synapse Types
Binary, Classification, Ranking, Sentiment, Extract, Transform, Analyze, Convert — each with structured prompts that prevent output divergence.
Conversational Sessions
Sessions carry full conversation history across synapse calls. Transactional updates — session only changes on successful completion.
Built-In Reliability
Pipz integration for retry with backoff, timeout, circuit breaker, rate limiting, and fallback synapses. No boilerplate.
Automatic Observability
Capitan signals fire at every LLM operation — RequestStarted, ProviderCallCompleted, ResponseParseFailed. No instrumentation needed.
Validator Pattern
Custom types implement Validate() error for runtime validation of LLM responses. Catches malformed outputs before they propagate.
Capabilities
Typed synapses, conversational sessions, and reliability patterns for production LLM applications.
| Feature | Description | Link |
|---|---|---|
| Extraction Synapses | Extract structured data into validated Go types. Analyze structured input into text. Convert between types via LLM reasoning. | Extraction Pipelines |
| Decision Synapses | Binary yes/no, Classification into categories, Ranking by criteria, Sentiment analysis with emotional scoring. | Classification Workflows |
| Session Management | Prune, Truncate, Clear, Insert, Replace operations on conversation history. Context accumulates naturally across calls. | Sessions |
| Provider Configuration | Simple Provider interface. OpenAI included, mock provider for testing. Any LLM backend via one method. | Providers |
| Reliability Patterns | Retry with exponential backoff, timeout protection, circuit breakers, rate limiting, and fallback chains. | Reliability |
| Error Handling | Structured error responses with context. Validation failures, provider errors, and parse failures all typed and actionable. | Error Handling |
Articles
Browse the full zyn documentation.