Skip to content

Feat/user stories#54

Merged
vidurkhanal merged 5 commits into
mainfrom
feat/user_stories
Dec 26, 2025
Merged

Feat/user stories#54
vidurkhanal merged 5 commits into
mainfrom
feat/user_stories

Conversation

@Sang-it

@Sang-it Sang-it commented Dec 26, 2025

Copy link
Copy Markdown
Member

No description provided.

Sang-it and others added 5 commits December 24, 2025 02:19
…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.
@Sang-it Sang-it marked this pull request as ready for review December 26, 2025 03:07
@vidurkhanal vidurkhanal requested a review from Copilot December 26, 2025 03:08
@vidurkhanal vidurkhanal added the enhancement New feature or request label Dec 26, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_annotations crate to generate structured memory metadata using LLMs
  • Refactors AI provider architecture from LLMProvider to AIProvider with a new LanguageModel abstraction
  • Introduces dependency injection pattern in MemoryController for 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 to AIProvider in the main code. Update the test to use AIProvider::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 to AIProvider in the main code. Update the test to use AIProvider::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.

Comment thread crates/umem_ai/src/response_generators/generate_object.rs
Comment thread src/memory_machine/base.rs
Comment thread crates/umem_controller/src/lib.rs
Comment thread crates/umem_ai/src/lib.rs
Comment thread crates/umem_controller/src/lib.rs
Comment thread crates/umem_ai/src/utils.rs
Comment thread crates/umem_controller/src/lib.rs
Comment thread crates/umem_ai/src/providers/openai.rs
Comment thread crates/umem_ai/src/response_generators/generate_text.rs
Comment thread crates/umem_ai/src/response_generators/generate_object.rs
@vidurkhanal vidurkhanal merged commit 90db3b5 into main Dec 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants