mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 02:24:59 +00:00
[Refactor]: Core/API Split (#1506)
Refactors api folder to core, creates firm split between backend code and api frontend.
This commit is contained in:
parent
bcf02449b3
commit
ab7b4d5ee9
77 changed files with 3441 additions and 3117 deletions
|
@ -17,6 +17,53 @@ This section will collect how-to, notes and development documentation
|
|||
|
||||
We use conventional commits and semantic versioning. Please follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification when writing commit messages.
|
||||
|
||||
## LocalAI Project Structure
|
||||
|
||||
**LocalAI is made of multiple components, developed in multiple repositories:**
|
||||
|
||||
The core repository, containing the primary `local-ai` server code, gRPC stubs, this documentation website, and docker container building resources are all located at [mudler/LocalAI](https://github.com/mudler/LocalAI).
|
||||
|
||||
As LocalAI is designed to make use of multiple, independent model galleries, those are maintained seperately. The following public model galleries are available for use:
|
||||
|
||||
* [go-skynet/model-gallery](https://github.com/go-skynet/model-gallery) - The original gallery, the `golang` huggingface scraper ran into limits and was largely retired, so this now holds handmade yaml configs
|
||||
* [dave-gray101/model-gallery](https://github.com/dave-gray101/model-gallery) - An automated gallery designed to track HuggingFace uploads and produce best-effort automatically generated configurations for LocalAI. It is designed to produce one LocalAI gallery per repository on HuggingFace.
|
||||
|
||||
### Directory Structure of this Repo
|
||||
|
||||
The core repository is broken up into the following primary chunks:
|
||||
|
||||
* `/backend`: gRPC protobuf specification and gRPC backends. Subfolders for each language.
|
||||
* **`/core`**: golang sourcecode for the core LocalAI application. Broken down below.
|
||||
* `/docs`: localai.io website that you are reading now
|
||||
* `/examples`: example code integrating LocalAI to other projects and/or developer samples and tools
|
||||
* `/internal`: **here be dragons**. Don't touch this, it's used for automatic versioning.
|
||||
* `/models`: _No code here!_ This is where models are installed!
|
||||
* **`/pkg`**: golang sourcecode that is intended to be reusable or at least widely imported across LocalAI. Broken down below
|
||||
* `/prompt-templates`: _No code here!_ This is where **example** prompt templates were historically stored. Somewhat obsolete these days, model-galleries tend to replace manually creating these?
|
||||
* `/tests`: Does what it says on the tin. Please write tests and put them here when you do.
|
||||
|
||||
The `core` folder is broken down further:
|
||||
|
||||
* **`/core/backend`**: code that interacts with a gRPC backend to perform AI tasks.
|
||||
* `/core/http`: code specifically related to the REST server
|
||||
* `/core/http/endpoints`: Has two subdirectories, `openai` and `localai` for binding the respective endpoints to the correct backend or service.
|
||||
* `/core/mqtt`: core specifically related to the MQTT server. Stub for now. Coming soon!
|
||||
* **`/core/services`**: code implementing functionality performed by `local-ai` itself, rather than delegated to a backend.
|
||||
* `/core/startup`: code related specifically to application startup of `local-ai`. Potentially to be refactored to become a part of `/core/services` at a later date, or not.
|
||||
|
||||
The `pkg` folder is broken down further:
|
||||
|
||||
* `/pkg/assets`: Currently contains a single function related to extracting files from archives. Potentially to be refactored to become a part of `/core/utils` at a later date?
|
||||
* **`/pkg/datamodel`**: Contains the data types and definitions used by the LocalAI project. Imported widely!
|
||||
* `/pkg/gallery`: Code related to interacting with a `model-gallery`
|
||||
* `/pkg/grammar`: Code related to BNF / functions for LLM
|
||||
* `/pkg/grpc`: base classes and interfaces for gRPC backends to implement
|
||||
* `/pkg/langchain`: langchain related code in golang
|
||||
* **`/pkg/model`**: Code related to loading and initializing a model and creating the appropriate gRPC backend.
|
||||
* `/pkg/stablediffusion`: Code related to stablediffusion in golang.
|
||||
* `/pkg/utils`: Every real programmer knows what they are going to find in here... it's our junk drawer of utility functions.
|
||||
|
||||
|
||||
## Creating a gRPC backend
|
||||
|
||||
LocalAI backends are `gRPC` servers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue