Git Product home page Git Product logo

neumai's Introduction

Neum AI

Neum AI Hero

Neum AI is a data platform that helps developers leverage their data to contextualize Large Language Models through Retrieval Augmented Generation (RAG) This includes extracting data from existing data sources like document storage and NoSQL, processing the contents into vector embeddings and ingesting the vector embeddings into vector databases for similarity search.

It provides you a comprehensive solution for RAG that can scale with your application and reduce the time spent integrating services like data connectors, embedding models and vector databases.

Features

  • ๐Ÿญ High throughput distributed architecture to handle billions of data points. Allows high degrees of parallelization to optimize embedding generation and ingestion.
  • ๐Ÿงฑ Built-in data connectors to common data sources, embedding services and vector stores.
  • ๐Ÿ”„ Real-time synchronization of data sources to ensure your data is always up-to-date.
  • โ™ป Customizable data pre-processing in the form of loading, chunking and selecting.
  • ๐Ÿค Cohesive data management to support hybrid retrieval with metadata. Neum AI automatically augments and tracks metadata to provide rich retrieval experience.

Talk to us

You can reach our team either through email ([email protected]), on discord or by scheduling a call wit us.

Getting Started

Neum AI Cloud

Sign up today at dashboard.neum.ai. See our quickstart to get started.

The Neum AI Cloud supports a large-scale, distributed architecture to run millions of documents through vector embedding. For the full set of features see: Cloud vs Local

Local Development

Install the neumai package:

pip install neumai

To create your first data pipelines visit our quickstart.

At a high level, a pipeline consists of one or multiple sources to pull data from, one embed connector to vectorize the content, and one sink connector to store said vectors. With this snippet of code we will craft all of these and run a pipeline:

Creating and running a pipeline

from neumai.DataConnectors.WebsiteConnector import WebsiteConnector
from neumai.Shared.Selector import Selector
from neumai.Loaders.HTMLLoader import HTMLLoader
from neumai.Chunkers.RecursiveChunker import RecursiveChunker
from neumai.Sources.SourceConnector import SourceConnector
from neumai.EmbedConnectors import OpenAIEmbed
from neumai.SinkConnectors import WeaviateSink
from neumai.Pipelines import Pipeline

website_connector =  WebsiteConnector(
    url = "https://www.neum.ai/post/retrieval-augmented-generation-at-scale",
    selector = Selector(
        to_metadata=['url']
    )
)
source = SourceConnector(
    data_connector = website_connector, 
    loader = HTMLLoader(), 
    chunker = RecursiveChunker()
)

openai_embed = OpenAIEmbed(
    api_key = "<OPEN AI KEY>",
)

weaviate_sink = WeaviateSink(
    url = "your-weaviate-url",
    api_key = "your-api-key",
    class_name = "your-class-name",
)

pipeline = Pipeline(
    sources=[source], 
    embed=openai_embed, 
    sink=weaviate_sink
)
pipeline.run()

results = pipeline.search(
    query="What are the challenges with scaling RAG?", 
    number_of_results=3
)

for result in results:
    print(result.metadata)

Creating and running a pipeline - Postgres connector

from neumai.DataConnectors.PostgresConnector import PostgresConnector
from neumai.Shared.Selector import Selector
from neumai.Loaders.JSONLoader import JSONLoader
from neumai.Chunkers.RecursiveChunker import RecursiveChunker
from neumai.Sources.SourceConnector import SourceConnector
from neumai.EmbedConnectors import OpenAIEmbed
from neumai.SinkConnectors import WeaviateSink
from neumai.Pipelines import Pipeline

website_connector =  PostgresConnector(
    connection_string = 'postgres',
    query = 'Select * from ...'
)
source = SourceConnector(
    data_connector = website_connector, 
    loader = JSONLoader(
        id_key='<your id key of your jsons>',
        selector=Selector(
            to_embed=['property1_to_embed','property2_to_embed'],
            to_metadata=['property3_to_include_in_metadata_in_vector']
        )
    ),
    chunker = RecursiveChunker()
)

openai_embed = OpenAIEmbed(
    api_key = "<OPEN AI KEY>",
)

weaviate_sink = WeaviateSink(
    url = "your-weaviate-url",
    api_key = "your-api-key",
    class_name = "your-class-name",
)

pipeline = Pipeline(
    sources=[source], 
    embed=openai_embed, 
    sink=weaviate_sink
)

pipeline.run()

results = pipeline.search(
    query="...", 
    number_of_results=3
)

for result in results:
    print(result.metadata)

Publishing pipeline to Neum Cloud

from neumai.Client.NeumClient import NeumClient
client = NeumClient(
    api_key='<your neum api key, get it from https://dashboard.neum.ai',
)
client.create_pipeline(pipeline=pipeline)

Self-host

If you are interested in deploying Neum AI to your own cloud contact us at [email protected].

We have a sample backend architecture published on GitHub which you can use as a starting point.

Available Connectors

For an up-to-date list please visit our docs

Source connectors

  1. Postgres
  2. Hosted Files
  3. Websites
  4. S3
  5. Azure Blob
  6. Sharepoint
  7. Singlestore
  8. Supabase Storage

Embed Connectors

  1. OpenAI embeddings
  2. Azure OpenAI embeddings

Sink Connectors

  1. Supabase postgres
  2. Weaviate
  3. Qdrant
  4. Pinecone
  5. Singlestore

Roadmap

Our roadmap is evolving with asks, so if there is anything missing feel free to open an issue or send us a message.

Connectors

  • MySQL - Source
  • GitHub - Source
  • Google Drive - Source
  • Hugging Face - Embedding
  • LanceDB - Sink
  • Marqo - Sink
  • Milvus - Sink
  • Chroma - Sink

Search

  • Retrieval feedback
  • Filter support
  • Unified Neum AI filters
  • Smart routing (w/ embedding based classification)
  • Smart routing (w/ LLM based classification)
  • Self-Query Retrieval (w/ Metadata attributes generation)

Extensibility

  • Langchain / Llama Index Document to Neum Document converter
  • Custom chunking and loading

Experimental

  • Async metadata augmentation
  • Chat history connector
  • Structured (SQL and GraphQL) search connector

Neum Tools

Additional tooling for Neum AI can be found here:

  • neumai-tools: contains pre-processing tools for loading and chunking data before generating vector embeddings.

neumai's People

Contributors

ddematheu avatar kevinco26 avatar prashantdixit0 avatar sky-2002 avatar sunilkumardash9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neumai's Issues

Unified filter condition mapping

@ddematheu @kevinco26
Currently we are using a dictionary to provide filters on metadata, this approach lacks the following:

  • Range based queries
  • "Not equal to" queries
  • "Less than" , "greater than" queries

A simple solution to start with:

  • We can expect the user to provide a string of filters, for example - "field1 <= value1, field2 != value2" instead of a dictionay ({"field1": "value1", "field2": "value2"})
  • Then create FilterCondition objects by parsing this string:
class FilterCondition:
    
   # We can define FilterOperators
    def __init__(self, column: str, op: FilterOperator, value: Any):
            self.column = column
            self.op = op
            self.value = value
  • Then we can use the filter options of the corresponding databases to map these conditions to.

Let me know your comments on this, I would like to contribute.

ModuleNotFoundError: No module named 'neumai_tools'

python----3.10.12
neumai----0.0.33

error:
Traceback (most recent call last):
File "/Users/xxxxxx/xxxxxx/neum_test.py", line 4, in
from neumai.Chunkers.RecursiveChunker import RecursiveChunker
File "/Users/xxxxxx/miniforge3/lib/python3.10/site-packages/neumai/Chunkers/init.py", line 3, in
from .CustomChunker import CustomChunker
File "/Users/xxxxxx/miniforge3/lib/python3.10/site-packages/neumai/Chunkers/CustomChunker.py", line 4, in
from neumai_tools.SemanticHelpers import semantic_chunking
ModuleNotFoundError: No module named 'neumai_tools'

Support self-hosted API for embeddings

Support using embedding services through url and api key or similar. Would allow neum to be more open and less vendor locked to the currently supported services.

LanceDBSink

TypeError: LanceDBSink.search() got an unexpected keyword argument 'filters'

Self-improving vector db based on feedback

When sink is queried using search API, if the retrieved information is correct (based on feedback or by running results against a different model), we could re-ingest the retrieved query pair (query and resulting vector) back into the vector DB, but using the query as the embedded value. The goal being that in future queries we can improve / make sure that the retrieved information is correct.

Filtering argument issues in search method

@ddematheu

  1. Currently, the filter argument in SinkConnector.search method expects the following -
    filters:List[FilterCondition]={}, it should rather be filters:List[dict]={} and then we need to convert the dict to a FilterCondition using dict_to_filter_condition. Because user would provide a dictionary not a FilterCondition object.
  2. Also, there needs to be consistency in naming the filtering argument because at some places it is filter and some other places it is filters.
    Let me know your opinion on this, and I will open a PR.

Structured Search Pipeline

Querying requirements across RAG fall not only onto unstructured data that has been embedded and added to an vector database. It also falls onto structured data sources where semantic search doesn't really make sense.

Goal: Provide a pipeline interface that connects to a structured data source and generates queries in real-time based on queries.

Implementation:

  • Psuedo Pipeline without an embed or sink connector, just a data source.
  • Data source connector is configured and an initial pull from the database is done to examine the fields available and their types.
  • Search generates a query using an LLM based on the fields available in the database.
  • The Pipeline can be used as part of a PipelineCollection and supported by smart_route in order for model to decide when to use it.

Alternative implementation:

  • In order to reduce the latency associated with having to do 2-3 back to back LLM calls to generated query and validate it, what if the query generation was done pre-emptively and cached in to a vector database.
  • Using an LLM, we would try to predict the top sets of queries that one might expect from the database and its permutations. (This might limit the complexity of the queries, but might answer for 80% of use cases)
  • At search we would run a similarity search of the incoming query against the description of the "cached" queries. We then can run top query against the database.

Chat History Pipeline

As chat histories get longer, passing the entire history on every call is not a good practice. More so, user expects information from several messages ago to be available as context.

Goal: Improve size of the chat history context window to allow users to reference messages that fall outside existing window.

Solution: Leverage semantic search to index the entire chat history of a conversation and pull messages that are related to the latest message from the user.

Implementation:

  • Create a pseudo-Pipeline object that uses a custom source connector that simply bypasses messages written to it into a vector database.
  • Pipeline is declared with an Embed Connector and Sink Connector to be used as part of the operation.
  • At search we would run a normal search against the sink with filters to only pull messages from the given conversation.
  • Then the user would add the retrieved messages as context into the conversation alongside the last 3-4 messages

Prototyped: https://github.com/NeumTry/Pensieve

Other ideas:

  • Any chat systems that are worth integrating? (Twilio?)

Implement Pipeline Collection smart search

Currently support unified (re-rank results into single list) and separate (results for each pipeline returned separately) searches for a collection .

Adding smart search which will do a smart routing to identify what collections are worth searching based on the query. Using the description of the pipeline, match to query.

Add file_id by default to each vector

file_id is a unique identifier for each file processed by a pipeline.

file_id = pipeline_id + cloudFile_id

Necessary to be able to leverage delete, update and augment capabilities.

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.