caspianmoon / memoripy

An AI memory layer with short- and long-term storage, semantic clustering, and optional memory decay for context-aware applications.
Apache License 2.0
402 stars 30 forks source link

Support for "any" embedding/chat model #3

Closed FrancescoCaracciolo closed 2 days ago

FrancescoCaracciolo commented 1 week ago

Hello, I would like to propose a way of supporting every embedding or chat model instead of limiting to OpenAI and Ollama.

classDiagram
    EmbeddingModel <|-- OpenAIEmbeddingModel
    EmbeddingModel<|-- OllamaEmbeddingModel
    ChatModel <|-- OpenAIChatModel
    ChatModel <|-- OllamaChatModel 

    class EmbeddingModel {
        + dimension
        + embed(str text) np.array
    }

    class ChatModel {
        + extract_concepts(text) list
        + generate_text(history) str
    }

    class OpenAIChatModel {

    }

    class OllamaChatModel {

    }

    class OpenAIEmbeddingModel {

    }

    class OllamaEmbeddingModel {

    }

Obviously, additional/different methods might be specified. Advantages of this structure:

caspianmoon commented 1 week ago

Thanks! I have already started working on a method to implement support for other embedding and chat models.