MyScale can make use of various data types and functions for filters. It will boost up your LLM app no matter if you are scaling up your data or expand your system to broader application.In the notebook, we'll demo the SelfQueryRetriever wrapped around a MyScale vector store with some extra pieces we contributed to LangChain. In short, it can be condensed into 4 points:Add contain comparator to match the list of any if there is more than one element matchedAdd timestamp data type for datetime match (ISO-format, or YYYY-MM-DD)Add like comparator for string pattern searchAdd arbitrary function capabilityCreating a MyScale vector store‚ÄãMyScale has already been integrated to LangChain for a while. So you can follow this notebook to create your own vectorstore for a self-query retriever.Note: All self-query retrievers requires you to have lark installed (pip install lark). We use lark for grammar definition. Before you proceed to the next step, we also want to remind you that clickhouse-connect is also needed to interact with your MyScale backend.pip install lark clickhouse-connectIn this tutorial we follow other example's setting and use OpenAIEmbeddings. Remember to get an OpenAI API Key for valid access to LLMs.import osimport getpassos.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:")os.environ["MYSCALE_HOST"] = getpass.getpass("MyScale URL:")os.environ["MYSCALE_PORT"] = getpass.getpass("MyScale Port:")os.environ["MYSCALE_USERNAME"] = getpass.getpass("MyScale Username:")os.environ["MYSCALE_PASSWORD"] = getpass.getpass("MyScale Password:")from langchain.schema import Documentfrom langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.vectorstores import MyScaleembeddings = OpenAIEmbeddings()Create some sample data‚ÄãAs you can see, the data we created has some differences compared to other self-query retrievers. We replaced the keyword year with date which gives you finer control on timestamps. We also changed the type of the keyword gerne
MyScale is an integrated vector database. You can access your database in SQL and also from here, LangChain.
MyScale is an integrated vector database. You can access your database in SQL and also from here, LangChain. ->: MyScale can make use of various data types and functions for filters. It will boost up your LLM app no matter if you are scaling up your data or expand your system to broader application.In the notebook, we'll demo the SelfQueryRetriever wrapped around a MyScale vector store with some extra pieces we contributed to LangChain. In short, it can be condensed into 4 points:Add contain comparator to match the list of any if there is more than one element matchedAdd timestamp data type for datetime match (ISO-format, or YYYY-MM-DD)Add like comparator for string pattern searchAdd arbitrary function capabilityCreating a MyScale vector store‚ÄãMyScale has already been integrated to LangChain for a while. So you can follow this notebook to create your own vectorstore for a self-query retriever.Note: All self-query retrievers requires you to have lark installed (pip install lark). We use lark for grammar definition. Before you proceed to the next step, we also want to remind you that clickhouse-connect is also needed to interact with your MyScale backend.pip install lark clickhouse-connectIn this tutorial we follow other example's setting and use OpenAIEmbeddings. Remember to get an OpenAI API Key for valid access to LLMs.import osimport getpassos.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:")os.environ["MYSCALE_HOST"] = getpass.getpass("MyScale URL:")os.environ["MYSCALE_PORT"] = getpass.getpass("MyScale Port:")os.environ["MYSCALE_USERNAME"] = getpass.getpass("MyScale Username:")os.environ["MYSCALE_PASSWORD"] = getpass.getpass("MyScale Password:")from langchain.schema import Documentfrom langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.vectorstores import MyScaleembeddings = OpenAIEmbeddings()Create some sample data‚ÄãAs you can see, the data we created has some differences compared to other self-query retrievers. We replaced the keyword year with date which gives you finer control on timestamps. We also changed the type of the keyword gerne