Package: chatlocal
Table of Contents 📑Getting Started🚀Prerequisites📋Installation🔧Example Usage💡Example Output🖥️Note📌Contributions🤝License⚖️Chatlocal 💬Chatlocal is a Python library designed to interact with your local files and provide AI-powered question-answering capabilities. The library can read your local documents, vectorize them, and then answer questions using the indexed documents. The library uses the FAISS library for efficient similarity search and LangChain for retrieval-based question answering.Currently, this project is in an alpha stage and is not ready for production use. We are working on improving the library and adding more features. However, you can interact with the library through the command line and ask questions to your indexed documents, currently only .txt or .md files are supported.Getting Started 🚀These instructions will get you a copy of the project up and running on your local machine.Prerequisites 📋Chatlocal requires Python 3.9.16 or higher.Installation 🔧We recommend using Poetry for managing Python dependencies. If you do not have Poetry installed, you can install it with the following command on Linux, macOS and Windows (WSL2):curl-sSLhttps://install.python-poetry.org|python-After installing Poetry, navigate to the directory where thepyproject.tomlfile of Chatlocal is located, then install the dependencies with:poetryinstallThis will create a virtual environment and install all the necessary dependencies in it.Then set your OpenAI API key (if you don't have one, get onehere)exportOPENAI_API_KEY=....Example Usage 💡There are two scripts that showcase the usage of the library:dev/main.py: This script loads your documents, vectorizes them, and saves them for later use.
You can specify the location of your documents and the file types to be processed.Rundev/main.pywith Poetry using the following command:poetryrunpythondev/main.py--docpath[your_document_path]--filetypes[filetypes]Replace[your_document_path]with the path to your documents and[filetypes]with the
desired file types (e.g., .md, .txt). If you ommit filetypes, by default this is set to ".md",
and if you ommit the docpath, by default this is set to "~/code/curriculum".
this can be changed inside the main.py file.
Using this on obsidian would look like this:poetryrunpythondev/main.py--docpath=~/code/curriculumassuming that you have your obsidian vault in~/code/curriculum.`qa.py: This script allows you to interactively ask questions to your indexed documents.Runqa.pywith Poetry using the following command:poetryrunpythonqa.pyThen, you can start typing your questions. TypeQto quit the interactive prompt.Example Output 🖥️❯pythondev/qa.py
Askaquestion:(Qtoquit)Kunjelineareregressieuitleggen?

Answer:Linearregressionisastatisticalapproachformodelingtherelationshipbetweenascalar
responseandoneormoreexplanatoryvariables.Simplelinearregressionconcernstwo-dimensional
samplepointswithoneindependentvariableandonedependentvariableandfindsalinearfunctionthatpredictsthedependentvariablevaluesasafunctionoftheindependentvariable.
Therelationshipsaremodeledusinglinearpredictorfunctionswhoseunknownmodelparameters
areestimatedfromthedata.Thelawofconditionalprobabilitydistributionoftheresponse
giventhevaluesofthepredictorsisused.

Sources:/code/curriculum/Nuggets/LinearRegression.md,/code/curriculum/Nuggets/SimpleLinearRegression.mdAskaquestion:(Qtoquit)canyouexplainlinearregressioninthestyleofahaiku?
Answer:Linearregression,
Predictivemodelfordata,
Simpleormultiple.

Sources:/code/curriculum/Nuggets/LinearRegression.md,/code/curriculum/Nuggets/SimpleLinearRegression.mdAskaquestion:(Qtoquit)Whatiskullbackleibler?
Answer:Kullback-LeiblerDivergenceisameasureofdifferencebetweentwoprobabilitydistributions
andcanbeconsideredasasimilarityordistancemeasure,butitisnotadistanceinthestrict
mathematicalsense.ItisalsoknownasRelativeEntropyorKLDivergence.Itisnotadistancesince
axioms3and4oftheDistancefunctionarenotsatisfied.ItisthedifferencebetweenEntropyand
CrossEntropyandisaspecialcaseofBregmandivergence.

Sources:/code/curriculum/Nuggets/Kullback-LeiblerDivergence.md,/code/curriculum/Nuggets/SimilarityorDistanceMeasures.mdAskaquestion:(Qtoquit)Watzijndebelangrijkstethemasindezeaantekeningen?
Answer:Themainthemesinthesenotesare:
-Importanceofnotthrowingawaynotes
-Needtodiscusschangestonoteswiththeowner
-Creatingnotesinthecorrectfoldertoensurethecorrecttemplateisadded
-Contactingxxxxforquestionsormissinginformation
-Informationonsharinginformationandlessons
-ProcessforcopyinglecturenotestoOnderwijsOnline
-Importanceofusinglearningoutcomesasameansratherthananendintesting
-Involvingtheentireteaminthecurriculumdesignprocess
-Usingpeerreviewformsforassessment
-CreatingexamsfromindividualquestionsinExamQuestions

Sources:/code/curriculum/Workflow/BelangrijksteAfspraken.md,
/code/curriculum/Workflow/WerkwijzeMADSlessen.md,
/code/curriculum/Toetsing/ReviewFormsentoetsing.md,
/code/curriculum/Workflow/Overige/Leeruitkomstenformuleren.mdNote 📌The library stores indexed vectors and document store in the~/.cache/chatlocaldirectory.
This can be changed by setting theCACHE_DIRenvironment variable.
eg❯exportCACHE_DIR=/tmp/chatlocal`Contributions 🤝Contributions are welcomed. Please create a pull request with your changes.License ⚖️This project is licensed under the MIT License. See the LICENSE file for details.