Skip to content

Smart embedding provider selection and cache key fix #16

Description

@longzhi

Problem

Two related problems in the embedding system:

1. Cache key bug

clawhive-memory/src/embedding.rs:547 hardcodes let provider = "openai" as cache key. When using non-OpenAI providers (e.g., Ollama), cache keys collide and return wrong embeddings from a different provider's model.

2. No provider auto-detection

The system should detect whether the agent's configured LLM provider supports embedding, and if so, automatically use that provider's embedding model as the default. This avoids requiring separate embedding provider configuration when the main provider already has embedding capability.

Proposed Solution

  1. Detect provider embedding support → auto-select embedding model
  2. Use actual provider name in cache key instead of hardcoded "openai"

Impact

  • Cache correctness — prevents returning wrong embeddings when switching providers
  • UX — reduces configuration burden for users whose LLM provider already supports embeddings

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1: highMust complete in next releaseenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions