Files
miti99bot/internal/ai/types.go
T
tiennm99 1fc425c55f refactor(modules): drop loldle variants, semantle, doantu and dead framework surface
Removes six modules (loldle-ability/emoji/quote/splash, semantle, doantu)
and prunes the framework deps that were only there to serve them:

  - ai.Embedder + Client.Embed + embeddingModel const (semantle only)
  - Deps.Embedder + BuildOptions.Embedder
  - Deps.Env + Build(env) param + ModuleEnv config field + PHOW2SIM allowlist (doantu only)
  - internal/champname package (loldle now owns its lookup helpers directly)
  - template.yaml: Phow2simAPIURL parameter + PHOW2SIM_API_URL Lambda env

Active catalog: util, misc, wordle, loldle, lolschedule, twentyq, trading.

go build / vet / test all pass.
2026-05-11 16:02:06 +07:00

23 lines
946 B
Go

// Package ai wraps Google's genai SDK with a small, mockable surface for the
// twentyq module. The package owns:
//
// - Chatter interface — what modules consume
// - Client struct — production implementation backed by genai
// - per-user rate limiter — defends the shared 1500-RPD Gemini free tier
//
// Modules accept the interface (not *Client) so unit tests can pass fakes
// without spinning up a real Gemini client. Production wiring in cmd/server
// passes the *Client (which satisfies the interface) into Deps.
package ai
import "context"
// Chatter produces a single text completion from a system + user prompt
// pair. Used by the twentyq module's judge + round-start calls.
//
// On rate-limit (HTTP 429) the implementation should return ErrRateLimited
// so callers can show a user-friendly retry message.
type Chatter interface {
Generate(ctx context.Context, system, user string) (string, error)
}