Skip to content

rig-core-v0.37.0

Choose a tag to compare

@github-actions github-actions released this 13 May 04:28
· 348 commits to main since this release
63d215f

Added

  • (openrouter) add transcription (STT) and audio generation (TTS) support (#1757) (by @fversaci)
  • (memory) add Compactor trait, CompactingMemory adapter, and TemplateCompactor (#1748) (by @ForeverAngry)
  • (ollama) Enhance think parameter with string levels (#1747) (by @cobaltburn)
  • (memory) Rig-managed conversation memory + rig-memory companion crate (#1702) (by @ForeverAngry)
  • add copilot model listing (#1700) (by @BigtoC) - #1700

Fixed

  • (gemini) Token usage correctness for posthog llm analytics (#1761) (by @mateobelanger)
  • (openrouter) skip serializing empty content in Assistant messages (#1735) (by @pablof7z)
  • (openai) send PDF Documents as file parts in chat completions (#1732) (by @fangkangmi)
  • (core) [breaking] make Chat append messages to caller history (#1733) (by @gold-silver-copper)
  • added a trailing newline after streamed agent response. The AgentImpl::request method streams tokens using print! macro with no trailing newline, so when the stream ends, the run loop prints the closing separator immediately which causes it to appear on the same line as the last response token - So added a println!() to the None arm of the streaming loop so a newline is always emitted after the final chunk which matches the ChatImpl path that uses println. (#1712) (by @Shaurya-Sethi) - #1712
  • (mistral) expose cached and audio token fields in Usage (#1725) (by @byQuexo)

Other

Contributors

Added

  • rig::memory::Compactor trait. A Compactor produces a single
    Message-shaped Artifact from a slice of messages a memory policy
    has evicted, optionally combining it with the previous summary
    (carry_over) for rolling-summary semantics. Where DemotionHook
    is a one-way drain that observes evicted messages, Compactor is
    the inverse: it returns an artifact that the composing adapter
    splices back into the active history, so the loaded prompt shape is
    [summary, ...recent_window] instead of a verbatim suffix. The
    trait lives in rig_core so any memory backend can implement it
    without taking a rig-memory dependency; the composing
    CompactingMemory adapter and a zero-dependency TemplateCompactor
    reference implementation live in rig-memory. Implementations with
    durable side effects (LLM calls, vector-store writes) must
    deduplicate per the same idempotency contract as DemotionHook,
    since per-conversation watermarks are in-process only.

  • Rig-managed conversation memory:

    • New rig::memory module with the ConversationMemory trait,
      MemoryError (with a MemoryBackendError source type),
      MessageFilter trait, and a default InMemoryConversationMemory backend
      with optional with_filter for shaping loaded history.
    • AgentBuilder::memory(...) and AgentBuilder::conversation_id(...) to
      attach a backend and an optional default conversation id to an agent.
    • PromptRequest::conversation(id) and PromptRequest::without_memory()
      (mirrored on the streaming builder) to control memory per-request.
    • From<MemoryError> for PromptError and From<MemoryError> for StreamingError so memory failures propagate via ? through the existing
      CompletionError::RequestError(Box<dyn Error>) variant — no new
      top-level error variants, fully additive change.
    • memory.append(...) failures after a successful completion are
      best-effort: they emit tracing::warn! and the agent still returns the
      model response (parity for streaming FinalResponse). memory.load(...)
      failures remain fatal because the requested history is unavailable.
    • Examples: agent_with_memory.rs and agent_with_memory_streaming.rs.
    • Named history-shaping policies (sliding window, token budget) live in the
      new companion crate rig-memory.
  • rig::memory::DemotionHook trait and NoopDemotionHook no-op default.
    Side-channel for messages that a memory policy or adapter removes from
    active history. Defined in rig-core so any memory backend can implement
    it without a rig-memory dependency; the composing
    DemotingPolicyMemory<M, P, H> adapter lives in rig-memory. Includes a
    forwarding impl<H: DemotionHook + ?Sized> DemotionHook for Arc<H> so
    hooks can be shared across multiple adapters.

  • MemoryError::Internal(String) variant for in-process invariant
    violations (e.g. poisoned mutex guards), distinct from
    MemoryError::Backend which is reserved for failures of the underlying
    conversation store. MemoryError is now #[non_exhaustive] so future
    variants are not breaking changes.

    Note for downstream crates: MemoryError was previously a plain
    enum, so any existing match against it without a wildcard arm will
    now warn (and may need a wildcard arm if it was upgraded to a hard
    error elsewhere). Adding _ => ... is forward-compatible with future
    variants.