diff --git a/.github/workflows/bump_deps.yaml b/.github/workflows/bump_deps.yaml index 2b1455320a8..5909c981244 100644 --- a/.github/workflows/bump_deps.yaml +++ b/.github/workflows/bump_deps.yaml @@ -27,9 +27,6 @@ jobs: - repository: "go-skynet/bloomz.cpp" variable: "BLOOMZ_VERSION" branch: "main" - - repository: "nomic-ai/gpt4all" - variable: "GPT4ALL_VERSION" - branch: "main" - repository: "mudler/go-ggllm.cpp" variable: "GOGGLLM_VERSION" branch: "master" diff --git a/Makefile b/Makefile index b4c8f013423..88a2b283dc7 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ DETECT_LIBS?=true # llama.cpp versions GOLLAMA_REPO?=https://github.com/go-skynet/go-llama.cpp GOLLAMA_VERSION?=2b57a8ae43e4699d3dc5d1496a1ccd42922993be -CPPLLAMA_VERSION?=17eb6aa8a992cda37ee65cf848d9289bd6cad860 +CPPLLAMA_VERSION?=aaab2419eaa17ab3aa38f4ba49c7eea406999e99 # gpt4all version GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all @@ -384,7 +384,7 @@ endif CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o $(BINARY_NAME) ./ build-minimal: - BUILD_GRPC_FOR_BACKEND_LLAMA=true GRPC_BACKENDS="backend-assets/grpc/llama-cpp-avx2" GO_TAGS=none $(MAKE) build + BUILD_GRPC_FOR_BACKEND_LLAMA=true GRPC_BACKENDS="backend-assets/grpc/llama-cpp-avx2" GO_TAGS=p2p $(MAKE) build build-api: BUILD_GRPC_FOR_BACKEND_LLAMA=true BUILD_API_ONLY=true GO_TAGS=none $(MAKE) build diff --git a/backend/python/openvoice/requirements-intel.txt b/backend/python/openvoice/requirements-intel.txt index e971e044291..b0551187f0e 100644 --- a/backend/python/openvoice/requirements-intel.txt +++ b/backend/python/openvoice/requirements-intel.txt @@ -4,13 +4,13 @@ torch optimum[openvino] grpcio==1.64.1 protobuf -librosa==0.10.2.post1 +librosa==0.9.1 faster-whisper==1.0.3 pydub==0.25.1 wavmark==0.0.3 -numpy==2.0.0 +numpy==1.26.4 eng_to_ipa==0.0.2 -inflect==7.3.1 +inflect==7.0.0 unidecode==1.3.7 whisper-timestamped==1.15.4 openai diff --git a/core/http/endpoints/jina/rerank.go b/core/http/endpoints/jina/rerank.go index ddeee745c28..04fdf031f19 100644 --- a/core/http/endpoints/jina/rerank.go +++ b/core/http/endpoints/jina/rerank.go @@ -12,6 +12,11 @@ import ( "github.com/rs/zerolog/log" ) +// JINARerankEndpoint acts like the Jina reranker endpoint (https://jina.ai/reranker/) +// @Summary Reranks a list of phrases by relevance to a given text query. +// @Param request body schema.JINARerankRequest true "query params" +// @Success 200 {object} schema.JINARerankResponse "Response" +// @Router /v1/rerank [post] func JINARerankEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *config.ApplicationConfig) func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { req := new(schema.JINARerankRequest) diff --git a/core/http/endpoints/localai/gallery.go b/core/http/endpoints/localai/gallery.go index 9c49d641a1e..eaa4bedc577 100644 --- a/core/http/endpoints/localai/gallery.go +++ b/core/http/endpoints/localai/gallery.go @@ -9,6 +9,7 @@ import ( "github.com/google/uuid" "github.com/mudler/LocalAI/core/config" "github.com/mudler/LocalAI/core/gallery" + "github.com/mudler/LocalAI/core/schema" "github.com/mudler/LocalAI/core/services" "github.com/rs/zerolog/log" ) @@ -49,6 +50,11 @@ func (mgs *ModelGalleryEndpointService) GetAllStatusEndpoint() func(c *fiber.Ctx } } +// ApplyModelGalleryEndpoint installs a new model to a LocalAI instance from the model gallery +// @Summary Install models to LocalAI. +// @Param request body GalleryModel true "query params" +// @Success 200 {object} schema.GalleryResponse "Response" +// @Router /models/apply [post] func (mgs *ModelGalleryEndpointService) ApplyModelGalleryEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { input := new(GalleryModel) @@ -68,13 +74,15 @@ func (mgs *ModelGalleryEndpointService) ApplyModelGalleryEndpoint() func(c *fibe Galleries: mgs.galleries, ConfigURL: input.ConfigURL, } - return c.JSON(struct { - ID string `json:"uuid"` - StatusURL string `json:"status"` - }{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()}) + return c.JSON(schema.GalleryResponse{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()}) } } +// DeleteModelGalleryEndpoint lets delete models from a LocalAI instance +// @Summary delete models to LocalAI. +// @Param name path string true "Model name" +// @Success 200 {object} schema.GalleryResponse "Response" +// @Router /models/delete/{name} [post] func (mgs *ModelGalleryEndpointService) DeleteModelGalleryEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { modelName := c.Params("name") @@ -89,13 +97,14 @@ func (mgs *ModelGalleryEndpointService) DeleteModelGalleryEndpoint() func(c *fib return err } - return c.JSON(struct { - ID string `json:"uuid"` - StatusURL string `json:"status"` - }{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()}) + return c.JSON(schema.GalleryResponse{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()}) } } +// ListModelFromGalleryEndpoint list the available models for installation from the active galleries +// @Summary List installable models. +// @Success 200 {object} []gallery.GalleryModel "Response" +// @Router /models/available [get] func (mgs *ModelGalleryEndpointService) ListModelFromGalleryEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { log.Debug().Msgf("Listing models from galleries: %+v", mgs.galleries) @@ -116,6 +125,10 @@ func (mgs *ModelGalleryEndpointService) ListModelFromGalleryEndpoint() func(c *f } } +// ListModelGalleriesEndpoint list the available galleries configured in LocalAI +// @Summary List all Galleries +// @Success 200 {object} []config.Gallery "Response" +// @Router /models/galleries [get] // NOTE: This is different (and much simpler!) than above! This JUST lists the model galleries that have been loaded, not their contents! func (mgs *ModelGalleryEndpointService) ListModelGalleriesEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { @@ -128,6 +141,11 @@ func (mgs *ModelGalleryEndpointService) ListModelGalleriesEndpoint() func(c *fib } } +// AddModelGalleryEndpoint adds a gallery in LocalAI +// @Summary Adds a gallery in LocalAI +// @Param request body config.Gallery true "Gallery details" +// @Success 200 {object} []config.Gallery "Response" +// @Router /models/galleries [post] func (mgs *ModelGalleryEndpointService) AddModelGalleryEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { input := new(config.Gallery) @@ -150,6 +168,11 @@ func (mgs *ModelGalleryEndpointService) AddModelGalleryEndpoint() func(c *fiber. } } +// RemoveModelGalleryEndpoint remove a gallery in LocalAI +// @Summary removes a gallery from LocalAI +// @Param request body config.Gallery true "Gallery details" +// @Success 200 {object} []config.Gallery "Response" +// @Router /models/galleries [delete] func (mgs *ModelGalleryEndpointService) RemoveModelGalleryEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { input := new(config.Gallery) @@ -165,6 +188,10 @@ func (mgs *ModelGalleryEndpointService) RemoveModelGalleryEndpoint() func(c *fib mgs.galleries = slices.DeleteFunc(mgs.galleries, func(gallery config.Gallery) bool { return gallery.Name == input.Name }) - return c.Send(nil) + dat, err := json.Marshal(mgs.galleries) + if err != nil { + return err + } + return c.Send(dat) } } diff --git a/core/http/endpoints/localai/p2p.go b/core/http/endpoints/localai/p2p.go new file mode 100644 index 00000000000..cab0bb5daf5 --- /dev/null +++ b/core/http/endpoints/localai/p2p.go @@ -0,0 +1,28 @@ +package localai + +import ( + "github.com/gofiber/fiber/v2" + "github.com/mudler/LocalAI/core/config" + "github.com/mudler/LocalAI/core/p2p" + "github.com/mudler/LocalAI/core/schema" +) + +// ShowP2PNodes returns the P2P Nodes +// @Summary Returns available P2P nodes +// @Success 200 {object} []schema.P2PNodesResponse "Response" +// @Router /api/p2p [get] +func ShowP2PNodes(c *fiber.Ctx) error { + // Render index + return c.JSON(schema.P2PNodesResponse{ + Nodes: p2p.GetAvailableNodes(""), + FederatedNodes: p2p.GetAvailableNodes(p2p.FederatedID), + }) +} + +// ShowP2PToken returns the P2P token +// @Summary Show the P2P token +// @Success 200 {string} string "Response" +// @Router /api/p2p/token [get] +func ShowP2PToken(appConfig *config.ApplicationConfig) func(*fiber.Ctx) error { + return func(c *fiber.Ctx) error { return c.Send([]byte(appConfig.P2PToken)) } +} diff --git a/core/http/routes/localai.go b/core/http/routes/localai.go index cc0b9d49520..b8a811b5faf 100644 --- a/core/http/routes/localai.go +++ b/core/http/routes/localai.go @@ -59,16 +59,8 @@ func RegisterLocalAIRoutes(app *fiber.App, // p2p if p2p.IsP2PEnabled() { - app.Get("/api/p2p", auth, func(c *fiber.Ctx) error { - // Render index - return c.JSON(map[string]interface{}{ - "Nodes": p2p.GetAvailableNodes(""), - "FederatedNodes": p2p.GetAvailableNodes(p2p.FederatedID), - }) - }) - app.Get("/api/p2p/token", auth, func(c *fiber.Ctx) error { - return c.Send([]byte(appConfig.P2PToken)) - }) + app.Get("/api/p2p", auth, localai.ShowP2PNodes) + app.Get("/api/p2p/token", auth, localai.ShowP2PToken(appConfig)) } app.Get("/version", auth, func(c *fiber.Ctx) error { diff --git a/core/schema/localai.go b/core/schema/localai.go index 9bbfe28b5e4..1b75e384328 100644 --- a/core/schema/localai.go +++ b/core/schema/localai.go @@ -1,6 +1,7 @@ package schema import ( + "github.com/mudler/LocalAI/core/p2p" gopsutil "github.com/shirou/gopsutil/v3/process" ) @@ -14,6 +15,11 @@ type BackendMonitorResponse struct { CPUPercent float64 } +type GalleryResponse struct { + ID string `json:"uuid"` + StatusURL string `json:"status"` +} + // @Description TTS request body type TTSRequest struct { Model string `json:"model" yaml:"model"` // model name or full path @@ -59,3 +65,8 @@ type StoresFindResponse struct { Values []string `json:"values" yaml:"values"` Similarities []float32 `json:"similarities" yaml:"similarities"` } + +type P2PNodesResponse struct { + Nodes []p2p.NodeData `json:"nodes" yaml:"nodes"` + FederatedNodes []p2p.NodeData `json:"federated_nodes" yaml:"federated_nodes"` +} diff --git a/docs/content/docs/faq.md b/docs/content/docs/faq.md index 9b2a54792ce..c1dc24ec775 100644 --- a/docs/content/docs/faq.md +++ b/docs/content/docs/faq.md @@ -16,6 +16,10 @@ Here are answers to some of the most common questions. Most gguf-based models should work, but newer models may require additions to the API. If a model doesn't work, please feel free to open up issues. However, be cautious about downloading models from the internet and directly onto your machine, as there may be security vulnerabilities in lama.cpp or ggml that could be maliciously exploited. Some models can be found on Hugging Face: https://huggingface.co/models?search=gguf, or models from gpt4all are compatible too: https://github.com/nomic-ai/gpt4all. +### Benchmarking LocalAI and llama.cpp shows different results! + +LocalAI applies a set of defaults when loading models with the llama.cpp backend, one of these is mirostat sampling - while it achieves better results, it slows down the inference. You can disable this by setting `mirostat: 0` in the model config file. See also the advanced section ({{%relref "docs/advanced/advanced-usage" %}}) for more information and [this issue](https://github.com/mudler/LocalAI/issues/2780). + ### What's the difference with Serge, or XXX? LocalAI is a multi-model solution that doesn't focus on a specific model type (e.g., llama.cpp or alpaca.cpp), and it handles all of these internally for faster inference, easy to set up locally and deploy to Kubernetes. diff --git a/gallery/index.yaml b/gallery/index.yaml index bd01042cd3a..535726ade29 100644 --- a/gallery/index.yaml +++ b/gallery/index.yaml @@ -24,8 +24,8 @@ - filename: DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf sha256: 50ec78036433265965ed1afd0667c00c71c12aa70bcf383be462cb8e159db6c0 uri: huggingface://LoneStriker/DeepSeek-Coder-V2-Lite-Instruct-GGUF/DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf -## Start QWEN2 - &qwen2 + ## Start QWEN2 url: "github:mudler/LocalAI/gallery/chatml.yaml@master" name: "qwen2-7b-instruct" license: apache-2.0 @@ -414,7 +414,7 @@ files: - filename: gemma-2-9b-it-Q4_K_M.gguf uri: huggingface://bartowski/gemma-2-9b-it-GGUF/gemma-2-9b-it-Q4_K_M.gguf - sha256: 05390244866abc0e7108a2b1e3db07b82df3cd82f006256a75fc21137054151f + sha256: 13b2a7b4115bbd0900162edcebe476da1ba1fc24e718e8b40d32f6e300f56dfe - !!merge <<: *gemma name: "tess-v2.5-gemma-2-27b-alpha" urls: @@ -473,32 +473,7 @@ urls: - https://huggingface.co/TheDrummer/Smegmma-9B-v1 - https://huggingface.co/bartowski/Smegmma-9B-v1-GGUF - description: | - Smegmma 9B v1 🧀 - - The sweet moist of Gemma 2, unhinged. - - smeg - ghem - mah - - An eRP model that will blast you with creamy moist. Finetuned by yours truly. - - The first Gemma 2 9B RP finetune attempt! - What's New? - - Engaging roleplay - Less refusals / censorship - Less commentaries / summaries - More willing AI - Better formatting - Better creativity - Moist alignment - - Notes - - Refusals still exist, but a couple of re-gens may yield the result you want - Formatting and logic may be weaker at the start - Make sure to start strong - May be weaker with certain cards, YMMV and adjust accordingly! + description: "Smegmma 9B v1 \U0001F9C0\n\nThe sweet moist of Gemma 2, unhinged.\n\nsmeg - ghem - mah\n\nAn eRP model that will blast you with creamy moist. Finetuned by yours truly.\n\nThe first Gemma 2 9B RP finetune attempt!\nWhat's New?\n\n Engaging roleplay\n Less refusals / censorship\n Less commentaries / summaries\n More willing AI\n Better formatting\n Better creativity\n Moist alignment\n\nNotes\n\n Refusals still exist, but a couple of re-gens may yield the result you want\n Formatting and logic may be weaker at the start\n Make sure to start strong\n May be weaker with certain cards, YMMV and adjust accordingly!\n" overrides: parameters: model: Smegmma-9B-v1-Q4_K_M.gguf @@ -512,26 +487,7 @@ urls: - https://huggingface.co/TheDrummer/Smegmma-Deluxe-9B-v1 - https://huggingface.co/bartowski/Smegmma-Deluxe-9B-v1-GGUF - description: | - Smegmma Deluxe 9B v1 🧀 - - The sweet moist of Gemma 2, unhinged. - - smeg - ghem - mah - - An eRP model that will blast you with creamy moist. Finetuned by yours truly. - - The first Gemma 2 9B RP finetune attempt! - - What's New? - - Engaging roleplay - Less refusals / censorship - Less commentaries / summaries - More willing AI - Better formatting - Better creativity - Moist alignment + description: "Smegmma Deluxe 9B v1 \U0001F9C0\n\nThe sweet moist of Gemma 2, unhinged.\n\nsmeg - ghem - mah\n\nAn eRP model that will blast you with creamy moist. Finetuned by yours truly.\n\nThe first Gemma 2 9B RP finetune attempt!\n\nWhat's New?\n\n Engaging roleplay\n Less refusals / censorship\n Less commentaries / summaries\n More willing AI\n Better formatting\n Better creativity\n Moist alignment\n" overrides: parameters: model: Smegmma-Deluxe-9B-v1-Q4_K_M.gguf @@ -1808,9 +1764,9 @@ - !!merge <<: *llama3 name: "hathor_tahsin-l3-8b-v0.85" description: | - Hathor_Tahsin [v-0.85] is designed to seamlessly integrate the qualities of creativity, intelligence, and robust performance. - Note: Hathor_Tahsin [v0.85] is trained on 3 epochs of Private RP, STEM (Intruction/Dialogs), Opus instructons, mixture light/classical novel data, roleplaying chat pairs over llama 3 8B instruct. - Additional Note's: (Based on Hathor_Fractionate-v0.5 instead of Hathor_Aleph-v0.72, should be less repetitive than either 0.72 or 0.8) + Hathor_Tahsin [v-0.85] is designed to seamlessly integrate the qualities of creativity, intelligence, and robust performance. + Note: Hathor_Tahsin [v0.85] is trained on 3 epochs of Private RP, STEM (Intruction/Dialogs), Opus instructons, mixture light/classical novel data, roleplaying chat pairs over llama 3 8B instruct. + Additional Note's: (Based on Hathor_Fractionate-v0.5 instead of Hathor_Aleph-v0.72, should be less repetitive than either 0.72 or 0.8) icon: https://cdn-uploads.huggingface.co/production/uploads/642265bc01c62c1e4102dc36/MY9tjLnEG5hOQOyKk06PK.jpeg urls: - https://huggingface.co/Nitral-AI/Hathor_Tahsin-L3-8B-v0.85 @@ -2521,14 +2477,14 @@ - https://huggingface.co/SicariusSicariiStuff/LLAMA-3_8B_Unaligned_Alpha - https://huggingface.co/bartowski/LLAMA-3_8B_Unaligned_Alpha-GGUF description: | - Model card description: - As of June 11, 2024, I've finally started training the model! The training is progressing smoothly, although it will take some time. I used a combination of model merges and an abliterated model as base, followed by a comprehensive deep unalignment protocol to unalign the model to its core. A common issue with uncensoring and unaligning models is that it often significantly impacts their base intelligence. To mitigate these drawbacks, I've included a substantial corpus of common sense, theory of mind, and various other elements to counteract the effects of the deep uncensoring process. Given the extensive corpus involved, the training will require at least a week of continuous training. Expected early results: in about 3-4 days. - Additional info: - As of June 13, 2024, I've observed that even after two days of continuous training, the model is still resistant to learning certain aspects. - For example, some of the validation data still shows a loss over , whereas other parts have a loss of < or lower. This is after the model was initially abliterated. - June 18, 2024 Update, After extensive testing of the intermediate checkpoints, significant progress has been made. - The model is slowly — I mean, really slowly — unlearning its alignment. By significantly lowering the learning rate, I was able to visibly observe deep behavioral changes, this process is taking longer than anticipated, but it's going to be worth it. Estimated time to completion: 4 more days.. I'm pleased to report that in several tests, the model not only maintained its intelligence but actually showed a slight improvement, especially in terms of common sense. An intermediate checkpoint of this model was used to create invisietch/EtherealRainbow-v0.3-rc7, with promising results. Currently, it seems like I'm on the right track. I hope this model will serve as a solid foundation for further merges, whether for role-playing (RP) or for uncensoring. This approach also allows us to save on actual fine-tuning, thereby reducing our carbon footprint. The merge process takes just a few minutes of CPU time, instead of days of GPU work. - June 20, 2024 Update, Unaligning was partially successful, and the results are decent, but I am not fully satisfied. I decided to bite the bullet, and do a full finetune, god have mercy on my GPUs. I am also releasing the intermediate checkpoint of this model. + Model card description: + As of June 11, 2024, I've finally started training the model! The training is progressing smoothly, although it will take some time. I used a combination of model merges and an abliterated model as base, followed by a comprehensive deep unalignment protocol to unalign the model to its core. A common issue with uncensoring and unaligning models is that it often significantly impacts their base intelligence. To mitigate these drawbacks, I've included a substantial corpus of common sense, theory of mind, and various other elements to counteract the effects of the deep uncensoring process. Given the extensive corpus involved, the training will require at least a week of continuous training. Expected early results: in about 3-4 days. + Additional info: + As of June 13, 2024, I've observed that even after two days of continuous training, the model is still resistant to learning certain aspects. + For example, some of the validation data still shows a loss over , whereas other parts have a loss of < or lower. This is after the model was initially abliterated. + June 18, 2024 Update, After extensive testing of the intermediate checkpoints, significant progress has been made. + The model is slowly — I mean, really slowly — unlearning its alignment. By significantly lowering the learning rate, I was able to visibly observe deep behavioral changes, this process is taking longer than anticipated, but it's going to be worth it. Estimated time to completion: 4 more days.. I'm pleased to report that in several tests, the model not only maintained its intelligence but actually showed a slight improvement, especially in terms of common sense. An intermediate checkpoint of this model was used to create invisietch/EtherealRainbow-v0.3-rc7, with promising results. Currently, it seems like I'm on the right track. I hope this model will serve as a solid foundation for further merges, whether for role-playing (RP) or for uncensoring. This approach also allows us to save on actual fine-tuning, thereby reducing our carbon footprint. The merge process takes just a few minutes of CPU time, instead of days of GPU work. + June 20, 2024 Update, Unaligning was partially successful, and the results are decent, but I am not fully satisfied. I decided to bite the bullet, and do a full finetune, god have mercy on my GPUs. I am also releasing the intermediate checkpoint of this model. icon: https://i.imgur.com/Kpk1PgZ.png overrides: parameters: @@ -2543,9 +2499,9 @@ - https://huggingface.co/Sao10K/L3-8B-Lunaris-v1 - https://huggingface.co/bartowski/L3-8B-Lunaris-v1-GGUF description: | - A generalist / roleplaying model merge based on Llama 3. Models are selected from my personal experience while using them. + A generalist / roleplaying model merge based on Llama 3. Models are selected from my personal experience while using them. - I personally think this is an improvement over Stheno v3.2, considering the other models helped balance out its creativity and at the same time improving its logic. + I personally think this is an improvement over Stheno v3.2, considering the other models helped balance out its creativity and at the same time improving its logic. overrides: parameters: model: L3-8B-Lunaris-v1-Q4_K_M.gguf @@ -3115,6 +3071,22 @@ - filename: phi3-4x4b-v1-Q4_K_M.gguf uri: huggingface://bartowski/phi3-4x4b-v1-GGUF/phi3-4x4b-v1-Q4_K_M.gguf sha256: fd33220186b7076f4b306f27b3a8913384435a2ca90185a71c9df5a752d3a298 +- !!merge <<: *phi-3 + name: "phi-3.1-mini-4k-instruct" + urls: + - https://huggingface.co/microsoft/Phi-3-mini-4k-instruct + - https://huggingface.co/bartowski/Phi-3.1-mini-4k-instruct-GGUF + description: | + This is an update over the original instruction-tuned Phi-3-mini release based on valuable customer feedback. The model used additional post-training data leading to substantial gains on instruction following and structure output. + + It is based on the original model from Microsoft, but has been updated and quantized using the llama.cpp release b3278. + overrides: + parameters: + model: Phi-3.1-mini-4k-instruct-Q4_K_M.gguf + files: + - filename: Phi-3.1-mini-4k-instruct-Q4_K_M.gguf + sha256: 39458b227a4be763b7eb39d306d240c3d45205e3f8b474ec7bdca7bba0158e69 + uri: huggingface://bartowski/Phi-3.1-mini-4k-instruct-GGUF/Phi-3.1-mini-4k-instruct-Q4_K_M.gguf - &hermes-2-pro-mistral ### START Hermes url: "github:mudler/LocalAI/gallery/hermes-2-pro-mistral.yaml@master" diff --git a/go.mod b/go.mod index 09350c45627..c4f9131367d 100644 --- a/go.mod +++ b/go.mod @@ -30,10 +30,10 @@ require ( github.com/jaypipes/ghw v0.12.0 github.com/joho/godotenv v1.5.1 github.com/klauspost/cpuid/v2 v2.2.8 - github.com/libp2p/go-libp2p v0.35.1 + github.com/libp2p/go-libp2p v0.35.2 github.com/mholt/archiver/v3 v3.5.1 github.com/microcosm-cc/bluemonday v1.0.26 - github.com/mudler/edgevpn v0.26.1 + github.com/mudler/edgevpn v0.26.2 github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c github.com/mudler/go-stable-diffusion v0.0.0-20240429204715-4a3cd6aeae6f github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20240606155928-41c9013fa46a @@ -65,8 +65,11 @@ require ( ) require ( + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/labstack/echo/v4 v4.12.0 // indirect + github.com/labstack/gommon v0.4.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pion/datachannel v1.5.6 // indirect @@ -85,6 +88,10 @@ require ( github.com/pion/transport/v2 v2.2.5 // indirect github.com/pion/turn/v2 v2.1.6 // indirect github.com/pion/webrtc/v3 v3.2.40 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/urfave/cli/v2 v2.27.2 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect + github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect go.uber.org/mock v0.4.0 // indirect ) @@ -150,7 +157,7 @@ require ( github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/gorilla/css v1.0.1 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect @@ -211,7 +218,7 @@ require ( github.com/muesli/termenv v0.15.2 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.4 // indirect + github.com/multiformats/go-multiaddr v0.13.0 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect @@ -272,7 +279,7 @@ require ( go.opentelemetry.io/otel/sdk v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/dig v1.17.1 // indirect - go.uber.org/fx v1.21.1 // indirect + go.uber.org/fx v1.22.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.24.0 // indirect @@ -280,7 +287,7 @@ require ( golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/term v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/tools v0.22.0 // indirect diff --git a/go.sum b/go.sum index 4c8c8756c3a..c94474e6d81 100644 --- a/go.sum +++ b/go.sum @@ -90,6 +90,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/mds v0.7.0 h1:7QoYqiPl18C0h7CLq9z9/qUH5Vr62V9677yJZHGLoQM= github.com/creachadair/mds v0.7.0/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo= github.com/creachadair/otp v0.4.2 h1:ngNMaD6Tzd7UUNRFyed7ykZFn/Wr5sSs5ffqZWm9pu8= @@ -273,6 +275,8 @@ github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -359,6 +363,10 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0= +github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM= +github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= +github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2 h1:hRGSmZu7j271trc9sneMrpOW7GN5ngLm8YUZIPzf394= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -369,6 +377,8 @@ github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFG github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= github.com/libp2p/go-libp2p v0.35.1 h1:Hm7Ub2BF+GCb14ojcsEK6WAy5it5smPDK02iXSZLl50= github.com/libp2p/go-libp2p v0.35.1/go.mod h1:Dnkgba5hsfSv5dvvXC8nfqk44hH0gIKKno+HOMU0fdc= +github.com/libp2p/go-libp2p v0.35.2 h1:287oHbuplkrLdAF+syB0n/qDgd50AUBtEODqS0e0HDs= +github.com/libp2p/go-libp2p v0.35.2/go.mod h1:RKCDNt30IkFipGL0tl8wQW/3zVWEGFUZo8g2gAKxwjU= github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= github.com/libp2p/go-libp2p-kad-dht v0.25.2 h1:FOIk9gHoe4YRWXTu8SY9Z1d0RILol0TrtApsMDPjAVQ= @@ -461,6 +471,8 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mudler/edgevpn v0.26.1 h1:vU7maxgMij+txPFbhiR8FJk1Twzj/J4m3FrZwdqMaMI= github.com/mudler/edgevpn v0.26.1/go.mod h1:BUjRlX11ddqRtYtmwyHaanneemYq5WRdnD6wXDbRf+8= +github.com/mudler/edgevpn v0.26.2 h1:OK4jfk7sYjuU7vCh+geUJk38lsxRgMk+EdsS9s0hioE= +github.com/mudler/edgevpn v0.26.2/go.mod h1:lplntB9N6LzGNqeSM3XHCq8kyDPsNhY3jqEbWGD2WaQ= github.com/mudler/go-piper v0.0.0-20240315144837-9d0100873a7d h1:8udOFrDf/I83JL0/u22j6U6Q9z9LoSdby2a/DWdd0/s= github.com/mudler/go-piper v0.0.0-20240315144837-9d0100873a7d/go.mod h1:O7SwdSWMilAWhBZMK9N9Y/oBDyMMzshE3ju8Xkexwig= github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c h1:CI5uGwqBpN8N7BrSKC+nmdfw+9nPQIDyjHHlaIiitZI= @@ -481,6 +493,8 @@ github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.12.4 h1:rrKqpY9h+n80EwhhC/kkcunCZZ7URIF8yN1WEUt2Hvc= github.com/multiformats/go-multiaddr v0.12.4/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= +github.com/multiformats/go-multiaddr v0.13.0 h1:BCBzs61E3AGHcYYTv8dqRH43ZfyrqM8RXVPT8t13tLQ= +github.com/multiformats/go-multiaddr v0.13.0/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -641,6 +655,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sashabaranov/go-openai v1.26.2 h1:cVlQa3gn3eYqNXRW03pPlpy6zLG52EU4g0FrWXc0EFI= github.com/sashabaranov/go-openai v1.26.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= @@ -738,11 +753,16 @@ github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I= github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8= github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= +github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= +github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8= github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck= @@ -767,6 +787,8 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw= +github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -800,6 +822,8 @@ go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.21.1 h1:RqBh3cYdzZS0uqwVeEjOX2p73dddLpym315myy/Bpb0= go.uber.org/fx v1.21.1/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48= +go.uber.org/fx v1.22.1 h1:nvvln7mwyT5s1q201YE29V/BFrGor6vMiDNpU/78Mys= +go.uber.org/fx v1.22.1/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -954,6 +978,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= diff --git a/swagger/docs.go b/swagger/docs.go index 513a6dea6af..bf624094f05 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -22,6 +22,134 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/models/apply": { + "post": { + "summary": "Install models to LocalAI.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/localai.GalleryModel" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.GalleryResponse" + } + } + } + } + }, + "/models/available": { + "get": { + "summary": "List installable models.", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryModel" + } + } + } + } + } + }, + "/models/delete/{name}": { + "post": { + "summary": "delete models to LocalAI.", + "parameters": [ + { + "type": "string", + "description": "Model name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.GalleryResponse" + } + } + } + } + }, + "/models/galleries": { + "get": { + "summary": "List all Galleries", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + }, + "post": { + "summary": "Adds a gallery in LocalAI", + "parameters": [ + { + "description": "Gallery details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/config.Gallery" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + }, + "delete": { + "summary": "removes a gallery from LocalAI", + "parameters": [ + { + "description": "Gallery details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/config.Gallery" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + } + }, "/tts": { "post": { "consumes": [ @@ -287,6 +415,30 @@ const docTemplate = `{ } } }, + "/v1/rerank": { + "post": { + "summary": "Reranks a list of phrases by relevance to a given text query.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schema.JINARerankRequest" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.JINARerankResponse" + } + } + } + } + }, "/v1/text-to-speech/{voice-id}": { "post": { "summary": "Generates audio from the input text.", @@ -320,6 +472,17 @@ const docTemplate = `{ } }, "definitions": { + "config.Gallery": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, "functions.Argument": { "type": "object", "properties": { @@ -452,6 +615,148 @@ const docTemplate = `{ } } }, + "gallery.File": { + "type": "object", + "properties": { + "filename": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + }, + "gallery.GalleryModel": { + "type": "object", + "properties": { + "config_file": { + "description": "config_file is read in the situation where URL is blank - and therefore this is a base config.", + "type": "object", + "additionalProperties": true + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "name": { + "type": "string" + }, + "overrides": { + "description": "Overrides are used to override the configuration of the model located at URL", + "type": "object", + "additionalProperties": true + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "localai.GalleryModel": { + "type": "object", + "properties": { + "config_file": { + "description": "config_file is read in the situation where URL is blank - and therefore this is a base config.", + "type": "object", + "additionalProperties": true + }, + "config_url": { + "type": "string" + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "id": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "name": { + "type": "string" + }, + "overrides": { + "description": "Overrides are used to override the configuration of the model located at URL", + "type": "object", + "additionalProperties": true + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "openai.Assistant": { "type": "object", "properties": { @@ -636,6 +941,17 @@ const docTemplate = `{ } } }, + "schema.GalleryResponse": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, "schema.Item": { "type": "object", "properties": { @@ -660,6 +976,76 @@ const docTemplate = `{ } } }, + "schema.JINADocumentResult": { + "type": "object", + "properties": { + "document": { + "$ref": "#/definitions/schema.JINAText" + }, + "index": { + "type": "integer" + }, + "relevance_score": { + "type": "number" + } + } + }, + "schema.JINARerankRequest": { + "type": "object", + "properties": { + "documents": { + "type": "array", + "items": { + "type": "string" + } + }, + "model": { + "type": "string" + }, + "query": { + "type": "string" + }, + "top_n": { + "type": "integer" + } + } + }, + "schema.JINARerankResponse": { + "type": "object", + "properties": { + "model": { + "type": "string" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/schema.JINADocumentResult" + } + }, + "usage": { + "$ref": "#/definitions/schema.JINAUsageInfo" + } + } + }, + "schema.JINAText": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + } + }, + "schema.JINAUsageInfo": { + "type": "object", + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + } + }, "schema.Message": { "type": "object", "properties": { diff --git a/swagger/swagger.json b/swagger/swagger.json index aedfd4385e5..a2e9de4a3f1 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -15,6 +15,134 @@ }, "basePath": "/", "paths": { + "/models/apply": { + "post": { + "summary": "Install models to LocalAI.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/localai.GalleryModel" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.GalleryResponse" + } + } + } + } + }, + "/models/available": { + "get": { + "summary": "List installable models.", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryModel" + } + } + } + } + } + }, + "/models/delete/{name}": { + "post": { + "summary": "delete models to LocalAI.", + "parameters": [ + { + "type": "string", + "description": "Model name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.GalleryResponse" + } + } + } + } + }, + "/models/galleries": { + "get": { + "summary": "List all Galleries", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + }, + "post": { + "summary": "Adds a gallery in LocalAI", + "parameters": [ + { + "description": "Gallery details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/config.Gallery" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + }, + "delete": { + "summary": "removes a gallery from LocalAI", + "parameters": [ + { + "description": "Gallery details", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/config.Gallery" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + } + }, "/tts": { "post": { "consumes": [ @@ -280,6 +408,30 @@ } } }, + "/v1/rerank": { + "post": { + "summary": "Reranks a list of phrases by relevance to a given text query.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schema.JINARerankRequest" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.JINARerankResponse" + } + } + } + } + }, "/v1/text-to-speech/{voice-id}": { "post": { "summary": "Generates audio from the input text.", @@ -313,6 +465,17 @@ } }, "definitions": { + "config.Gallery": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, "functions.Argument": { "type": "object", "properties": { @@ -445,6 +608,148 @@ } } }, + "gallery.File": { + "type": "object", + "properties": { + "filename": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "uri": { + "type": "string" + } + } + }, + "gallery.GalleryModel": { + "type": "object", + "properties": { + "config_file": { + "description": "config_file is read in the situation where URL is blank - and therefore this is a base config.", + "type": "object", + "additionalProperties": true + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "name": { + "type": "string" + }, + "overrides": { + "description": "Overrides are used to override the configuration of the model located at URL", + "type": "object", + "additionalProperties": true + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "localai.GalleryModel": { + "type": "object", + "properties": { + "config_file": { + "description": "config_file is read in the situation where URL is blank - and therefore this is a base config.", + "type": "object", + "additionalProperties": true + }, + "config_url": { + "type": "string" + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "id": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "name": { + "type": "string" + }, + "overrides": { + "description": "Overrides are used to override the configuration of the model located at URL", + "type": "object", + "additionalProperties": true + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "openai.Assistant": { "type": "object", "properties": { @@ -629,6 +934,17 @@ } } }, + "schema.GalleryResponse": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, "schema.Item": { "type": "object", "properties": { @@ -653,6 +969,76 @@ } } }, + "schema.JINADocumentResult": { + "type": "object", + "properties": { + "document": { + "$ref": "#/definitions/schema.JINAText" + }, + "index": { + "type": "integer" + }, + "relevance_score": { + "type": "number" + } + } + }, + "schema.JINARerankRequest": { + "type": "object", + "properties": { + "documents": { + "type": "array", + "items": { + "type": "string" + } + }, + "model": { + "type": "string" + }, + "query": { + "type": "string" + }, + "top_n": { + "type": "integer" + } + } + }, + "schema.JINARerankResponse": { + "type": "object", + "properties": { + "model": { + "type": "string" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/schema.JINADocumentResult" + } + }, + "usage": { + "$ref": "#/definitions/schema.JINAUsageInfo" + } + } + }, + "schema.JINAText": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + } + }, + "schema.JINAUsageInfo": { + "type": "object", + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + } + }, "schema.Message": { "type": "object", "properties": { diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 9c23c8118b4..685dd1984ac 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -1,5 +1,12 @@ basePath: / definitions: + config.Gallery: + properties: + name: + type: string + url: + type: string + type: object functions.Argument: properties: properties: @@ -86,6 +93,105 @@ definitions: type: type: string type: object + gallery.File: + properties: + filename: + type: string + sha256: + type: string + uri: + type: string + type: object + gallery.GalleryModel: + properties: + config_file: + additionalProperties: true + description: config_file is read in the situation where URL is blank - and + therefore this is a base config. + type: object + description: + type: string + files: + description: AdditionalFiles are used to add additional files to the model + items: + $ref: '#/definitions/gallery.File' + type: array + gallery: + allOf: + - $ref: '#/definitions/config.Gallery' + description: Gallery is a reference to the gallery which contains the model + icon: + type: string + installed: + description: Installed is used to indicate if the model is installed or not + type: boolean + license: + type: string + name: + type: string + overrides: + additionalProperties: true + description: Overrides are used to override the configuration of the model + located at URL + type: object + tags: + items: + type: string + type: array + url: + type: string + urls: + items: + type: string + type: array + type: object + localai.GalleryModel: + properties: + config_file: + additionalProperties: true + description: config_file is read in the situation where URL is blank - and + therefore this is a base config. + type: object + config_url: + type: string + description: + type: string + files: + description: AdditionalFiles are used to add additional files to the model + items: + $ref: '#/definitions/gallery.File' + type: array + gallery: + allOf: + - $ref: '#/definitions/config.Gallery' + description: Gallery is a reference to the gallery which contains the model + icon: + type: string + id: + type: string + installed: + description: Installed is used to indicate if the model is installed or not + type: boolean + license: + type: string + name: + type: string + overrides: + additionalProperties: true + description: Overrides are used to override the configuration of the model + located at URL + type: object + tags: + items: + type: string + type: array + url: + type: string + urls: + items: + type: string + type: array + type: object openai.Assistant: properties: created: @@ -214,6 +320,13 @@ definitions: name: type: string type: object + schema.GalleryResponse: + properties: + status: + type: string + uuid: + type: string + type: object schema.Item: properties: b64_json: @@ -230,6 +343,51 @@ definitions: description: Images type: string type: object + schema.JINADocumentResult: + properties: + document: + $ref: '#/definitions/schema.JINAText' + index: + type: integer + relevance_score: + type: number + type: object + schema.JINARerankRequest: + properties: + documents: + items: + type: string + type: array + model: + type: string + query: + type: string + top_n: + type: integer + type: object + schema.JINARerankResponse: + properties: + model: + type: string + results: + items: + $ref: '#/definitions/schema.JINADocumentResult' + type: array + usage: + $ref: '#/definitions/schema.JINAUsageInfo' + type: object + schema.JINAText: + properties: + text: + type: string + type: object + schema.JINAUsageInfo: + properties: + prompt_tokens: + type: integer + total_tokens: + type: integer + type: object schema.Message: properties: content: @@ -458,6 +616,87 @@ info: title: LocalAI API version: 2.0.0 paths: + /models/apply: + post: + parameters: + - description: query params + in: body + name: request + required: true + schema: + $ref: '#/definitions/localai.GalleryModel' + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.GalleryResponse' + summary: Install models to LocalAI. + /models/available: + get: + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/gallery.GalleryModel' + type: array + summary: List installable models. + /models/delete/{name}: + post: + parameters: + - description: Model name + in: path + name: name + required: true + type: string + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.GalleryResponse' + summary: delete models to LocalAI. + /models/galleries: + delete: + parameters: + - description: Gallery details + in: body + name: request + required: true + schema: + $ref: '#/definitions/config.Gallery' + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/config.Gallery' + type: array + summary: removes a gallery from LocalAI + get: + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/config.Gallery' + type: array + summary: List all Galleries + post: + parameters: + - description: Gallery details + in: body + name: request + required: true + schema: + $ref: '#/definitions/config.Gallery' + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/config.Gallery' + type: array + summary: Adds a gallery in LocalAI /tts: post: consumes: @@ -626,6 +865,21 @@ paths: schema: $ref: '#/definitions/schema.ModelsDataResponse' summary: List and describe the various models available in the API. + /v1/rerank: + post: + parameters: + - description: query params + in: body + name: request + required: true + schema: + $ref: '#/definitions/schema.JINARerankRequest' + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.JINARerankResponse' + summary: Reranks a list of phrases by relevance to a given text query. /v1/text-to-speech/{voice-id}: post: parameters: