Giter Site home page Giter Site logo

kevkibe / docindex Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 851 KB

⚡️Framework for fast persistent storage of multiple document embeddings and metadata into Pinecone for source-traceable, production-level RAG.

License: MIT License

Python 68.31% HTML 31.69%
embedding-models retrieval-augmented-generation googlegemini langchain openai pinecone-db

docindex's People

Contributors

dependabot[bot] avatar kevkibe avatar koleshjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docindex's Issues

Enhancement: Use dictionary in `src/utils/rerank.py` in the class `RerankerConfig`

  • Use dictionary for lookup in RerankerConfig, add all the SUPPORTED_MODELS
  • To improve time complexity to O(1)
class RerankerConfig:
    SUPPORTED_MODELS = {
        'cohere': {'lang': True, 'api_key': True},
        'jina': {'api_key': True},
        # Add other models and their required parameters here
    }

    @staticmethod
    def get_ranker(rerank_model: str, lang: str = None, api_key: str = None) -> Reranker:
        """
        Returns a Reranker instance based on the provided parameters.

        Args:
            rerank_model (str): The name or path of the model.
            lang (str, optional): The language for multilingual models. Defaults to None.
            api_key (str, optional): The API key for models accessed through an API. Defaults to None.

        Returns:
            Reranker: An instance of Reranker.

        Raises:
            ValueError: If unsupported rerank_model is provided.
        """
        if rerank_model not in RerankerConfig.SUPPORTED_MODELS:
            raise ValueError(f"Unsupported rerank_model provided: {rerank_model}")

        model_config = RerankerConfig.SUPPORTED_MODELS[rerank_model]
        return Reranker(rerank_model, lang=lang if model_config.get('lang') else None,
                        api_key=api_key if model_config.get('api_key') else None)

Feature: Reranking source documents.

  • Currently the source documents are retrieved and ranked using the vectorstore.as_retriever default similarity score.
  • This is not enough for complex queries or with a large amount of source documents.
  • One solution I found out in my research is using cohere's reranking model
  • See :
  • A concern on this is that it is a priced model and user's will need to pay to use in production.
  • We can however have it as an option but not the only option.
  • What do you think? @koleshjr

Rethinking The Design

First of all great work. I was looking to contribute to the repo but the design is a bit a limiting factor. This is my idea though and you can tell me your thoughts.
First you have only focused on pinecone, what if someone wants to use milvus, or chroma or faiss or qdrant?
The indexing part , you have used the default splitter of loaders. But that's not usually enough based on my experience. What if I want to use recursive character splitter, or spacy's sentence splitter?
The loading part is okay as you have catered for multiple files and can be easily scaled to other documents too. But you have hidden it , it is not easily retrievable.

You current design: embedding to other steps . My proposed design to make this generalizable and useful to other choices too.

My suggestion break each part into its own module:
document_loaders, embedding models, splitters , vectordatabases to make each step scalable independently and lastly build a retrieval step that is easily flexible to the modules created.

I would love to help in this redesigning if it is something you are willing to work on

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.