Feat/user stories#54
Merged
Merged
Conversation
…quests - Add per-request timeout and exponential backoff retry logic to `generate_object` - Add support for `HeaderMap` in provider/request structs and builder methods - Implement `build_header_map` utility for safe header conversion - Add `TimeoutError` variant to `ResponseGeneratorError` - Improve error handling and retryability for timeouts and transient errors - Implement `Default` for request builders and provider builders - Refactor provider modules to use new error and header types
…-map feat(ai): add timeout, retry, and header handling to providers and requests
…s; improve header handling and retry logic - Add `top_k`, `seed`, and `presence_penalty` fields to OpenAI request payloads. - Pass organization and project headers, and merge custom/default headers in OpenAIProvider. - Refactor `GenerateTextRequest` to use `HeaderMap` for headers and add per-request timeout. - Enhance retry logic with total delay and retry notifications in `generate_text`. - Update builder to support timeout configuration and header conversion.
Refactor AI provider system to use a unified LanguageModel struct that combines provider and model name. Rename LLMProvider to AIProvider for clarity. Add memory_machine module for flexible memory management.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a memory annotation system that uses language models to automatically extract structured metadata from raw content. The changes establish a foundation for user story features by implementing LLM-based memory processing with dependency injection support.
- Adds
umem_annotationscrate to generate structured memory metadata using LLMs - Refactors AI provider architecture from
LLMProvidertoAIProviderwith a newLanguageModelabstraction - Introduces dependency injection pattern in
MemoryControllerfor testing and flexibility
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
src/memory_machine/mod.rs |
Adds new memory machine module structure |
src/memory_machine/base.rs |
Implements core memory operations (add, update, search) |
src/memory_machine/flex.rs |
Adds empty flex implementation stub |
src/lib.rs |
Exports new memory_machine module |
crates/umem_annotations/src/lib.rs |
New crate for LLM-based memory annotation with comprehensive prompt engineering |
crates/umem_annotations/Cargo.toml |
Dependencies for annotations module |
crates/umem_ai/src/lib.rs |
Renames LLMProvider to AIProvider, adds LanguageModel abstraction and singleton pattern |
crates/umem_ai/src/response_generators/mod.rs |
Adds timeout error variant |
crates/umem_ai/src/response_generators/generate_text.rs |
Enhances with timeout support, retry configuration, and error type improvements |
crates/umem_ai/src/response_generators/generate_object.rs |
Updates to use LanguageModel, adds timeout and retry improvements |
crates/umem_ai/src/utils.rs |
Adds header map building utility and timeout error handling |
crates/umem_ai/src/providers/openai.rs |
Refactors to use HeaderMap, adds organization/project headers, updates tests |
crates/umem_ai/src/providers/mod.rs |
Exports all OpenAI provider types |
crates/umem_ai/src/providers/azure_openai.rs |
Updates error type from GenerateTextError to ResponseGeneratorError |
crates/umem_ai/src/providers/anthropic.rs |
Updates error type from GenerateTextError to ResponseGeneratorError |
crates/umem_ai/src/providers/amazon_bedrock.rs |
Updates error type from GenerateTextError to ResponseGeneratorError |
crates/umem_ai/Cargo.toml |
Adds umem_config dependency |
crates/umem_controller/src/lib.rs |
Adds CreateMemoryOptions for dependency injection of vector store, embedder, and model |
crates/umem_controller/src/create_memory_request.rs |
Implements async memory building with LLM annotations |
crates/umem_controller/Cargo.toml |
Adds umem_ai and umem_annotations dependencies |
crates/umem_config/src/lib.rs |
Adds language model configuration with OpenAI provider support |
crates/umem_core/src/temporal_metadata.rs |
Adds Default derive |
crates/umem_core/src/provenance.rs |
Adds JsonSchema, Clone, Default derives and default variants |
crates/umem_core/src/memory_signals.rs |
Adds JsonSchema, Clone, Default derives |
crates/umem_core/src/memory_kind.rs |
Adds JsonSchema derive |
crates/umem_core/src/memory_content.rs |
Adds JsonSchema and Default derives |
crates/umem_core/src/lib.rs |
Adds Default derive to Memory |
crates/umem_core/src/credence.rs |
Adds JsonSchema and Default derives |
crates/umem_core/Cargo.toml |
Adds schemars dependency |
crates/umem_mcp/src/service.rs |
Updates create call to pass None for options |
crates/umem_grpc_server/src/service.rs |
Updates create call to pass None for options |
Cargo.toml |
Adds umem_annotations to workspace and root dependencies |
Cargo.lock |
Updates lock file with new dependencies |
Comments suppressed due to low confidence (2)
crates/umem_ai/src/providers/openai.rs:426
- Test uses outdated type reference. The test creates an
LLMProvider, but this type has been renamed toAIProviderin the main code. Update the test to useAIProvider::from(...)instead.
let provider = Arc::new(LLMProvider::from(
OpenAIProviderBuilder::new()
.api_key("")
.base_url("https://openrouter.ai/api/v1")
crates/umem_ai/src/providers/openai.rs:461
- Test uses outdated type reference. The test creates an
LLMProvider, but this type has been renamed toAIProviderin the main code. Update the test to useAIProvider::from(...)instead.
let provider = Arc::new(LLMProvider::from(
OpenAIProviderBuilder::new()
.api_key("")
.base_url("https://openrouter.ai/api/v1")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vidurkhanal
approved these changes
Dec 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.